summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2018-09-18 18:51:59 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2018-09-18 19:06:04 -0400
commite6915e01de2e2167c3384c6c8f2408f763971616 (patch)
treec67200eda4cf4c595503a850fe6ae72d89032a6f /libs/ardour/audioengine.cc
parent7390b88c2bb29b1b34624f441adec1e71c74bad8 (diff)
new transport slave/master implementation, libs/ edition
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 83919bbe6a..91f58d44ad 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -55,6 +55,7 @@
#include "ardour/process_thread.h"
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
+#include "ardour/transport_master_manager.h"
#include "pbd/i18n.h"
@@ -77,7 +78,7 @@ AudioEngine::AudioEngine ()
, _freewheeling (false)
, monitor_check_interval (INT32_MAX)
, last_monitor_check (0)
- , _processed_samples (0)
+ , _processed_samples (-1)
, m_meter_thread (0)
, _main_thread (0)
, _mtdm (0)
@@ -198,6 +199,11 @@ AudioEngine::process_callback (pframes_t nframes)
/// The number of samples that will have been processed when we've finished
pframes_t next_processed_samples;
+ if (_processed_samples < 0) {
+ _processed_samples = sample_time();
+ cerr << "IIIIINIT PS to " << _processed_samples << endl;
+ }
+
/* handle wrap around of total samples counter */
if (max_samplepos - _processed_samples < nframes) {
@@ -346,6 +352,14 @@ AudioEngine::process_callback (pframes_t nframes)
return 0;
}
+ TransportMasterManager& tmm (TransportMasterManager::instance());
+
+ /* make sure the TMM is up to date about the current session */
+
+ if (_session != tmm.session()) {
+ tmm.set_session (_session);
+ }
+
if (_session == 0) {
if (!_freewheeling) {
@@ -358,16 +372,9 @@ AudioEngine::process_callback (pframes_t nframes)
}
if (!_freewheeling || Freewheel.empty()) {
- // TODO: Run a list of slaves here
- // - multiple TC slaves (how_many_dsp_threads() in parallel)
- // (note this can be multiple slaves of each type. e.g.
- // 3 LTC slaves on different ports, 2 MTC..)
- // - GUI can display all slaves, user picks one.
- // - active "slave" is a session property.
- // - here we ask the session about the active slave
- // and get playback speed (for this cycle) here.
- // - Internal Transport is-a Slave too (!)
- Port::set_speed_ratio (_session->engine_speed ()); // HACK
+ const double engine_speed = tmm.pre_process_transport_masters (nframes, sample_time_at_cycle_start());
+ Port::set_speed_ratio (engine_speed);
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("transport master (current=%1) gives speed %2 (ports using %3)\n", tmm.current() ? tmm.current()->name() : string("[]"), engine_speed, Port::speed_ratio()));
}
/* tell all relevant objects that we're starting a new cycle */