summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin_insert.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-02-21 15:02:29 +0100
committerRobin Gareus <robin@gareus.org>2017-02-21 15:24:20 +0100
commit5db22a33c1ec13a14dd6654bf08b0ecd377ae67d (patch)
tree0d64bffa49a7a585bd49508241f1ae32e25db0b0 /libs/ardour/plugin_insert.cc
parent1b2a64c391d7f4a81dda85bdbd063fb80329e498 (diff)
Add API allowing plugin preset load to affect automation
Diffstat (limited to 'libs/ardour/plugin_insert.cc')
-rw-r--r--libs/ardour/plugin_insert.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index bf97a1217e..daae15d3ad 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -490,7 +490,9 @@ PluginInsert::create_automatable_parameters ()
ac->Changed.connect_same_thread (*this, boost::bind (&PluginInsert::enable_changed, this));
}
}
+ plugin->PresetPortSetValue.connect_same_thread (*this, boost::bind (&PluginInsert::preset_load_set_value, this, _1, _2));
}
+
/** Called when something outside of this host has modified a plugin
* parameter. Responsible for propagating the change to two places:
*
@@ -650,6 +652,23 @@ PluginInsert::bypassable_changed ()
}
void
+PluginInsert::preset_load_set_value (uint32_t p, float v)
+{
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter(PluginAutomation, 0, p));
+ if (!ac) {
+ return;
+ }
+
+ if (ac->automation_state() & Play) {
+ return;
+ }
+
+ start_touch (p);
+ ac->set_value (v, Controllable::NoGroup);
+ end_touch (p);
+}
+
+void
PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& out_map, framecnt_t nframes, framecnt_t offset) const
{
// TODO optimize: store "unconnected" in a fixed set.
@@ -3014,19 +3033,21 @@ PluginInsert::latency_changed ()
void
PluginInsert::start_touch (uint32_t param_id)
{
- boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
- if (ac) {
- ac->start_touch (session().audible_frame());
- }
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
+ if (ac) {
+ // ToDo subtract _plugin_signal_latency from audible_frame() when rolling, assert > 0
+ ac->start_touch (session().audible_frame());
+ }
}
void
PluginInsert::end_touch (uint32_t param_id)
{
- boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
- if (ac) {
- ac->stop_touch (true, session().audible_frame());
- }
+ boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, param_id));
+ if (ac) {
+ // ToDo subtract _plugin_signal_latency from audible_frame() when rolling, assert > 0
+ ac->stop_touch (true, session().audible_frame());
+ }
}
std::ostream& operator<<(std::ostream& o, const ARDOUR::PluginInsert::Match& m)