diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 03d3990..e65bf4c 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -208,13 +208,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) { m_wavecomponent.setAudioFile(processor.getAudioFile()); } - if (processor.getAudioFile()==File() && processor.isRecordingEnabled()==false && m_wavecomponent.isUsingAudioBuffer()==false) - { - auto bufptr = processor.getStretchSource()->getSourceAudioBuffer(); - if (bufptr!=nullptr) - m_wavecomponent.setAudioBuffer(bufptr, - processor.getSampleRateChecked(), bufptr->getNumSamples()); - } + m_wavecomponent.setTimeSelection(processor.getTimeSelection()); if (processor.m_state_dirty) { @@ -234,24 +228,6 @@ void PaulstretchpluginAudioProcessorEditor::setAudioFile(File f) m_wavecomponent.setAudioFile(f); } -void PaulstretchpluginAudioProcessorEditor::setAudioBuffer(AudioBuffer* buf, int samplerate, int len) -{ - MessageManager::callAsync([this,buf, samplerate, len]() - { - m_wavecomponent.setAudioBuffer(buf, samplerate, len); - }); -} - -void PaulstretchpluginAudioProcessorEditor::beginAddingAudioBlocks(int channels, int samplerate, int totalllen) -{ - m_wavecomponent.beginAddingAudioBlocks(channels, samplerate, totalllen); -} - -void PaulstretchpluginAudioProcessorEditor::addAudioBlock(AudioBuffer& buf, int samplerate, int pos) -{ - m_wavecomponent.addAudioBlock(buf, samplerate, pos); -} - bool PaulstretchpluginAudioProcessorEditor::isInterestedInFileDrag(const StringArray & files) { if (files.size() == 0) @@ -520,34 +496,6 @@ 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); - m_thumb->addBlock(0, *buf, 0, len); - */ -} - -void WaveformComponent::beginAddingAudioBlocks(int channels, int samplerate, int totalllen) -{ - /* - m_waveimage = Image(); - m_curfile = File(); - m_thumb->reset(channels, samplerate, totalllen); - */ -} - -void WaveformComponent::addAudioBlock(AudioBuffer& buf, int samplerate, int pos) -{ - /* - m_thumb->addBlock(pos, buf, 0, buf.getNumSamples()); - */ -} - void WaveformComponent::timerCallback() { repaint(); diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 795a47d..bf67772 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -89,10 +89,7 @@ public: void setAudioFile(File f); const File& getAudioFile() const { return m_curfile; } 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; + void timerCallback() override; std::function CursorPosCallback; std::function SeekCallback; std::function, int)> TimeSelectionChangedCallback; @@ -187,9 +184,7 @@ public: void resized() override; void timerCallback(int id) override; void setAudioFile(File f); - void setAudioBuffer(AudioBuffer* buf, int samplerate, int len); - void beginAddingAudioBlocks(int channels, int samplerate, int totalllen); - void addAudioBlock(AudioBuffer& buf, int samplerate, int pos); + bool isInterestedInFileDrag(const StringArray &files) override; void filesDropped(const StringArray &files, int x, int y) override; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index fa1be3b..4e8d9ab 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -442,7 +442,6 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl getSampleRateChecked(), len); m_thumb->reset(m_recbuffer.getNumChannels(), sampleRate, len); - //callGUI(this,[this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRateChecked(), len); },false); } if (m_prebuffering_inited == false) { @@ -537,12 +536,6 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M int recbuflenframes = m_max_reclen * getSampleRate(); copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes); m_thumb->addBlock(m_rec_pos, buffer, 0, buffer.getNumSamples()); - /* - callGUI(this,[this, &buffer](PaulstretchpluginAudioProcessorEditor*ed) - { - ed->addAudioBlock(buffer, getSampleRate(), m_rec_pos); - }, false); - */ m_rec_pos = (m_rec_pos + buffer.getNumSamples()) % recbuflenframes; return; } @@ -661,12 +654,6 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b) m_recbuffer.setSize(2, m_max_reclen*getSampleRateChecked()+4096,false,false,true); m_recbuffer.clear(); m_rec_pos = 0; - /* - callGUI(this,[this,lenbufframes](PaulstretchpluginAudioProcessorEditor* ed) - { - ed->beginAddingAudioBlocks(2, getSampleRateChecked(), lenbufframes); - },false); - */ m_thumb->reset(m_recbuffer.getNumChannels(), getSampleRateChecked(), lenbufframes); m_is_recording = true; } diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index 645b895..ea67e89 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -76,7 +76,7 @@ + extraDefs="" vst3Folder="">