use of blue.ui.utilities.audio.AudioWaveformData in project blue by kunstmusik.
the class AudioFileRenderer method paintWaveform.
private void paintWaveform(Graphics2D g, SoundObjectView sObjView, int pixelSeconds) {
AudioFile audioFile = (AudioFile) sObjView.getSoundObject();
String audioFilename = audioFile.getSoundFileName();
int sObjVisibleHeight = sObjView.getHeight() - 4;
AudioWaveformData waveData = (AudioWaveformData) sObjView.getClientProperty(AUDIO_WAVEFORM_DATA);
if (waveData == null) {
waveData = waveCache.getAudioWaveformData(BlueSystem.getFullPath(audioFilename), pixelSeconds);
if (waveData.percentLoadingComplete < 1.0) {
waveCache.addAudioWaveformListener(new AudioWaveformListener(audioFilename, sObjView));
}
sObjView.putClientProperty(AUDIO_WAVEFORM_DATA, waveData);
} else if (waveData.pixelSeconds != pixelSeconds || !waveData.fileName.equals(audioFile.getSoundFileName())) {
waveData = waveCache.getAudioWaveformData(BlueSystem.getFullPath(audioFilename), pixelSeconds);
sObjView.putClientProperty(AUDIO_WAVEFORM_DATA, waveData);
if (waveData.percentLoadingComplete < 1.0) {
waveCache.addAudioWaveformListener(new AudioWaveformListener(audioFilename, sObjView));
}
}
g.translate(1, 2);
AudioWaveformUI.paintWaveForm(g, sObjVisibleHeight, waveData, 0);
g.translate(-1, -2);
}
Aggregations