Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Wait for reply when updating sample rate
  • Loading branch information
DomClark authored and PhysSong committed Jan 17, 2018
1 parent 709fc79 commit d0b3be7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 7 additions & 0 deletions include/RemotePlugin.h
Expand Up @@ -419,6 +419,7 @@ enum RemoteMessageIDs
IdQuit,
IdSampleRateInformation,
IdBufferSizeInformation,
IdInformationUpdated,
IdMidiEvent,
IdStartProcessing,
IdProcessingDone,
Expand Down Expand Up @@ -807,6 +808,7 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
{
lock();
sendMessage( message( IdSampleRateInformation ).addInt( _sr ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}

Expand Down Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions plugins/vst_base/RemoteVstPlugin.cpp
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions plugins/vst_base/VstPlugin.cpp
Expand Up @@ -306,6 +306,7 @@ void VstPlugin::updateSampleRate()
lock();
sendMessage( message( IdSampleRateInformation ).
addInt( Engine::mixer()->processingSampleRate() ) );
waitForMessage( IdInformationUpdated, true );
unlock();
}

Expand Down

0 comments on commit d0b3be7

Please sign in to comment.