}
if (vstfx->want_chunk == 1) {
+ pthread_mutex_lock (&vstfx->state_lock);
vstfx->plugin->dispatcher (vstfx->plugin, 24 /* effSetChunk */, 1, vstfx->wanted_chunk_size, vstfx->wanted_chunk, 0);
vstfx->want_chunk = 0;
+ pthread_mutex_unlock (&vstfx->state_lock);
}
}
framepos_t _transport_frame;
float _transport_speed;
mutable std::map <uint32_t, float> _parameter_defaults;
-
- Glib::Threads::Mutex _state_lock;
};
}
struct _VSTState * next;
pthread_mutex_t lock;
+ pthread_mutex_t state_lock;
pthread_cond_t window_status_change;
pthread_cond_t plugin_dispatcher_called;
pthread_cond_t window_created;
void init () {
pthread_mutex_init (&lock, 0);
+ pthread_mutex_init (&state_lock, 0);
pthread_cond_init (&window_status_change, 0);
pthread_cond_init (&plugin_dispatcher_called, 0);
pthread_cond_init (&window_created, 0);
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;
{
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
*
_plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
_midi_out_buf = 0;
+ pthread_mutex_unlock (&_state->state_lock);
return 0;
}
// XXX check
// 24 == audioMasterGetAutomationState,
// 48 == audioMasterGetChunkFile
+ pthread_mutex_lock (&vstfx->state_lock);
fst->plugin->dispatcher (fst->plugin, 24 /* effSetChunk */, 1, fst->wanted_chunk_size, fst->wanted_chunk, 0);
fst->want_chunk = 0;
+ pthread_mutex_unlock (&vstfx->state_lock);
}
}