/** * @see * com.groovemanager.sampled.waveform.WaveFormProvider#getWaveForm(com.groovemanager.sampled.waveform.AbstractWaveFormDisplay, * int, int, int) */ public WaveForm getWaveForm(AbstractWaveFormDisplay display, int start, int length, int width) { if (display == waveDisplay) { // Can we use the last WaveForm? if (lastWaveForm != null && lastWaveForm.canProvide( (int) Math.round((start - lastWaveFormPos) / lastWaveForm.getZoomFactor()), (int) Math.round(length / lastWaveForm.getZoomFactor()), width)) lastWaveForm = lastWaveForm.subWaveForm( (int) Math.round((start - lastWaveFormPos) / lastWaveForm.getZoomFactor()), (int) Math.round(length / lastWaveForm.getZoomFactor()), width); else lastWaveForm = cutList.getWaveForm(start, length, width); lastWaveFormPos = start; return lastWaveForm; } else { // Can we use the last WaveForm? if (lastZoomWaveForm != null && lastZoomWaveForm.canProvide( (int) Math.round((start - lastZoomWaveFormPos) / lastZoomWaveForm.getZoomFactor()), (int) Math.round(length / lastZoomWaveForm.getZoomFactor()), width)) lastZoomWaveForm = lastZoomWaveForm.subWaveForm( (int) Math.round((start - lastZoomWaveFormPos) / lastZoomWaveForm.getZoomFactor()), (int) Math.round(length / lastZoomWaveForm.getZoomFactor()), width); else lastZoomWaveForm = cutList.getWaveForm(start, length, width); lastZoomWaveFormPos = start; return lastZoomWaveForm; } }