13
0

triggerbox: scene-isolate property for triggers (libardour part)

This commit is contained in:
Ben Loftis 2021-12-17 12:39:38 -06:00
parent 9aa6e4c89e
commit dd7f474125
2 changed files with 30 additions and 11 deletions

View File

@ -104,6 +104,12 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
void set_name (std::string const &);
std::string name() const { return _name; }
void set_stretchable (bool yn);
bool stretchable () const { return _stretchable; }
void set_scene_isolated (bool isolate);
bool scene_isolated () const { return _isolated; }
/* Calling ::bang() will cause this Trigger to be placed in its owning
TriggerBox's queue.
*/
@ -262,6 +268,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
void* _ui;
samplepos_t expected_end_sample;
PBD::Property<bool> _stretchable;
PBD::Property<bool> _isolated;
bool _explicitly_stopped;
void set_region_internal (boost::shared_ptr<Region>);
@ -302,9 +309,6 @@ class LIBARDOUR_API AudioTrigger : public Trigger {
SegmentDescriptor get_segment_descriptor () const;
void set_expected_end_sample (Temporal::TempoMap::SharedPtr const &, Temporal::BBT_Time const &);
void set_stretchable (bool yn);
bool stretchable () const { return _stretchable; }
bool stretching () const;
protected:
@ -619,6 +623,7 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<gain_t> gain;
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger*> currently_playing;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> stretchable;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> isolated;
}

View File

@ -58,6 +58,7 @@ namespace ARDOUR {
PBD::PropertyDescriptor<float> velocity_effect;
PBD::PropertyDescriptor<gain_t> gain;
PBD::PropertyDescriptor<bool> stretchable;
PBD::PropertyDescriptor<bool> isolated;
}
}
@ -83,6 +84,7 @@ Trigger::Trigger (uint64_t n, TriggerBox& b)
, _ui (0)
, expected_end_sample (0)
, _stretchable (Properties::stretchable, true)
, _isolated (Properties::isolated, false)
, _explicitly_stopped (false)
{
add_property (_legato);
@ -91,6 +93,7 @@ Trigger::Trigger (uint64_t n, TriggerBox& b)
add_property (_midi_velocity_effect);
add_property (_follow_action_probability);
add_property (_stretchable);
add_property (_isolated);
}
void
@ -106,6 +109,20 @@ Trigger::set_name (std::string const & str)
_name = str;
}
void
Trigger::set_scene_isolated (bool i)
{
_isolated = i;
PropertyChanged (ARDOUR::Properties::isolated);
}
void
Trigger::set_stretchable (bool s)
{
_stretchable = s;
PropertyChanged (ARDOUR::Properties::stretchable);
}
void
Trigger::set_ui (void* p)
{
@ -649,13 +666,6 @@ AudioTrigger::set_state (const XMLNode& node, int version)
return 0;
}
void
AudioTrigger::set_stretchable (bool s)
{
_stretchable = s;
PropertyChanged (ARDOUR::Properties::stretchable);
}
void
AudioTrigger::set_start (timepos_t const & s)
{
@ -1601,6 +1611,8 @@ Trigger::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for follow-action-1 = %1\n", Properties::follow_action1.property_id));
Properties::stretchable.property_id = g_quark_from_static_string (X_("stretchable"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretchable = %1\n", Properties::stretchable.property_id));
Properties::isolated.property_id = g_quark_from_static_string (X_("isolated"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for isolated = %1\n", Properties::isolated.property_id));
}
const int32_t TriggerBox::default_triggers_per_box = 8;
@ -2063,7 +2075,9 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
if (_active_scene >= 0) {
DEBUG_TRACE (DEBUG::Triggers, string_compose ("tb noticed active scene %1\n", _active_scene));
if (_active_scene < (int32_t) all_triggers.size()) {
all_triggers[_active_scene]->bang ();
if (!all_triggers[_active_scene]->scene_isolated()) {
all_triggers[_active_scene]->bang ();
}
}
}