Permalink
Browse files

Wait for reply when updating sample rate

  • Loading branch information...
DomClark authored and PhysSong committed Dec 27, 2017
1 parent 709fc79 commit d0b3be7f00e732dd1c5dbb43cb7030d42ff6a346
Showing with 9 additions and 6 deletions.
  1. +7 −0 include/RemotePlugin.h
  2. +1 −6 plugins/vst_base/RemoteVstPlugin.cpp
  3. +1 −0 plugins/vst_base/VstPlugin.cpp
View
@@ -419,6 +419,7 @@ enum RemoteMessageIDs
IdQuit,
IdSampleRateInformation,
IdBufferSizeInformation,
IdInformationUpdated,
IdMidiEvent,
IdStartProcessing,
IdProcessingDone,
@@ -807,6 +808,7 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
{
lock();
sendMessage( message( IdSampleRateInformation ).addInt( _sr ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}
@@ -1318,9 +1320,14 @@ bool RemotePluginClient::processMessage( const message & _m )
case IdSampleRateInformation:
m_sampleRate = _m.getInt();
updateSampleRate();
reply_message.id = IdInformationUpdated;
reply = true;
break;
case IdBufferSizeInformation:
// Should LMMS gain the ability to change buffer size
// without a restart, it must wait for this message to
// complete processing or else risk VST crashes
m_bufferSize = _m.getInt();
updateBufferSize();
break;
@@ -636,12 +636,7 @@ void RemoteVstPlugin::init( const std::string & _plugin_file )
updateInOutCount();
updateBufferSize();
// some plugins have to set samplerate during init
if( m_vstSyncData->hasSHM )
{
updateSampleRate();
}
updateSampleRate();
/* set program to zero */
/* i comment this out because it breaks dfx Geometer
@@ -306,6 +306,7 @@ void VstPlugin::updateSampleRate()
lock();
sendMessage( message( IdSampleRateInformation ).
addInt( Engine::mixer()->processingSampleRate() ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}

0 comments on commit d0b3be7

Please sign in to comment.