Add interface to inform plugins about replicated instances
This allows for asking plugins to synchronize internal state that isn't visible to the host between plugin instances.
This commit is contained in:
parent
0fac5c9c2c
commit
a28b1f548e
@ -177,6 +177,9 @@ public:
|
||||
void realtime_locate (bool);
|
||||
void monitoring_changed ();
|
||||
|
||||
virtual void add_slave (boost::shared_ptr<Plugin>, bool realtime) {}
|
||||
virtual void remove_slave (boost::shared_ptr<Plugin>) {}
|
||||
|
||||
struct UILayoutHint {
|
||||
UILayoutHint () : x0 (-1), x1 (-1), y0 (-1), y1 (-1), knob (false) { }
|
||||
int x0;
|
||||
|
@ -421,6 +421,7 @@ private:
|
||||
|
||||
boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>);
|
||||
void add_plugin (boost::shared_ptr<Plugin>);
|
||||
void plugin_removed (boost::weak_ptr<Plugin>);
|
||||
|
||||
void add_sidechain_from_xml (const XMLNode& node, int version);
|
||||
|
||||
|
@ -3151,6 +3151,9 @@ PluginInsert::get_impulse_analysis_plugin()
|
||||
ret->configure_io (internal_input_streams (), out);
|
||||
ret->set_owner (_owner);
|
||||
_impulseAnalysisPlugin = ret;
|
||||
|
||||
_plugins[0]->add_slave (ret, false);
|
||||
ret->DropReferences.connect_same_thread (*this, boost::bind (&PluginInsert::plugin_removed, this, _impulseAnalysisPlugin));
|
||||
} else {
|
||||
ret = _impulseAnalysisPlugin.lock();
|
||||
}
|
||||
@ -3212,6 +3215,21 @@ PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
|
||||
#endif
|
||||
|
||||
_plugins.push_back (plugin);
|
||||
|
||||
if (_plugins.size() > 1) {
|
||||
_plugins[0]->add_slave (plugin, true);
|
||||
plugin->DropReferences.connect_same_thread (*this, boost::bind (&PluginInsert::plugin_removed, this, boost::weak_ptr<Plugin> (plugin)));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PluginInsert::plugin_removed (boost::weak_ptr<Plugin> wp)
|
||||
{
|
||||
boost::shared_ptr<Plugin> plugin = wp.lock();
|
||||
if (_plugins.size () == 0 || !plugin) {
|
||||
return;
|
||||
}
|
||||
_plugins[0]->remove_slave (plugin);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user