mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 11:06:32 +01:00
add StartTouch and EndTouch signals to Plugin class; make PluginInsert handle these signals and mark the start end of touch/gestures for a given AutomationControl; net result is that touch automation now works for AudioUnit plugins, at least those whose GUIs send kAudioUnitEvent_{Begin,End}ParameterGesture events
git-svn-id: svn://localhost/ardour2/branches/3.0@13028 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a782dd36e7
commit
8d6d3c309d
4 changed files with 79 additions and 5 deletions
|
|
@ -255,6 +255,9 @@ class Plugin : public PBD::StatefulDestructible, public Latent
|
|||
void set_cycles (uint32_t c) { _cycles = c; }
|
||||
cycles_t cycles() const { return _cycles; }
|
||||
|
||||
PBD::Signal1<void,uint32_t> StartTouch;
|
||||
PBD::Signal1<void,uint32_t> EndTouch;
|
||||
|
||||
protected:
|
||||
|
||||
friend class PluginInsert;
|
||||
|
|
|
|||
|
|
@ -138,6 +138,9 @@ class PluginInsert : public Processor
|
|||
Hide, ///< we `hide' some of the plugin's inputs by feeding them silence
|
||||
};
|
||||
|
||||
PBD::Signal1<void,uint32_t> StartTouch;
|
||||
PBD::Signal1<void,uint32_t> EndTouch;
|
||||
|
||||
private:
|
||||
/* disallow copy construction */
|
||||
PluginInsert (const PluginInsert&);
|
||||
|
|
@ -185,6 +188,9 @@ class PluginInsert : public Processor
|
|||
|
||||
boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>);
|
||||
void add_plugin (boost::shared_ptr<Plugin>);
|
||||
|
||||
void start_touch (uint32_t param_id);
|
||||
void end_touch (uint32_t param_id);
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
|||
|
|
@ -2753,6 +2753,26 @@ AUPlugin::listen_to_parameter (uint32_t param_id)
|
|||
return -1;
|
||||
}
|
||||
|
||||
event.mEventType = kAudioUnitEvent_BeginParameterChangeGesture;
|
||||
event.mArgument.mParameter.mAudioUnit = unit->AU();
|
||||
event.mArgument.mParameter.mParameterID = descriptors[param_id].id;
|
||||
event.mArgument.mParameter.mScope = descriptors[param_id].scope;
|
||||
event.mArgument.mParameter.mElement = descriptors[param_id].element;
|
||||
|
||||
if (AUEventListenerAddEventType (_parameter_listener, _parameter_listener_arg, &event) != noErr) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
event.mEventType = kAudioUnitEvent_EndParameterChangeGesture;
|
||||
event.mArgument.mParameter.mAudioUnit = unit->AU();
|
||||
event.mArgument.mParameter.mParameterID = descriptors[param_id].id;
|
||||
event.mArgument.mParameter.mScope = descriptors[param_id].scope;
|
||||
event.mArgument.mParameter.mElement = descriptors[param_id].element;
|
||||
|
||||
if (AUEventListenerAddEventType (_parameter_listener, _parameter_listener_arg, &event) != noErr) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2775,6 +2795,26 @@ AUPlugin::end_listen_to_parameter (uint32_t param_id)
|
|||
return -1;
|
||||
}
|
||||
|
||||
event.mEventType = kAudioUnitEvent_BeginParameterChangeGesture;
|
||||
event.mArgument.mParameter.mAudioUnit = unit->AU();
|
||||
event.mArgument.mParameter.mParameterID = descriptors[param_id].id;
|
||||
event.mArgument.mParameter.mScope = descriptors[param_id].scope;
|
||||
event.mArgument.mParameter.mElement = descriptors[param_id].element;
|
||||
|
||||
if (AUEventListenerRemoveEventType (_parameter_listener, _parameter_listener_arg, &event) != noErr) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
event.mEventType = kAudioUnitEvent_EndParameterChangeGesture;
|
||||
event.mArgument.mParameter.mAudioUnit = unit->AU();
|
||||
event.mArgument.mParameter.mParameterID = descriptors[param_id].id;
|
||||
event.mArgument.mParameter.mScope = descriptors[param_id].scope;
|
||||
event.mArgument.mParameter.mElement = descriptors[param_id].element;
|
||||
|
||||
if (AUEventListenerRemoveEventType (_parameter_listener, _parameter_listener_arg, &event) != noErr) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2789,17 +2829,19 @@ AUPlugin::parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUn
|
|||
{
|
||||
ParameterMap::iterator i;
|
||||
|
||||
if ((i = parameter_map.find (event->mArgument.mParameter.mParameterID)) == parameter_map.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->mEventType) {
|
||||
case kAudioUnitEvent_BeginParameterChangeGesture:
|
||||
StartTouch (i->second);
|
||||
break;
|
||||
case kAudioUnitEvent_EndParameterChangeGesture:
|
||||
EndTouch (i->second);
|
||||
break;
|
||||
case kAudioUnitEvent_ParameterValueChange:
|
||||
i = parameter_map.find (event->mArgument.mParameter.mParameterID);
|
||||
|
||||
if (i != parameter_map.end()) {
|
||||
ParameterChanged (i->second, new_value);
|
||||
}
|
||||
ParameterChanged (i->second, new_value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1263,7 +1263,12 @@ PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
|
|||
plugin->set_insert_info (this);
|
||||
|
||||
if (_plugins.empty()) {
|
||||
/* first (and probably only) plugin instance - connect to relevant signals
|
||||
*/
|
||||
|
||||
plugin->ParameterChanged.connect_same_thread (*this, boost::bind (&PluginInsert::parameter_changed, this, _1, _2));
|
||||
plugin->StartTouch.connect_same_thread (*this, boost::bind (&PluginInsert::start_touch, this, _1));
|
||||
plugin->EndTouch.connect_same_thread (*this, boost::bind (&PluginInsert::end_touch, this, _1));
|
||||
}
|
||||
|
||||
_plugins.push_back (plugin);
|
||||
|
|
@ -1292,3 +1297,21 @@ PluginInsert::monitoring_changed ()
|
|||
(*i)->monitoring_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());
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue