triggerbox: working (?) "stop all cues" cue marker

This commit is contained in:
Paul Davis 2022-02-11 13:36:58 -07:00
parent 17e5667216
commit 1777f9af0c
2 changed files with 37 additions and 13 deletions

View File

@ -260,6 +260,9 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
bool will_not_follow() const; bool will_not_follow() const;
bool will_follow() const { return !will_not_follow(); } bool will_follow() const { return !will_not_follow(); }
/* assumes that this is currently playing but does not enforce it */
bool cue_launched() const { return _cue_launched; }
virtual bool probably_oneshot () const = 0; virtual bool probably_oneshot () const = 0;
virtual timepos_t start_offset () const = 0; /* offset from start of data */ virtual timepos_t start_offset () const = 0; /* offset from start of data */
@ -358,11 +361,11 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
bool _explicitly_stopped; bool _explicitly_stopped;
gain_t _pending_velocity_gain; gain_t _pending_velocity_gain;
gain_t _velocity_gain; gain_t _velocity_gain;
bool _cue_launched;
void copy_ui_state (UIState&); void copy_ui_state (UIState&);
void copy_to_ui_state (); void copy_to_ui_state ();
bool cue_launched;
/* computed from data */ /* computed from data */

View File

@ -80,6 +80,11 @@ ARDOUR::cue_marker_name (int32_t index)
using std::string; using std::string;
if (index == INT32_MAX) {
/* this is a reasonable "stop" icon */
return string (X_("\u25a1"));
}
switch (index) { switch (index) {
case 0: return string (_("A")); case 0: return string (_("A"));
case 1: return string (_("B")); case 1: return string (_("B"));
@ -173,7 +178,7 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
, _explicitly_stopped (false) , _explicitly_stopped (false)
, _pending_velocity_gain (1.0) , _pending_velocity_gain (1.0)
, _velocity_gain (1.0) , _velocity_gain (1.0)
, cue_launched (false) , _cue_launched (false)
, _estimated_tempo (0.) , _estimated_tempo (0.)
, _segment_tempo (0.) , _segment_tempo (0.)
, _beatcnt (0.) , _beatcnt (0.)
@ -270,7 +275,7 @@ Trigger::send_property_change (PropertyChange pc)
if (_box.fast_forwarding()) { if (_box.fast_forwarding()) {
return; return;
} }
cerr << "spc "; pc.dump (cerr); cerr << endl;
PropertyChanged (pc); PropertyChanged (pc);
} }
@ -545,7 +550,7 @@ void
Trigger::shutdown (BufferSet& bufs, pframes_t dest_offset) Trigger::shutdown (BufferSet& bufs, pframes_t dest_offset)
{ {
_state = Stopped; _state = Stopped;
cue_launched = false; _cue_launched = false;
_pending_velocity_gain = _velocity_gain = 1.0; _pending_velocity_gain = _velocity_gain = 1.0;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 shuts down\n", name())); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 shuts down\n", name()));
send_property_change (ARDOUR::Properties::running); send_property_change (ARDOUR::Properties::running);
@ -645,8 +650,8 @@ Trigger::process_state_requests (BufferSet& bufs, pframes_t dest_offset)
case Stopped: case Stopped:
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 %2 stopped => %3\n", index(), enum_2_string (Stopped), enum_2_string (WaitingToStart))); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 %2 stopped => %3\n", index(), enum_2_string (Stopped), enum_2_string (WaitingToStart)));
_box.queue_explict (index()); _box.queue_explict (index());
cue_launched = (_box.active_scene() >= 0); _cue_launched = (_box.active_scene() >= 0);
std::cerr << index() << " aka " << name() << " launched via cue ? " << cue_launched << std::endl; std::cerr << index() << " aka " << name() << " launched via cue ? " << _cue_launched << std::endl;
break; break;
case WaitingToStart: case WaitingToStart:
@ -1113,7 +1118,7 @@ AudioTrigger::start_and_roll_to (samplepos_t start_pos, samplepos_t end_position
*/ */
startup (bufs, 0, _quantization); startup (bufs, 0, _quantization);
cue_launched = true; _cue_launched = true;
samplepos_t pos = start_pos; samplepos_t pos = start_pos;
Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use());
@ -1134,7 +1139,7 @@ AudioTrigger::start_and_roll_to (samplepos_t start_pos, samplepos_t end_position
if (_state == Stopped) { if (_state == Stopped) {
retrigger (); retrigger ();
_state = WaitingToStart; _state = WaitingToStart;
cue_launched = true; _cue_launched = true;
} }
pos += n; pos += n;
@ -1976,7 +1981,7 @@ MIDITrigger::start_and_roll_to (samplepos_t start_pos, samplepos_t end_position)
*/ */
startup (bufs, 0, _quantization); startup (bufs, 0, _quantization);
cue_launched = true; _cue_launched = true;
samplepos_t pos = start_pos; samplepos_t pos = start_pos;
Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use()); Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use());
@ -1997,7 +2002,7 @@ MIDITrigger::start_and_roll_to (samplepos_t start_pos, samplepos_t end_position)
if (_state == Stopped) { if (_state == Stopped) {
retrigger (); retrigger ();
_state = WaitingToStart; _state = WaitingToStart;
cue_launched = true; _cue_launched = true;
} }
pos += n; pos += n;
@ -2639,7 +2644,7 @@ TriggerBox::fast_forward (CueEvents const & cues, samplepos_t transport_position
CueEvents::const_iterator nxt_cue = c; ++nxt_cue; CueEvents::const_iterator nxt_cue = c; ++nxt_cue;
if (c->cue < 0) { if (c->cue == INT32_MAX) {
/* "stop all cues" marker encountered. This ends the /* "stop all cues" marker encountered. This ends the
duration of whatever slot might have been running duration of whatever slot might have been running
when we hit the cue. when we hit the cue.
@ -2730,6 +2735,10 @@ TriggerBox::fast_forward (CueEvents const & cues, samplepos_t transport_position
if (pos >= transport_position || !prev) { if (pos >= transport_position || !prev) {
/* nothing to do */ /* nothing to do */
_locate_armed = false;
if (tracker) {
tracker->reset ();
}
return; return;
} }
@ -3300,10 +3309,22 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
bool was_recorded; bool was_recorded;
int32_t cue_bang = _session.first_cue_within (start_sample, end_sample, was_recorded); int32_t cue_bang = _session.first_cue_within (start_sample, end_sample, was_recorded);
if (cue_bang >= 0) { if (!_cue_recording || !was_recorded) {
if (!_cue_recording || !was_recorded) {
if (cue_bang == INT32_MAX) {
/* reached a "stop all cue-launched cues from playing"
* marker.The stop is quantized, not immediate.
*/
if (_currently_playing && _currently_playing->cue_launched()) {
_currently_playing->unbang ();
}
} else if (cue_bang >= 0) {
_active_scene = cue_bang; _active_scene = cue_bang;
} }
} }
/* STEP SIX: if at this point there is an active cue, make it trigger /* STEP SIX: if at this point there is an active cue, make it trigger