summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-03-13 13:49:44 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-03-13 13:52:38 -0600
commitf5ec5ea9296df29e99369c85c204ac4cfe4a6e25 (patch)
treee5238ce040bed094de0869b1f3d3cf0354dae3ef /libs/ardour
parentcc43ec3ef6ad782eab6dd71c285e2c4da70e990b (diff)
add new API to TransportMasterManager to manage use of DiskReader::{inc,dec}_no_disk_output()
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/ardour/transport_master_manager.h5
-rw-r--r--libs/ardour/session_process.cc12
-rw-r--r--libs/ardour/session_transport.cc6
-rw-r--r--libs/ardour/transport_master_manager.cc33
5 files changed, 37 insertions, 20 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index cacdbbb121..dad45a4480 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1370,7 +1370,6 @@ private:
bool follow_transport_master (pframes_t nframes);
void sync_source_changed (SyncSource, samplepos_t pos, pframes_t cycle_nframes);
- void reset_slave_state ();
bool post_export_sync;
samplepos_t post_export_position;
diff --git a/libs/ardour/ardour/transport_master_manager.h b/libs/ardour/ardour/transport_master_manager.h
index e0926f74ec..0aaf1bf00c 100644
--- a/libs/ardour/ardour/transport_master_manager.h
+++ b/libs/ardour/ardour/transport_master_manager.h
@@ -85,6 +85,10 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable
void reconnect_ports ();
+ void block_disk_output ();
+ void unblock_disk_output ();
+ void reinit (double speed, samplepos_t pos);
+
private:
TransportMasterManager();
@@ -96,6 +100,7 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable
Session* _session;
bool _master_invalid_this_cycle;
+ bool disk_output_blocked;
// a DLL to chase the transport master
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 720f1a7129..ffe2560478 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -1170,8 +1170,6 @@ Session::follow_transport_master (pframes_t nframes)
if (!actively_recording() && abs (delta) > (5 * current_block_size)) {
- DiskReader::inc_no_disk_output ();
-
if (!locate_pending() && !declick_in_progress()) {
DEBUG_TRACE (DEBUG::Slave, string_compose ("request locate to master position %1\n", master_transport_sample));
/* note that for non-JACK transport masters, we assume that the transport state (rolling,stopped) after the locate
@@ -1205,12 +1203,12 @@ Session::follow_transport_master (pframes_t nframes)
if ((tmm.current()->type() != Engine) && !actively_recording() && abs (delta) > tmm.current()->resolution()) {
/* just varispeed to chase the master, and be silent till we're synced */
- DiskReader::inc_no_disk_output ();
+ tmm.block_disk_output ();
return true;
}
/* speed is set, we're locked, and good to go */
- DiskReader::dec_no_disk_output ();
+ tmm.unblock_disk_output ();
return true;
noroll:
@@ -1219,9 +1217,3 @@ Session::follow_transport_master (pframes_t nframes)
no_roll (nframes);
return false;
}
-
-void
-Session::reset_slave_state ()
-{
- DiskReader::dec_no_disk_output ();
-}
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index bafde46674..31392b9c89 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -145,8 +145,6 @@ Session::realtime_stop (bool abort, bool clear_state)
unset_play_loop ();
}
- reset_slave_state ();
-
reset_punch_loop_constraint ();
_transport_speed = 0;
@@ -731,8 +729,6 @@ Session::butler_completed_transport_work ()
TFSM_EVENT (TransportFSM::ButlerDone);
}
- DiskReader::dec_no_disk_output ();
-
if (start_after_butler_done_msg) {
if (_transport_speed) {
/* reversal is done ... tell TFSM that it is time to start*/
@@ -1942,7 +1938,7 @@ Session::sync_source_changed (SyncSource type, samplepos_t pos, pframes_t cycle_
longer valid with a new slave.
*/
- DiskReader::dec_no_disk_output ();
+ TransportMasterManager::instance().unblock_disk_output ();
#if 0
we should not be treating specific transport masters as special cases because there maybe > 1 of a particular type
diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc
index eb39fc2507..4911b981bb 100644
--- a/libs/ardour/transport_master_manager.cc
+++ b/libs/ardour/transport_master_manager.cc
@@ -40,6 +40,7 @@ TransportMasterManager::TransportMasterManager()
, _master_position (0)
, _session (0)
, _master_invalid_this_cycle (false)
+ , disk_output_blocked (false)
, master_dll_initstate (0)
{
}
@@ -124,7 +125,7 @@ TransportMasterManager::parameter_changed (std::string const & what)
if (what == "external-sync") {
if (!_session->config.get_external_sync()) {
/* disabled */
- DiskReader::dec_no_disk_output ();
+ unblock_disk_output ();
}
}
}
@@ -255,12 +256,12 @@ TransportMasterManager::pre_process_transport_masters (pframes_t nframes, sample
if (!_session->actively_recording()) {
DEBUG_TRACE (DEBUG::Slave, string_compose ("slave delta %1 greater than slave resolution %2 => no disk output\n", delta, _current_master->resolution()));
/* run routes as normal, but no disk output */
- DiskReader::inc_no_disk_output ();
+ block_disk_output ();
} else {
- DiskReader::dec_no_disk_output ();
+ unblock_disk_output ();
}
} else {
- DiskReader::dec_no_disk_output ();
+ unblock_disk_output ();
}
/* inject DLL with new data */
@@ -665,3 +666,27 @@ TransportMasterManager::reconnect_ports ()
}
}
}
+
+void
+TransportMasterManager::block_disk_output ()
+{
+ if (!disk_output_blocked) {
+ //DiskReader::inc_no_disk_output ();
+ disk_output_blocked = true;
+ }
+}
+
+void
+TransportMasterManager::unblock_disk_output ()
+{
+ if (disk_output_blocked) {
+ //DiskReader::dec_no_disk_output ();
+ disk_output_blocked = false;
+ }
+}
+
+void
+TransportMasterManager::reinit (double speed, samplepos_t pos)
+{
+ init_transport_master_dll (speed, pos);
+}