triggerbox: implement allow_patch_changes
This commit is contained in:
parent
f7d17c6aca
commit
0bfa7e1b30
|
@ -150,6 +150,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
|||
PBD::Property<float> _velocity_effect;
|
||||
PBD::Property<bool> _stretchable;
|
||||
PBD::Property<bool> _cue_isolated;
|
||||
PBD::Property<bool> _allow_patch_changes;
|
||||
PBD::Property<StretchMode> _stretch_mode;
|
||||
|
||||
/* Properties that are not CAS-updated at retrigger */
|
||||
|
@ -177,6 +178,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
|||
float velocity_effect = 0;
|
||||
bool stretchable = true;
|
||||
bool cue_isolated = false;
|
||||
bool allow_patch_changes = true;
|
||||
StretchMode stretch_mode = Trigger::Crisp;
|
||||
|
||||
Evoral::SMF::UsedChannels used_channels = Evoral::SMF::UsedChannels();
|
||||
|
@ -207,6 +209,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
|||
velocity_effect = other.velocity_effect;
|
||||
stretchable = other.stretchable;
|
||||
cue_isolated = other.cue_isolated;
|
||||
allow_patch_changes = other.allow_patch_changes;
|
||||
stretch_mode = other.stretch_mode;
|
||||
used_channels = other.used_channels;
|
||||
|
||||
|
@ -239,6 +242,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
|||
TRIGGERBOX_PROPERTY_DECL (velocity_effect, float);
|
||||
TRIGGERBOX_PROPERTY_DECL (stretchable, bool);
|
||||
TRIGGERBOX_PROPERTY_DECL (cue_isolated, bool);
|
||||
TRIGGERBOX_PROPERTY_DECL (allow_patch_changes, bool);
|
||||
TRIGGERBOX_PROPERTY_DECL (gain, gain_t);
|
||||
TRIGGERBOX_PROPERTY_DECL (stretch_mode, StretchMode);
|
||||
TRIGGERBOX_PROPERTY_DECL (color, color_t);
|
||||
TRIGGERBOX_PROPERTY_DECL_CONST_REF (name, std::string);
|
||||
|
@ -377,9 +382,6 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
|||
|
||||
Temporal::Meter meter() const { return _meter; }
|
||||
|
||||
gain_t gain() {return _gain;}
|
||||
void set_gain (gain_t g);
|
||||
|
||||
void set_velocity_gain (gain_t g) {_pending_velocity_gain=g;}
|
||||
|
||||
void set_pending (Trigger*);
|
||||
|
@ -757,9 +759,6 @@ 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);
|
||||
|
||||
|
@ -821,7 +820,6 @@ class LIBARDOUR_API TriggerBox : public Processor
|
|||
bool _stop_all;
|
||||
int32_t _active_scene;
|
||||
int32_t _active_slots;
|
||||
bool _ignore_patch_changes;
|
||||
bool _locate_armed;
|
||||
bool _cancel_locate_armed;
|
||||
bool _fast_fowarding;
|
||||
|
@ -923,6 +921,7 @@ namespace Properties {
|
|||
LIBARDOUR_API extern PBD::PropertyDescriptor<uint32_t> currently_playing;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> stretchable;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> cue_isolated;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> allow_patch_changes;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> patch_change; /* type not important */
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> channel_map; /* type not important */
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> used_channels; /* type not important */
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace ARDOUR {
|
|||
PBD::PropertyDescriptor<gain_t> gain;
|
||||
PBD::PropertyDescriptor<bool> stretchable;
|
||||
PBD::PropertyDescriptor<bool> cue_isolated;
|
||||
PBD::PropertyDescriptor<bool> allow_patch_changes;
|
||||
PBD::PropertyDescriptor<Trigger::StretchMode> stretch_mode;
|
||||
PBD::PropertyDescriptor<bool> tempo_meter; /* only to transmit updates, not storage */
|
||||
PBD::PropertyDescriptor<bool> patch_change; /* only to transmit updates, not storage */
|
||||
|
@ -167,6 +168,7 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
|
|||
, _velocity_effect (Properties::velocity_effect, 0.)
|
||||
, _stretchable (Properties::stretchable, true)
|
||||
, _cue_isolated (Properties::cue_isolated, false)
|
||||
, _allow_patch_changes (Properties::allow_patch_changes, true)
|
||||
, _stretch_mode (Properties::stretch_mode, Trigger::Crisp)
|
||||
, _name (Properties::name, "")
|
||||
, _color (Properties::color, 0xBEBEBEFF)
|
||||
|
@ -205,6 +207,7 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
|
|||
add_property (_gain);
|
||||
add_property (_velocity_effect);
|
||||
add_property (_stretchable);
|
||||
add_property (_allow_patch_changes);
|
||||
add_property (_cue_isolated);
|
||||
add_property (_color);
|
||||
add_property (_stretch_mode);
|
||||
|
@ -236,6 +239,7 @@ Trigger::get_ui_state (Trigger::UIState &state) const
|
|||
state.gain = _gain;
|
||||
state.velocity_effect = _velocity_effect;
|
||||
state.stretchable = _stretchable;
|
||||
state.allow_patch_changes = _allow_patch_changes;
|
||||
state.cue_isolated = _cue_isolated;
|
||||
state.stretch_mode = _stretch_mode;
|
||||
|
||||
|
@ -300,6 +304,7 @@ Trigger::update_properties ()
|
|||
_gain = ui_state.gain;
|
||||
_velocity_effect = ui_state.velocity_effect;
|
||||
_stretchable = ui_state.stretchable;
|
||||
_allow_patch_changes = ui_state.allow_patch_changes;
|
||||
_cue_isolated = ui_state.cue_isolated;
|
||||
_stretch_mode = ui_state.stretch_mode;
|
||||
_color = ui_state.color;
|
||||
|
@ -354,6 +359,7 @@ Trigger::copy_to_ui_state ()
|
|||
ui_state.velocity_effect = _velocity_effect;
|
||||
ui_state.stretchable = _stretchable;
|
||||
ui_state.cue_isolated = _cue_isolated;
|
||||
ui_state.allow_patch_changes = _allow_patch_changes;
|
||||
ui_state.stretch_mode = _stretch_mode;
|
||||
ui_state.name = _name;
|
||||
ui_state.color = _color;
|
||||
|
@ -441,6 +447,7 @@ Trigger::name () const \
|
|||
return val; \
|
||||
}
|
||||
|
||||
/* some params do not appear here ... gain, patch-changes, name, allow-patch-changes, etc ... because they don't need to be queued */
|
||||
TRIGGER_UI_SET (cue_isolated,bool)
|
||||
TRIGGER_UI_SET (stretchable, bool)
|
||||
TRIGGER_UI_SET (velocity_effect, float)
|
||||
|
@ -493,6 +500,34 @@ Trigger::set_ui (void* p)
|
|||
_ui = p;
|
||||
}
|
||||
|
||||
bool
|
||||
Trigger::allow_patch_changes () const
|
||||
{
|
||||
return _allow_patch_changes;
|
||||
}
|
||||
|
||||
void
|
||||
Trigger::set_allow_patch_changes (bool yn)
|
||||
{
|
||||
if (_box.data_type() != DataType::MIDI) {
|
||||
return;
|
||||
}
|
||||
if (_allow_patch_changes == yn) {
|
||||
return;
|
||||
}
|
||||
|
||||
_allow_patch_changes = yn;
|
||||
send_property_change (Properties::allow_patch_changes);
|
||||
_box.session().set_dirty();
|
||||
}
|
||||
|
||||
gain_t
|
||||
Trigger::gain () const
|
||||
{
|
||||
return _gain;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Trigger::set_gain (gain_t g)
|
||||
{
|
||||
|
@ -2235,7 +2270,7 @@ MIDITrigger::_startup (BufferSet& bufs, pframes_t dest_offset, Temporal::BBT_Off
|
|||
/* Possibly inject patch changes, if set */
|
||||
|
||||
for (int chn = 0; chn < 16; ++chn) {
|
||||
if (_used_channels.test(chn) && _patch_change[chn].is_set()) {
|
||||
if (_used_channels.test(chn) && allow_patch_changes() && _patch_change[chn].is_set()) {
|
||||
_patch_change[chn].set_time (dest_offset);
|
||||
DEBUG_TRACE (DEBUG::MidiTriggers, string_compose ("Injecting patch change c:%1 b:%2 p:%3\n", (uint32_t) _patch_change[chn].channel(), (uint32_t) _patch_change[chn].bank(), (uint32_t) _patch_change[chn].program()));
|
||||
for (int msg = 0; msg < _patch_change[chn].messages(); ++msg) {
|
||||
|
@ -2487,7 +2522,7 @@ MIDITrigger::estimate_midi_patches ()
|
|||
}
|
||||
|
||||
/* finally, store the used_channels so the UI can show patches only for those chans actually used */
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 estimate_midi_patches(), using channels %2\n", name(), smfs->used_channels().to_string().c_str()));
|
||||
DEBUG_TRACE (DEBUG::MidiTriggers, string_compose ("%1 estimate_midi_patches(), using channels %2\n", name(), smfs->used_channels().to_string().c_str()));
|
||||
set_used_channels(smfs->used_channels());
|
||||
}
|
||||
}
|
||||
|
@ -2627,7 +2662,7 @@ MIDITrigger::midi_run (BufferSet& bufs, samplepos_t start_sample, samplepos_t en
|
|||
}
|
||||
|
||||
if (ev.is_pgm_change() || (ev.is_cc() && ((ev.cc_number() == MIDI_CTL_LSB_BANK) || (ev.cc_number() == MIDI_CTL_MSB_BANK)))) {
|
||||
if (_box.ignore_patch_changes ()) {
|
||||
if (!allow_patch_changes ()) {
|
||||
/* do not send ANY patch or bank messages, just skip them */
|
||||
DEBUG_TRACE (DEBUG::MidiTriggers, string_compose ("Ignoring patch change on chn:%1\n", (uint32_t) _patch_change[chn].channel()));
|
||||
++iter;
|
||||
|
@ -2762,6 +2797,8 @@ Trigger::make_property_quarks ()
|
|||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretchable = %1\n", Properties::stretchable.property_id));
|
||||
Properties::cue_isolated.property_id = g_quark_from_static_string (X_("cue_isolated"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for cue_isolated = %1\n", Properties::cue_isolated.property_id));
|
||||
Properties::allow_patch_changes.property_id = g_quark_from_static_string (X_("allow_patch_changes"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for allow_patch_changes = %1\n", Properties::allow_patch_changes.property_id));
|
||||
Properties::stretch_mode.property_id = g_quark_from_static_string (X_("stretch_mode"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretch_mode = %1\n", Properties::stretch_mode.property_id));
|
||||
Properties::patch_change.property_id = g_quark_from_static_string (X_("patch_change"));
|
||||
|
@ -2801,7 +2838,6 @@ TriggerBox::TriggerBox (Session& s, DataType dt)
|
|||
, _stop_all (false)
|
||||
, _active_scene (-1)
|
||||
, _active_slots (0)
|
||||
, _ignore_patch_changes (false)
|
||||
, _locate_armed (false)
|
||||
, _cancel_locate_armed (false)
|
||||
, _fast_fowarding (false)
|
||||
|
@ -2838,17 +2874,6 @@ 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::parameter_changed (std::string const & param)
|
||||
{
|
||||
|
@ -4073,8 +4098,6 @@ 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")));
|
||||
|
||||
{
|
||||
|
@ -4100,7 +4123,6 @@ 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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user