LV2: pass patch-set messages to replicated plugin instances
This also fixes impulse analysis plugin display
This commit is contained in:
parent
58372f5b78
commit
a0810ed608
@ -144,6 +144,9 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
bool has_editor () const;
|
||||
bool has_message_output () const;
|
||||
|
||||
void add_slave (boost::shared_ptr<Plugin>, bool);
|
||||
void remove_slave (boost::shared_ptr<Plugin>);
|
||||
|
||||
bool write_from_ui(uint32_t index,
|
||||
uint32_t protocol,
|
||||
uint32_t size,
|
||||
@ -299,6 +302,9 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
|
||||
Glib::Threads::Mutex _work_mutex;
|
||||
|
||||
Glib::Threads::Mutex _slave_lock;
|
||||
std::set<boost::shared_ptr<LV2Plugin>> _slaves;
|
||||
|
||||
#ifdef LV2_EXTENDED
|
||||
static void queue_draw (LV2_Inline_Display_Handle);
|
||||
static void midnam_update (LV2_Midnam_Handle);
|
||||
|
@ -1698,6 +1698,26 @@ LV2Plugin::has_editor() const
|
||||
return _impl->ui != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
LV2Plugin::add_slave (boost::shared_ptr<Plugin> p, bool)
|
||||
{
|
||||
boost::shared_ptr<LV2Plugin> lv2 = boost::dynamic_pointer_cast<LV2Plugin> (p);
|
||||
if (lv2) {
|
||||
Glib::Threads::Mutex::Lock lm (_slave_lock);
|
||||
_slaves.insert (lv2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LV2Plugin::remove_slave (boost::shared_ptr<Plugin> p)
|
||||
{
|
||||
boost::shared_ptr<LV2Plugin> lv2 = boost::dynamic_pointer_cast<LV2Plugin> (p);
|
||||
if (lv2) {
|
||||
Glib::Threads::Mutex::Lock lm (_slave_lock);
|
||||
_slaves.erase (lv2);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LV2Plugin::has_message_output() const
|
||||
{
|
||||
@ -1761,6 +1781,14 @@ LV2Plugin::write_from_ui(uint32_t index,
|
||||
error << string_compose (_("LV2<%1>: Error writing from UI to plugin"), name()) << endmsg;
|
||||
return false;
|
||||
}
|
||||
|
||||
Glib::Threads::Mutex::Lock lm (_slave_lock, Glib::Threads::TRY_LOCK);
|
||||
if (lm.locked()) {
|
||||
for (auto const& i : _slaves) {
|
||||
i->write_from_ui (index, protocol, size, body);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user