From 90a0f0af89a4c986fd1eb2b5487f4dd8b4a6eeec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 1 Jul 2021 03:12:27 +0200 Subject: [PATCH] CUE monitor during record w/preroll --- libs/ardour/ardour/session_event.h | 1 + libs/ardour/route.cc | 6 +++++- libs/ardour/session_process.cc | 4 ++++ libs/ardour/session_transport.cc | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index ac54c97bc1..4731128dad 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -65,6 +65,7 @@ public: SetTransportMaster, StartRoll, EndRoll, + TransportStateChange, /* only one of each of these events can be queued at any one time */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index ec672d9c9b..1f20cae585 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -6284,6 +6284,11 @@ Route::monitoring_state () const return MonitoringDisk | get_input_monitoring_state (false, false); } else { /* recording */ + const samplecnt_t prtl = _session.preroll_record_trim_len (); + if (session_rec && roll && prtl > 0 && _disk_writer->get_captured_samples () < prtl) { + /* CUE monitor during pre-roll */ + return MonitoringDisk | get_input_monitoring_state (true, false); + } return get_input_monitoring_state (true, false); } @@ -6306,4 +6311,3 @@ Route::monitoring_state () const abort(); /* NOTREACHED */ return MonitoringSilence; } - diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index afd2fc84ff..894a86d294 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -979,6 +979,10 @@ Session::process_event (SessionEvent* ev) overwrite_some_buffers (boost::shared_ptr(), ev->overwrite); break; + case SessionEvent::TransportStateChange: + TransportStateChange (); /* EMIT SIGNAL */ + break; + case SessionEvent::Audition: set_audition (ev->region); // drop reference to region diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 83df2f6cae..e6f3f5d9bd 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -893,6 +893,12 @@ Session::request_preroll_record_trim (samplepos_t rec_in, samplecnt_t preroll) maybe_enable_record (); request_locate (pos, MustRoll); set_requested_return_sample (rec_in); + + if (pos < rec_in) { + /* Notify GUI to update monitor state display */ + SessionEvent* ev = new SessionEvent (SessionEvent::TransportStateChange, SessionEvent::Add, rec_in, rec_in, 1.0); + queue_event (ev); + } } void