throw new NonMonotonicSequenceException(val[index], previous, index, dir, strict); } else { return false;
@Override public int findRelease (final double [] magnitudeArray) throws SoundTransformException { int releaseIndexFromReversed = 0; final double [] reversed = new double [magnitudeArray.length]; System.arraycopy (magnitudeArray, 0, reversed, 0, reversed.length); Collections.reverse (Arrays.asList (reversed)); try { MathArrays.checkOrder (magnitudeArray, MathArrays.OrderDirection.INCREASING, true); } catch (final NonMonotonicSequenceException nmse) { this.log (new LogEvent (MagnitudeADSRHelperEventCode.FOUND_EDGE, nmse)); releaseIndexFromReversed = nmse.getIndex () - 1; } return magnitudeArray.length - releaseIndexFromReversed; }
@Override public int findSustain (final double [] magnitudeArray, final int decay) throws SoundTransformException { int sustainIndex = decay; //start == decay final double [] sustainArray = new double [magnitudeArray.length - decay]; System.arraycopy (magnitudeArray, decay, sustainArray, 0, magnitudeArray.length - decay); try { MathArrays.checkOrder (sustainArray, MathArrays.OrderDirection.DECREASING, true); } catch (final NonMonotonicSequenceException nmse) { this.log (new LogEvent (MagnitudeADSRHelperEventCode.FOUND_EDGE, nmse)); sustainIndex = nmse.getIndex () - 1; } return Math.max (decay, sustainIndex); } }
throw new NonMonotonicSequenceException(val[index], previous, index, dir, strict); } else { return false;
@Override public int findDecay (final double [] magnitudeArray, final int attack) throws SoundTransformException { int decayIndex = attack; final double [] decayArray = new double [magnitudeArray.length - attack]; System.arraycopy (magnitudeArray, attack, decayArray, 0, magnitudeArray.length - attack); try { MathArrays.checkOrder (decayArray, MathArrays.OrderDirection.INCREASING, true); } catch (final NonMonotonicSequenceException nmse) { this.log (new LogEvent (MagnitudeADSRHelperEventCode.FOUND_EDGE, nmse)); decayIndex = nmse.getIndex () - 1; } return decayIndex; }
throw new NonMonotonicSequenceException(val[index], previous, index, dir, strict); } else { return false;