triggerbox: add flush-at-transport-stop from recorded cues to locations

This commit is contained in:
Paul Davis 2022-01-21 10:24:03 -07:00
parent 8d1684e1f7
commit d830800ed9
2 changed files with 25 additions and 0 deletions

View File

@ -1876,6 +1876,7 @@ private:
void set_track_loop (bool);
bool select_playhead_priority_target (samplepos_t&);
void follow_playhead_priority ();
void flush_cue_recording ();
/* These are synchronous and so can only be called from within the process
* cycle

View File

@ -1476,6 +1476,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
clear_clicks();
unset_preroll_record_trim ();
flush_cue_recording ();
/* do this before seeking, because otherwise the tracks will do the wrong thing in seamless loop mode.
*/
@ -2079,3 +2080,26 @@ Session::actual_speed() const
if (_transport_fsm->transport_speed() < 0) return - _engine_speed;
return 0;
}
void
Session::flush_cue_recording ()
{
CueRecord cr;
TempoMap::SharedPtr tmap (TempoMap::use());
while (TriggerBox::cue_records.read (&cr, 1) == 1) {
BBT_Time bbt = tmap->bbt_at (timepos_t (cr.when));
bbt = bbt.round_up_to_bar ();
timepos_t when;
if (tmap->time_domain() == Temporal::AudioTime) {
when = timepos_t (tmap->sample_at (bbt));
} else {
when = timepos_t (tmap->quarters_at (bbt));
}
Location* l = new Location (*this, when, when, std::string(), Location::Flags (Location::IsMark|Location::IsCueMarker), cr.cue_number);
_locations->add (l);
}
}