/** * Get the AudioInputStream for the current selection * * @see com.groovemanager.sampled.AudioPlayerProvider#getAudioInputStream() */ public AudioInputStream getAudioInputStream() throws NotReadyException { Selection sel = waveDisplay.getSelection(); lastStart = sel.getLeft(); if (lastStart >= cutList.getLength()) lastStart = 0; int right = sel.getRight(); if (right > cutList.getLength()) right = cutList.getLength(); if (lastStart == right) return cutList.getAudioInputStream(lastStart, cutList.getLength() - right); else return cutList.getAudioInputStream(lastStart, right - lastStart); }
/** Trim this WaveTab´s data to the current selection */ public void performTrim() { Selection sel = waveDisplay.getSelection(); int pos = sel.getLeft(); cutList.addElement(new DeleteElement(0, sel.getLeft())); cutList.addElement( new DeleteElement( sel.getRight() - sel.getLeft(), cutList.getLength() - sel.getRight() + sel.getLeft())); waveDisplay.setSelection(new Selection(0, cutList.getLength())); waveDisplay.setPosition(0); }
/** @see com.groovemanager.sampled.waveform.WaveFormProvider#getTotalLength() */ public int getTotalLength() { return cutList.getLength(); }
/** * Get the whole AudioInputStream from this WaveTab´s audio data independent of its selection * * @return The AudioInputStream for all of this WaveTab´s audio data * @throws NotReadyException If no audio data can be provided at the moment */ public AudioInputStream getWholeAudioInputStream() throws NotReadyException { return cutList.getAudioInputStream(0, cutList.getLength()); }