triggerbox: fix behavior when bang()-ing a trigger while another is playing

This should queue up the bang-ed one and get the currently playing one to stop
This commit is contained in:
Paul Davis
2021-10-14 21:08:19 -06:00
parent 480907d613
commit 7b2559fe07
2 changed files with 21 additions and 0 deletions

View File

@@ -168,6 +168,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
virtual void startup ();
virtual void jump_start ();
virtual void jump_stop ();
virtual void start_stop ();
uint32_t follow_count() const { return _follow_count; }
void set_follow_count (uint32_t n);

View File

@@ -251,16 +251,32 @@ Trigger::jump_start()
wait for quantization.
*/
_state = Running;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 requested state %2\n", index(), enum_2_string (_state)));
PropertyChanged (ARDOUR::Properties::running);
}
void
Trigger::jump_stop()
{
/* this is used when we start a new trigger in legato mode. We do not
wait for quantization.
*/
_state = Stopped;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 requested state %2\n", index(), enum_2_string (_state)));
PropertyChanged (ARDOUR::Properties::running);
}
void
Trigger::start_stop()
{
/* this is used when we start a tell a currently playing trigger to
stop, but wait for quantization first.
*/
_state = WaitingToStop;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 requested state %2\n", index(), enum_2_string (_state)));
PropertyChanged (ARDOUR::Properties::running);
}
@@ -1374,6 +1390,10 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 => %2 switched to in legato mode\n", currently_playing->index(), nxt->index()));
currently_playing = nxt;
} else {
currently_playing->start_stop ();
queue_implicit (all_triggers[nxt->index()]);
DEBUG_TRACE (DEBUG::Triggers, string_compose ("start stop for %1 before switching to %2\n", currently_playing->index(), nxt->index()));
}
}
}