From d32d855e64de9966813c0293a15f0874357b6036 Mon Sep 17 00:00:00 2001 From: xenakios Date: Thu, 16 Nov 2017 00:37:24 +0200 Subject: [PATCH] macOs build fixes. Plugin itself doesn't work properly... --- Source/PluginEditor.cpp | 9 +- Source/PluginProcessor.cpp | 21 ++- Source/PluginProcessor.h | 13 +- paulstretchplugin.jucer | 304 +++++++++++++++++++------------------ 4 files changed, 179 insertions(+), 168 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index f81f0bd..4d9c38a 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -58,8 +58,13 @@ void PaulstretchpluginAudioProcessorEditor::buttonClicked(Button * but) } if (but == &m_import_button) { - FileChooser myChooser("Please select audio file...", - File("C:/MusicAudio/sourcesamples"), +#ifdef WIN32 + File initialloc("C:/MusicAudio/sourcesamples"); +#else + File initialloc("/Users/teemu/AudioProjects/sourcesamples"); +#endif + FileChooser myChooser("Please select audio file...", + initialloc, "*.wav"); if (myChooser.browseForFileToOpen()) { diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index cb17345..5bab348 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -13,6 +13,19 @@ #undef min #undef max +template +void callGUI(AudioProcessor* ap, F&& f, bool async) +{ + auto ed = dynamic_cast(ap->getActiveEditor()); + if (ed) + { + if (async == false) + f(ed); + else + MessageManager::callAsync([ed,f]() { f(ed); }); + } +} + //============================================================================== PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() #ifndef JucePlugin_PreferredChannelConfigurations @@ -123,7 +136,7 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl m_control->getStretchAudioSource()->setAudioBufferAsInputSource(&m_recbuffer, getSampleRate(), len); - callGUI([this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRate(), len); },false); + callGUI(this,[this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRate(), len); },false); } if (m_ready_to_play == false) { @@ -204,7 +217,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M { int recbuflenframes = m_max_reclen * getSampleRate(); copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes); - callGUI([this, &buffer](PaulstretchpluginAudioProcessorEditor*ed) + callGUI(this,[this, &buffer](PaulstretchpluginAudioProcessorEditor*ed) { ed->addAudioBlock(buffer, getSampleRate(), m_rec_pos); }, false); @@ -275,7 +288,7 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int setAudioFile(f); Timer::callAfterDelay(500, [this,f]() { - callGUI([f,this](PaulstretchpluginAudioProcessorEditor* ed) + callGUI(this,[f,this](PaulstretchpluginAudioProcessorEditor* ed) { ed->setAudioFile(f); ed->m_wavecomponent.setTimeSelection({ *getFloatParameter(5),*getFloatParameter(6) }); @@ -297,7 +310,7 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b) m_recbuffer.setSize(2, m_max_reclen*getSampleRate()+4096); m_recbuffer.clear(); m_rec_pos = 0; - callGUI([this,lenbufframes](PaulstretchpluginAudioProcessorEditor* ed) + callGUI(this,[this,lenbufframes](PaulstretchpluginAudioProcessorEditor* ed) { ed->beginAddingAudioBlocks(2, getSampleRate(), lenbufframes); },false); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index e3cbb42..85f6a90 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -79,18 +79,7 @@ private: int m_cur_num_out_chans = 2; std::mutex m_mutex; File m_current_file; - template - void callGUI(F&& f, bool async) - { - auto ed = dynamic_cast(getActiveEditor()); - if (ed) - { - if (async == false) - f(ed); - else - MessageManager::callAsync([ed,f]() { f(ed); }); - } - } + //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor) }; diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index 2081e70..933885a 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -1,150 +1,154 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +