add new API to TransportMasterManager to manage use of DiskReader::{inc,dec}_no_disk_output()

This commit is contained in:
Paul Davis 2020-03-13 13:49:44 -06:00
parent cc43ec3ef6
commit f5ec5ea929
5 changed files with 37 additions and 20 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 ();
}

View File

@ -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

View File

@ -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);
}