Add API to ignore PC per TriggerBox

This commit is contained in:
Robin Gareus 2022-02-09 02:28:56 +01:00
parent 43b98524b5
commit 5f84209c30
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 19 additions and 1 deletions

View File

@ -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> 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> _sidechain;

View File

@ -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> 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);