fix propagation of parameter changes from Plugin to PluginInsert so that automation will record parameter changes performed in a plugin GUI (#4976)

git-svn-id: svn://localhost/ardour2/branches/3.0@13026 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-07-11 03:48:14 +00:00
parent bfd2ee48ce
commit 0fb8c89eeb
3 changed files with 32 additions and 27 deletions

View file

@ -137,12 +137,12 @@ class PluginInsert : public Processor
Split, ///< we copy one of our insert's inputs to multiple plugin inputs
Hide, ///< we `hide' some of the plugin's inputs by feeding them silence
};
private:
/* disallow copy construction */
PluginInsert (const PluginInsert&);
void parameter_changed (Evoral::Parameter, float);
void parameter_changed (uint32_t, float);
void set_parameter (Evoral::Parameter param, float val);
float get_parameter (Evoral::Parameter param);

View file

@ -2787,9 +2787,21 @@ AUPlugin::_parameter_change_listener (void* arg, void* src, const AudioUnitEvent
void
AUPlugin::parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 /*host_time*/, Float32 new_value)
{
ParameterMap::iterator i = parameter_map.find (event->mArgument.mParameter.mParameterID);
ParameterMap::iterator i;
if (i != parameter_map.end()) {
ParameterChanged (i->second, new_value);
}
switch (event->mEventType) {
case kAudioUnitEvent_BeginParameterChangeGesture:
break;
case kAudioUnitEvent_EndParameterChangeGesture:
break;
case kAudioUnitEvent_ParameterValueChange:
i = parameter_map.find (event->mArgument.mParameter.mParameterID);
if (i != parameter_map.end()) {
ParameterChanged (i->second, new_value);
}
break;
default:
break;
}
}

View file

@ -262,31 +262,24 @@ PluginInsert::create_automatable_parameters ()
}
void
PluginInsert::parameter_changed (Evoral::Parameter which, float val)
PluginInsert::parameter_changed (uint32_t which, float val)
{
if (which.type() != PluginAutomation) {
return;
}
boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, which));
cerr << "Param change: " << which << endl;
boost::shared_ptr<AutomationControl> ac = automation_control (which);
if (ac) {
cerr << "updating " << ac->name() << " to " << val << endl;
ac->set_double (val);
}
Plugins::iterator i = _plugins.begin();
/* don't set the first plugin, just all the slaves */
if (i != _plugins.end()) {
++i;
for (; i != _plugins.end(); ++i) {
(*i)->set_parameter (which, val);
}
}
Plugins::iterator i = _plugins.begin();
/* don't set the first plugin, just all the slaves */
if (i != _plugins.end()) {
++i;
for (; i != _plugins.end(); ++i) {
(*i)->set_parameter (which, val);
}
}
}
}
int