summaryrefslogtreecommitdiff
path: root/libs/ardour/engine_slave.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/engine_slave.cc
parent7390b88c2bb29b1b34624f441adec1e71c74bad8 (diff)
new transport slave/master implementation, libs/ edition
Diffstat (limited to 'libs/ardour/engine_slave.cc')
-rw-r--r--libs/ardour/engine_slave.cc87
1 files changed, 72 insertions, 15 deletions
diff --git a/libs/ardour/engine_slave.cc b/libs/ardour/engine_slave.cc
index 7ac767c3e8..1031370557 100644
--- a/libs/ardour/engine_slave.cc
+++ b/libs/ardour/engine_slave.cc
@@ -20,47 +20,104 @@
#include <iostream>
#include <cerrno>
+#include "pbd/i18n.h"
+
#include "ardour/audioengine.h"
#include "ardour/audio_backend.h"
-#include "ardour/slave.h"
+#include "ardour/session.h"
+#include "ardour/transport_master.h"
using namespace std;
using namespace ARDOUR;
-Engine_Slave::Engine_Slave (AudioEngine& e)
- : engine (e)
+Engine_TransportMaster::Engine_TransportMaster (AudioEngine& e)
+ : TransportMaster (Engine, X_("JACK"))
+ , engine (e)
+ , _starting (false)
+{
+ check_backend ();
+}
+
+Engine_TransportMaster::~Engine_TransportMaster ()
{
- double x;
- samplepos_t p;
- /* call this to initialize things */
- speed_and_position (x, p);
}
-Engine_Slave::~Engine_Slave ()
+void
+Engine_TransportMaster::init ()
{
}
+void
+Engine_TransportMaster::check_backend()
+{
+ if (AudioEngine::instance()->current_backend_name() == X_("JACK")) {
+ _connected = true;
+ } else {
+ _connected = false;
+ }
+}
+
bool
-Engine_Slave::locked() const
+Engine_TransportMaster::locked() const
{
return true;
}
bool
-Engine_Slave::ok() const
+Engine_TransportMaster::ok() const
{
return true;
}
+void
+Engine_TransportMaster::pre_process (pframes_t, samplepos_t, boost::optional<samplepos_t>)
+{
+ /* nothing to do */
+}
+
bool
-Engine_Slave::speed_and_position (double& sp, samplepos_t& position)
+Engine_TransportMaster::speed_and_position (double& sp, samplepos_t& position, samplepos_t /* now */)
{
boost::shared_ptr<AudioBackend> backend = engine.current_backend();
- if (backend) {
- _starting = backend->speed_and_position (sp, position);
- } else {
- _starting = false;
+ /* 3rd argument (now) doesn't matter here because we're always being
+ * called synchronously with the engine.
+ */
+
+ if (backend && backend->speed_and_position (sp, position)) {
+ return true;
+ }
+
+ _current_delta = 0;
+
+ return false;
+}
+
+std::string
+Engine_TransportMaster::position_string () const
+{
+ if (_session) {
+ return to_string (_session->audible_sample());
+ }
+
+ return std::string();
+}
+
+std::string
+Engine_TransportMaster::delta_string () const
+{
+ return string ("0");
+}
+
+bool
+Engine_TransportMaster::allow_request (TransportRequestSource src, TransportRequestType type) const
+{
+ if (_session) {
+ if (_session->config.get_jack_time_master()) {
+ return true;
+ } else {
+ return false;
+ }
}
return true;