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

@ -142,7 +142,7 @@ class PluginInsert : public Processor
/* disallow copy construction */ /* disallow copy construction */
PluginInsert (const PluginInsert&); PluginInsert (const PluginInsert&);
void parameter_changed (Evoral::Parameter, float); void parameter_changed (uint32_t, float);
void set_parameter (Evoral::Parameter param, float val); void set_parameter (Evoral::Parameter param, float val);
float get_parameter (Evoral::Parameter param); float get_parameter (Evoral::Parameter param);

View file

@ -2787,9 +2787,21 @@ AUPlugin::_parameter_change_listener (void* arg, void* src, const AudioUnitEvent
void void
AUPlugin::parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 /*host_time*/, Float32 new_value) 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()) { switch (event->mEventType) {
ParameterChanged (i->second, new_value); 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 void
PluginInsert::parameter_changed (Evoral::Parameter which, float val) PluginInsert::parameter_changed (uint32_t which, float val)
{ {
if (which.type() != PluginAutomation) { boost::shared_ptr<AutomationControl> ac = automation_control (Evoral::Parameter (PluginAutomation, 0, which));
return;
}
cerr << "Param change: " << which << endl;
boost::shared_ptr<AutomationControl> ac = automation_control (which);
if (ac) { if (ac) {
cerr << "updating " << ac->name() << " to " << val << endl;
ac->set_double (val); ac->set_double (val);
}
Plugins::iterator i = _plugins.begin(); Plugins::iterator i = _plugins.begin();
/* don't set the first plugin, just all the slaves */ /* don't set the first plugin, just all the slaves */
if (i != _plugins.end()) { if (i != _plugins.end()) {
++i; ++i;
for (; i != _plugins.end(); ++i) { for (; i != _plugins.end(); ++i) {
(*i)->set_parameter (which, val); (*i)->set_parameter (which, val);
} }
} }
}
} }
int int