diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 9096472..917654a 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -111,7 +111,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) { m_wavecomponent.setAudioFile(processor.getAudioFile()); } - if (processor.getAudioFile()==File() && processor.isRecordingEnabled()==false) + if (processor.getAudioFile()==File() && processor.isRecordingEnabled()==false && m_wavecomponent.isUsingAudioBuffer()==false) { auto bufptr = processor.getStretchSource()->getSourceAudioBuffer(); if (bufptr!=nullptr) @@ -293,6 +293,7 @@ void WaveformComponent::setAudioFile(File f) m_thumb->reset(0, 0.0); m_thumb->setSource(new FileInputSource(f)); m_curfile = f; + m_using_audio_buffer = false; } else { @@ -305,6 +306,7 @@ void WaveformComponent::setAudioFile(File f) void WaveformComponent::setAudioBuffer(AudioBuffer* buf, int samplerate, int len) { jassert(buf!=nullptr); + m_using_audio_buffer = true; m_waveimage = Image(); m_curfile = File(); m_thumb->reset(buf->getNumChannels(), samplerate, len); diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index f98175d..aa22d28 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -182,7 +182,8 @@ public: void paint(Graphics& g) override; void setAudioFile(File f); const File& getAudioFile() const { return m_curfile; } - void setAudioBuffer(AudioBuffer* buf, int samplerate, int len); + bool isUsingAudioBuffer() const { return m_using_audio_buffer; } + void setAudioBuffer(AudioBuffer* buf, int samplerate, int len); void beginAddingAudioBlocks(int channels, int samplerate, int totalllen); void addAudioBlock(AudioBuffer& buf, int samplerate, int pos); void timerCallback() override; @@ -235,6 +236,7 @@ private: bool m_use_opengl = false; double m_rec_pos = 0.0; bool m_lock_timesel_set = false; + bool m_using_audio_buffer = false; }; class MyDynamicObject : public DynamicObject