Search in sources :

Example 1 with AudioWaveformListener

use of blue.ui.utilities.audio.AudioWaveformListener in project blue by kunstmusik.

the class AudioClipPanel method updateWaveformData.

private void updateWaveformData() {
    String absFilePath = audioClip.getAudioFile().getAbsolutePath();
    waveData = waveformCache.getAudioWaveformData(absFilePath, timeState.getPixelSecond());
    if (waveData.percentLoadingComplete < 1.0) {
        waveformCache.addAudioWaveformListener(new AudioWaveformListener(absFilePath, this));
    }
}
Also used : AudioWaveformListener(blue.ui.utilities.audio.AudioWaveformListener)

Example 2 with AudioWaveformListener

use of blue.ui.utilities.audio.AudioWaveformListener 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);
}
Also used : AudioFile(blue.soundObject.AudioFile) AudioWaveformData(blue.ui.utilities.audio.AudioWaveformData) AudioWaveformListener(blue.ui.utilities.audio.AudioWaveformListener)

Aggregations

AudioWaveformListener (blue.ui.utilities.audio.AudioWaveformListener)2 AudioFile (blue.soundObject.AudioFile)1 AudioWaveformData (blue.ui.utilities.audio.AudioWaveformData)1