13
0

triggerbox: telling a Toggle/Gate/Repeat launch mode slots to not use a follow action when stopped

This commit is contained in:
Paul Davis 2021-12-15 11:03:47 -07:00
parent abf0eecca3
commit 347a17cdb2
2 changed files with 11 additions and 5 deletions

View File

@ -206,7 +206,9 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
virtual void shutdown (); virtual void shutdown ();
virtual void jump_start (); virtual void jump_start ();
virtual void jump_stop (); virtual void jump_stop ();
virtual void begin_stop (); void begin_stop (bool explicit_stop = false);
bool explicitly_stopped() const { return _explicitly_stopped; }
uint32_t loop_count() const { return _loop_cnt; } uint32_t loop_count() const { return _loop_cnt; }
uint32_t follow_count() const { return _follow_count; } uint32_t follow_count() const { return _follow_count; }
@ -259,6 +261,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
void* _ui; void* _ui;
samplepos_t expected_end_sample; samplepos_t expected_end_sample;
PBD::Property<bool> _stretching; PBD::Property<bool> _stretching;
bool _explicitly_stopped;
void set_region_internal (boost::shared_ptr<Region>); void set_region_internal (boost::shared_ptr<Region>);
virtual void retrigger() = 0; virtual void retrigger() = 0;

View File

@ -82,6 +82,7 @@ Trigger::Trigger (uint64_t n, TriggerBox& b)
, _ui (0) , _ui (0)
, expected_end_sample (0) , expected_end_sample (0)
, _stretching (Properties::stretching, true) , _stretching (Properties::stretching, true)
, _explicitly_stopped (false)
{ {
add_property (_legato); add_property (_legato);
add_property (_use_follow); add_property (_use_follow);
@ -280,6 +281,7 @@ Trigger::startup()
_state = WaitingToStart; _state = WaitingToStart;
_gain = _pending_gain; _gain = _pending_gain;
_loop_cnt = 0; _loop_cnt = 0;
_explicitly_stopped = false;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 starts up\n", name())); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 starts up\n", name()));
PropertyChanged (ARDOUR::Properties::running); PropertyChanged (ARDOUR::Properties::running);
} }
@ -317,12 +319,13 @@ Trigger::jump_stop()
} }
void void
Trigger::begin_stop() Trigger::begin_stop (bool explicit_stop)
{ {
/* this is used when we start a tell a currently playing trigger to /* this is used when we start a tell a currently playing trigger to
stop, but wait for quantization first. stop, but wait for quantization first.
*/ */
_state = WaitingToStop; _state = WaitingToStop;
_explicitly_stopped = explicit_stop;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 requested state %2\n", index(), enum_2_string (_state))); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 requested state %2\n", index(), enum_2_string (_state)));
PropertyChanged (ARDOUR::Properties::running); PropertyChanged (ARDOUR::Properties::running);
} }
@ -371,7 +374,7 @@ Trigger::process_state_requests ()
case Toggle: case Toggle:
case Repeat: case Repeat:
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 %2 gate/toggle/repeat => %3\n", index(), enum_2_string (Running), enum_2_string (WaitingToStop))); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 %2 gate/toggle/repeat => %3\n", index(), enum_2_string (Running), enum_2_string (WaitingToStop)));
begin_stop (); begin_stop (true);
} }
break; break;
@ -395,7 +398,7 @@ Trigger::process_state_requests ()
if (_launch_style == Gate || _launch_style == Repeat) { if (_launch_style == Gate || _launch_style == Repeat) {
switch (_state) { switch (_state) {
case Running: case Running:
begin_stop (); begin_stop (true);
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 unbanged, now in WaitingToStop\n", index())); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 unbanged, now in WaitingToStop\n", index()));
break; break;
default: default:
@ -2126,7 +2129,7 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
*/ */
if (_currently_playing->state() == Trigger::Stopped) { if (_currently_playing->state() == Trigger::Stopped) {
if (!_stop_all) { if (!_stop_all && !_currently_playing->explicitly_stopped()) {
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 has stopped, need next...\n", _currently_playing->name())); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 has stopped, need next...\n", _currently_playing->name()));
int n = determine_next_trigger (_currently_playing->index()); int n = determine_next_trigger (_currently_playing->index());
if (n < 0) { if (n < 0) {