Skip to content

Commit

Permalink
Only regenerate waveform cache in AFP at critical points
Browse files Browse the repository at this point in the history
  • Loading branch information
sakertooth committed Nov 10, 2024
1 parent 872d67b commit 168e6fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/AudioFileProcessor/AudioFileProcessorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void AudioFileProcessorView::dropEvent(QDropEvent* de)
}

m_waveView->updateSampleRange();
m_waveView->updateWaveform();
Engine::getSong()->setModified();
de->accept();
}
Expand Down Expand Up @@ -263,6 +264,7 @@ void AudioFileProcessorView::openAudioFile()
castModel<AudioFileProcessor>()->setAudioFile(af);
Engine::getSong()->setModified();
m_waveView->updateSampleRange();
m_waveView->updateWaveform();
}

void AudioFileProcessorView::modelChanged()
Expand Down
4 changes: 4 additions & 0 deletions plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ void AudioFileProcessorWaveView::updateSampleRange()
setFrom(m_sample->startFrame() - marging);
setTo(m_sample->endFrame() + marging);
}
}

void AudioFileProcessorWaveView::updateWaveform()
{
m_waveform.reset(m_sample->data(), m_sample->sampleSize());
}

Expand Down Expand Up @@ -92,6 +95,7 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView(QWidget* parent, int w, i
configureKnobRelationsAndWaveViews();

updateSampleRange();
updateWaveform();

m_graph.fill(Qt::transparent);
update();
Expand Down
1 change: 1 addition & 0 deletions plugins/AudioFileProcessor/AudioFileProcessorWaveView.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public slots:


void updateSampleRange();
void updateWaveform();
private:
void setTo(int to);
void setFrom(int from);
Expand Down

0 comments on commit 168e6fb

Please sign in to comment.