Forward "owner" from Processor to Plugin

This commit is contained in:
Robin Gareus 2016-10-10 16:58:38 +02:00
parent 4f8fdf0af7
commit b9791aa63c
4 changed files with 18 additions and 1 deletions

View File

@ -51,6 +51,7 @@ class PluginInsert;
class Plugin;
class PluginInfo;
class AutomationControl;
class SessionObject;
typedef boost::shared_ptr<Plugin> PluginPtr;
typedef boost::shared_ptr<PluginInfo> PluginInfoPtr;
@ -262,6 +263,9 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
PluginInfoPtr get_info() const { return _info; }
virtual void set_info (const PluginInfoPtr inf);
virtual void set_owner (SessionObject* o) { _owner = o; }
SessionObject* owner() const { return _owner; }
ARDOUR::AudioEngine& engine() const { return _engine; }
ARDOUR::Session& session() const { return _session; }
@ -335,6 +339,8 @@ protected:
uint32_t _cycles;
std::map<std::string, PresetRecord> _presets;
SessionObject* _owner;
private:
/** Fill _presets with our presets */

View File

@ -59,6 +59,7 @@ class LIBARDOUR_API PluginInsert : public Processor
XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
void update_id (PBD::ID);
void set_owner (SessionObject*);
void set_state_dir (const std::string& d = "");
void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);

View File

@ -127,7 +127,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
PluginPinWindowProxy * pinmgr_proxy () const { return _pinmgr_proxy; }
void set_pingmgr_proxy (PluginPinWindowProxy* wp) { _pinmgr_proxy = wp ; }
void set_owner (SessionObject*);
virtual void set_owner (SessionObject*);
SessionObject* owner() const;
protected:

View File

@ -2617,6 +2617,15 @@ PluginInsert::update_id (PBD::ID id)
}
}
void
PluginInsert::set_owner (SessionObject* o)
{
Processor::set_owner (o);
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->set_owner (o);
}
}
void
PluginInsert::set_state_dir (const std::string& d)
{
@ -2907,6 +2916,7 @@ void
PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
{
plugin->set_insert_id (this->id());
plugin->set_owner (_owner);
if (_plugins.empty()) {
/* first (and probably only) plugin instance - connect to relevant signals */