macOs build fixes. Plugin itself doesn't work properly...

This commit is contained in:
xenakios
2017-11-16 00:37:24 +02:00
parent c283d719d0
commit d32d855e64
4 changed files with 179 additions and 168 deletions

View File

@ -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())
{

View File

@ -13,6 +13,19 @@
#undef min
#undef max
template<typename F>
void callGUI(AudioProcessor* ap, F&& f, bool async)
{
auto ed = dynamic_cast<PaulstretchpluginAudioProcessorEditor*>(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);

View File

@ -79,18 +79,7 @@ private:
int m_cur_num_out_chans = 2;
std::mutex m_mutex;
File m_current_file;
template<typename F>
void callGUI(F&& f, bool async)
{
auto ed = dynamic_cast<PaulstretchpluginAudioProcessorEditor*>(getActiveEditor());
if (ed)
{
if (async == false)
f(ed);
else
MessageManager::callAsync([ed,f]() { f(ed); });
}
}
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
};