summaryrefslogtreecommitdiff
path: root/libs/ardour/vst_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-11-14 21:05:36 +0100
committerRobin Gareus <robin@gareus.org>2016-11-14 21:06:18 +0100
commitf30fbcaaf968dcb5af8b762b6e3d25f6fe313f3f (patch)
tree51dfdfda0759fdc5f72e55a1a493fc0d8263dd29 /libs/ardour/vst_plugin.cc
parent8e3b6c9ac6b4d0e167ab116d197d32b0f8202e8b (diff)
Fix VST state-lock SNAFU (effSetChunk and process are exclusive)
Diffstat (limited to 'libs/ardour/vst_plugin.cc')
-rw-r--r--libs/ardour/vst_plugin.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 8214d0be81..1fd8d8cd55 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -172,8 +172,9 @@ VSTPlugin::set_chunk (gchar const * data, bool single)
int r = 0;
guchar* raw_data = g_base64_decode (data, &size);
{
- Glib::Threads::Mutex::Lock lm (_lock);
+ pthread_mutex_lock (&_state->state_lock);
r = _plugin->dispatcher (_plugin, 24 /* effSetChunk */, single ? 1 : 0, size, raw_data, 0);
+ pthread_mutex_unlock (&_state->state_lock);
}
g_free (raw_data);
return r;
@@ -566,8 +567,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
{
Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
- Glib::Threads::Mutex::Lock lm (_state_lock, Glib::Threads::TRY_LOCK);
- if (!lm.locked()) {
+ if (pthread_mutex_trylock (&_state->state_lock)) {
/* by convention 'effSetChunk' should not be called while processing
* http://www.reaper.fm/sdk/vst/vst_ext.php
*
@@ -645,6 +645,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
_plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
_midi_out_buf = 0;
+ pthread_mutex_unlock (&_state->state_lock);
return 0;
}