Add roll-will-loop option (as alternative to loop-is-mode)

This is mainly for the benefit of Mixbus (this option is not [yet]
available for Ardour, except for power users manually editing
the config).

This option is ostensibly exclusive with loop-is-mode, but an
enum seems not appropriate at this point in time.
This commit is contained in:
Robin Gareus
2025-07-17 21:42:39 +02:00
parent 45652353c5
commit 74d7bf407a
4 changed files with 23 additions and 2 deletions

View File

@@ -171,6 +171,7 @@ CONFIG_VARIABLE (bool, create_xrun_marker, "create-xrun-marker", false)
CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", false)
CONFIG_VARIABLE (float, preroll_seconds, "preroll-seconds", -2.0f)
CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", false)
CONFIG_VARIABLE (bool, roll_will_loop, "roll-will-loop", false)
CONFIG_VARIABLE (LoopFadeChoice, loop_fade_choice, "loop-fade-choice", XFadeLoop)
CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle
CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle

View File

@@ -1559,7 +1559,7 @@ private:
* know when to send full MTC messages every so often.
*/
pframes_t _pframes_since_last_mtc;
bool play_loop;
std::atomic<bool> play_loop;
bool loop_changing;
samplepos_t last_loopend;
@@ -2200,6 +2200,8 @@ private:
mutable bool have_looped; ///< Used in \ref audible_sample
bool roll_started_loop;
void update_route_record_state ();
std::atomic<int> _have_rec_enabled_track;
std::atomic<int> _have_rec_disabled_track;

View File

@@ -338,6 +338,7 @@ Session::Session (AudioEngine &eng,
, first_file_data_format_reset (true)
, first_file_header_format_reset (true)
, have_looped (false)
, roll_started_loop (false)
, _step_editors (0)
, _speakers (new Speakers)
, _ignore_route_processor_changes (0)

View File

@@ -153,6 +153,10 @@ Session::realtime_stop (bool abort, bool clear_state)
waiting_for_sync_offset = true;
}
if (todo & PostTransportClearSubstate) {
roll_started_loop = false;
}
if (todo) {
TFSM_EVENT (TransportFSM::ButlerRequired);
}
@@ -475,6 +479,17 @@ Session::start_transport (bool after_loop)
ENSURE_PROCESS_THREAD;
DEBUG_TRACE (DEBUG::Transport, "start_transport\n");
if (!after_loop && !roll_started_loop && !_exporting
&& Config->get_roll_will_loop ()
&& !get_play_loop ()
&& !transport_master_is_external ()
&& _locations->auto_loop_location ()) {
roll_started_loop = true;
SessionEvent* ev = new SessionEvent (SessionEvent::SetLoop, SessionEvent::Add, SessionEvent::Immediate, 0, _transport_fsm->default_speed(), true, true);
queue_event (ev);
return;
}
if (Config->get_loop_is_mode() && get_play_loop ()) {
Location *location = _locations->auto_loop_location();
@@ -1541,7 +1556,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished, bool will_
if (ptw & (PostTransportClearSubstate|PostTransportStop)) {
if (!Config->get_loop_is_mode() && get_play_loop() && !loop_changing) {
unset_play_loop ();
if (!Config->get_roll_will_loop () || (ptw & PostTransportClearSubstate)) {
unset_play_loop ();
}
}
}