From 5f84209c3079aff15e142cf7fb45c599e4cc3e34 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 9 Feb 2022 02:28:56 +0100 Subject: [PATCH] Add API to ignore PC per TriggerBox --- libs/ardour/ardour/triggerbox.h | 4 ++++ libs/ardour/triggerbox.cc | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 4efea5153c..111acfd1ee 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -659,6 +659,9 @@ class LIBARDOUR_API TriggerBox : public Processor void add_midi_sidechain (); void update_sidechain_name (); + void set_ignore_patch_changes (bool); + bool ignore_patch_changes () const { return _ignore_patch_changes; } + void request_reload (int32_t slot, void*); void set_region (uint32_t slot, boost::shared_ptr region); @@ -716,6 +719,7 @@ class LIBARDOUR_API TriggerBox : public Processor bool _stop_all; int32_t _active_scene; int32_t _active_slots; + bool _ignore_patch_changes; boost::shared_ptr _sidechain; diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index bc60e064da..08b0a96db1 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -2205,7 +2205,7 @@ MIDITrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sam } if (ev.is_pgm_change() || (ev.is_cc() && ((ev.cc_number() == MIDI_CTL_LSB_BANK) || (ev.cc_number() == MIDI_CTL_MSB_BANK)))) { - if (_patch_change[ev.channel()].is_set()) { + if (_patch_change[ev.channel()].is_set() || _box.ignore_patch_changes ()) { /* skip pgm change info in data because trigger has its own */ ++iter; continue; @@ -2361,6 +2361,7 @@ TriggerBox::TriggerBox (Session& s, DataType dt) , _stop_all (false) , _active_scene (-1) , _active_slots (0) + , _ignore_patch_changes (false) , requests (1024) { set_display_to_user (false); @@ -2393,6 +2394,17 @@ TriggerBox::set_cue_recording (bool yn) } } +void +TriggerBox::set_ignore_patch_changes (bool yn) +{ + if (_data_type != DataType::MIDI) { + return; + } + if (yn != _ignore_patch_changes) { + _ignore_patch_changes = yn; + } +} + void TriggerBox::set_region (uint32_t slot, boost::shared_ptr region) { @@ -3358,6 +3370,7 @@ TriggerBox::get_state (void) node.set_property (X_("type"), X_("triggerbox")); node.set_property (X_("data-type"), _data_type.to_string()); node.set_property (X_("order"), _order); + node.set_property (X_("ignore_patch_changes"), _ignore_patch_changes); XMLNode* trigger_child (new XMLNode (X_("Triggers"))); @@ -3384,6 +3397,7 @@ TriggerBox::set_state (const XMLNode& node, int version) node.get_property (X_("data-type"), _data_type); node.get_property (X_("order"), _order); + node.get_property (X_("ignore_patch_changes"), _ignore_patch_changes); XMLNode* tnode (node.child (X_("Triggers"))); assert (tnode);