switch from JACK_Slave to Engine_Slave
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 19 Sep 2013 21:34:23 +0000 (17:34 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 19 Sep 2013 21:34:23 +0000 (17:34 -0400)
19 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/session_option_editor.cc
gtk2_ardour/video_monitor.cc
libs/ardour/ardour/rc_configuration_vars.h
libs/ardour/ardour/session.h
libs/ardour/ardour/slave.h
libs/ardour/ardour/types.h
libs/ardour/engine_slave.cc [new file with mode: 0644]
libs/ardour/enums.cc
libs/ardour/globals.cc
libs/ardour/jack_slave.cc [deleted file]
libs/ardour/session.cc
libs/ardour/session_time.cc
libs/ardour/session_transport.cc
libs/ardour/utils.cc
libs/ardour/wscript

index f22b48bd3a8842bbc10a8c98540dd0954c310aac..f599442bc46d5c26ed9e33486020eaa11e29e246 100644 (file)
@@ -1809,7 +1809,7 @@ ARDOUR_UI::transport_roll ()
 #if 0
        if (_session->config.get_external_sync()) {
                switch (Config->get_sync_source()) {
-               case JACK:
+               case Engine:
                        break;
                default:
                        /* transport controlled by the master */
@@ -1859,7 +1859,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
 
        if (_session->config.get_external_sync()) {
                switch (Config->get_sync_source()) {
-               case JACK:
+               case Engine:
                        break;
                default:
                        /* transport controlled by the master */
index 6b2c9da6fa88e25e162f50e5048e0896a9a3570c..618169d2e8578af170fc51a09daa32815188127a 100644 (file)
@@ -60,7 +60,7 @@ ARDOUR_UI::toggle_external_sync()
 {
        if (_session) {
                if (_session->config.get_video_pullup() != 0.0f) {
-                       if (Config->get_sync_source() == JACK) {
+                       if (Config->get_sync_source() == Engine) {
                                MessageDialog msg (
                                        _("It is not possible to use JACK as the the sync source\n\
 when the pull up/down setting is non-zero."));
@@ -465,7 +465,7 @@ ARDOUR_UI::synchronize_sync_source_and_video_pullup ()
                act->set_sensitive (true);
        } else {
                /* can't sync to JACK if video pullup != 0.0 */
-               if (Config->get_sync_source() == JACK) {
+               if (Config->get_sync_source() == Engine) {
                        act->set_sensitive (false);
                } else {
                        act->set_sensitive (true);
index c658160e146df3c1c5d1c91681ae84844f8e310a..6680e95b1514cfce5113e0c1ac705064137b2066 100644 (file)
@@ -996,7 +996,7 @@ AudioClock::set_slave_info ()
                Slave* slave = _session->slave();
 
                switch (sync_src) {
-               case JACK:
+               case Engine:
                        _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
                        _right_layout->set_text ("");
index 93a53dd1d355ec73f66a87592adacf9fd240b782..6ada12220a7ba859cae4f9a13935af16f5bf9287 100644 (file)
@@ -2108,7 +2108,7 @@ Editor::transition_to_rolling (bool fwd)
 
        if (_session->config.get_external_sync()) {
                switch (Config->get_sync_source()) {
-               case JACK:
+               case Engine:
                        break;
                default:
                        /* transport controlled by the master */
index 1815db10567e21f60c288ae81011e5fe0f59c1e1..60f575fb1615b0d41cb862678c70dafdd078130a 100644 (file)
@@ -334,7 +334,7 @@ SessionOptionEditor::parameter_changed (std::string const & p)
 {
        OptionEditor::parameter_changed (p);
        if (p == "external-sync") {
-               if (Config->get_sync_source() == JACK) {
+               if (Config->get_sync_source() == Engine) {
                        _vpu->set_sensitive(!_session_config->get_external_sync());
                } else {
                        _vpu->set_sensitive(true);
index 2c265365faa9d786f6ad7e8bf8e938e18ba767ea..b1e3c87d2292afdc78adb090062fd5314771560a 100644 (file)
@@ -554,7 +554,7 @@ VideoMonitor::xjadeo_sync_setup ()
 
        bool my_manual_seek = true;
        if (_session->config.get_external_sync()) {
-               if (ARDOUR::Config->get_sync_source() == ARDOUR::JACK)
+               if (ARDOUR::Config->get_sync_source() == ARDOUR::Engine)
                        my_manual_seek = false;
        }
 
index e05efbd51045156b8f62f73d1040bd2e22d41753..3c11304fdb065597ed3b68cc4470febd5427dc4d 100644 (file)
@@ -51,7 +51,7 @@ CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc-qf-speed-tolerance", 5)
 CONFIG_VARIABLE (bool, timecode_sync_frame_rate, "timecode-sync-frame-rate", true)
 CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
 CONFIG_VARIABLE (bool, timecode_source_2997, "timecode-source-2997", false)
-CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", JACK)
+CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", Engine)
 CONFIG_VARIABLE (std::string, ltc_source_port, "ltc-source-port", "system:capture_1")
 CONFIG_VARIABLE (bool, send_ltc, "send-ltc", false)
 CONFIG_VARIABLE (bool, ltc_send_continuously, "ltc-send-continuously", true)
index 7337e2d1ea5039e39f0a086cee77eb5f4fab1d10..ae5339796c06b4624118c993719938a322396a01 100644 (file)
@@ -509,7 +509,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        static PBD::Signal1<void, framepos_t> EndTimeChanged;
 
        void   request_sync_source (Slave*);
-       bool   synced_to_jack() const { return config.get_external_sync() && Config->get_sync_source() == JACK; }
+       bool   synced_to_engine() const { return config.get_external_sync() && Config->get_sync_source() == Engine; }
 
        double transport_speed() const { return _transport_speed; }
        bool   transport_stopped() const { return _transport_speed == 0.0f; }
index c60acb1df7ebcb03181fe187c2a56a5ff364e83a..a0b7b878e49f405f312a34771d0c0cd7dbdc2381 100644 (file)
@@ -486,11 +486,11 @@ class MIDIClock_Slave : public Slave {
        bool _starting;
 };
 
-class JACK_Slave : public Slave
+class Engine_Slave : public Slave
 {
   public:
-       JACK_Slave (AudioEngine&);
-       ~JACK_Slave ();
+       Engine_Slave (AudioEngine&);
+       ~Engine_Slave ();
 
        bool speed_and_position (double& speed, framepos_t& pos);
 
index f2319d7669ca1271f8aa88da935fca0e33298deb..658c64788ec9eca3db8358b55bcf3aaea8e8672c 100644 (file)
@@ -489,7 +489,7 @@ namespace ARDOUR {
        };
 
        enum SyncSource {
-               JACK,
+               Engine,
                MTC,
                MIDIClock,
                LTC
diff --git a/libs/ardour/engine_slave.cc b/libs/ardour/engine_slave.cc
new file mode 100644 (file)
index 0000000..eb55c9b
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+    Copyright (C) 2004 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iostream>
+#include <cerrno>
+
+#include "ardour/audioengine.h"
+#include "ardour/slave.h"
+
+using namespace std;
+using namespace ARDOUR;
+
+Engine_Slave::Engine_Slave (AudioEngine& e)
+       : engine (e)
+{
+       double x;
+       framepos_t p;
+       /* call this to initialize things */
+       speed_and_position (x, p);
+}
+
+Engine_Slave::~Engine_Slave ()
+{
+}
+
+bool
+Engine_Slave::locked() const
+{
+       return true;
+}
+
+bool
+Engine_Slave::ok() const
+{
+       return true;
+}
+
+bool
+Engine_Slave::speed_and_position (double& sp, framepos_t& position)
+{
+       switch (engine.transport_state()) {
+       case TransportStopped:
+               speed = 0;
+               _starting = false;
+               break;
+       case TransportRolling:
+               speed = 1.0;
+               _starting = false;
+               break;
+       case TransportLooping:
+               speed = 1.0;
+               _starting = false;
+               break;
+       case TransportStarting:
+               _starting = true;
+               // don't adjust speed here, just leave it as it was
+               break;
+       }
+
+       sp = speed;
+       position = engine.transport_frame();
+       return true;
+}
index bab0e8ed15c5daad3abdc01cc5d4649612f2276e..8fec499c35f30b6ce73d7b77d8699183aff7bb74 100644 (file)
@@ -335,7 +335,7 @@ setup_enum_writer ()
        REGISTER (_PluginType);
 
        REGISTER_ENUM (MTC);
-       REGISTER_ENUM (JACK);
+       REGISTER_ENUM (Engine);
        REGISTER_ENUM (MIDIClock);
        REGISTER_ENUM (LTC);
        REGISTER (_SyncSource);
index aac7709f90da8c7c1dd610f552870d9e1ddc6c0a..459f6f0e518c179a2003808ba380e4a866d34165 100644 (file)
@@ -530,7 +530,11 @@ ARDOUR::get_available_sync_options ()
 {
        vector<SyncSource> ret;
 
-       ret.push_back (JACK);
+       boost::shared_ptr<AudioBackend> backend = AudioEngine::instance()->current_backend();
+       if (backend && backend->name() == "JACK") {
+               ret.push_back (Engine);
+       }
+
        ret.push_back (MTC);
        ret.push_back (MIDIClock);
        ret.push_back (LTC);
diff --git a/libs/ardour/jack_slave.cc b/libs/ardour/jack_slave.cc
deleted file mode 100644 (file)
index 4b2f3b1..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-    Copyright (C) 2004 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <cerrno>
-
-#include "ardour/audioengine.h"
-#include "ardour/slave.h"
-
-using namespace std;
-using namespace ARDOUR;
-
-JACK_Slave::JACK_Slave (AudioEngine& e)
-       : engine (e)
-{
-       double x;
-       framepos_t p;
-       /* call this to initialize things */
-       speed_and_position (x, p);
-}
-
-JACK_Slave::~JACK_Slave ()
-{
-}
-
-bool
-JACK_Slave::locked() const
-{
-       return true;
-}
-
-bool
-JACK_Slave::ok() const
-{
-       return true;
-}
-
-bool
-JACK_Slave::speed_and_position (double& sp, framepos_t& position)
-{
-       switch (engine.transport_state()) {
-       case TransportStopped:
-               speed = 0;
-               _starting = false;
-               break;
-       case TransportRolling:
-               speed = 1.0;
-               _starting = false;
-               break;
-       case TransportLooping:
-               speed = 1.0;
-               _starting = false;
-               break;
-       case TransportStarting:
-               _starting = true;
-               // don't adjust speed here, just leave it as it was
-               break;
-       }
-
-       sp = speed;
-       position = engine.transport_frame();
-       return true;
-}
index 746732f76e1bd1f5abfe379514280d7a4b910859..4be52a7584fd7628cdd76e5d8dfc1417d4aa0f90 100644 (file)
@@ -393,7 +393,7 @@ Session::immediately_post_engine ()
 
        _engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));
 
-       if (synced_to_jack()) {
+       if (synced_to_engine()) {
                _engine.transport_stop ();
        }
 
@@ -1406,7 +1406,7 @@ Session::audible_frame () const
                offset = current_block_size;
        }
 
-       if (synced_to_jack()) {
+       if (synced_to_engine()) {
                tf = _engine.transport_frame();
        } else {
                tf = _transport_frame;
index 0f2186c09b8eefd5020326976b7a6985501b5987..e35910f2df0bea4bef33a9232ab09df5abfe2d3b 100644 (file)
@@ -182,7 +182,7 @@ Session::timecode_time (Timecode::Time &t)
 int
 Session::backend_sync_callback (TransportState state, framepos_t pos)
 {
-       bool slave = synced_to_jack();
+       bool slave = synced_to_engine();
 
        switch (state) {
        case TransportStopped:
index ab6d68fd674138bb529a6a15bb01d7351a1b8e94..38ad5212359a7377e2e5cf045a11197b83fdc6ab 100644 (file)
@@ -86,7 +86,7 @@ Session::request_sync_source (Slave* new_slave)
 
        seamless = Config->get_seamless_loop ();
 
-       if (dynamic_cast<JACK_Slave*>(new_slave)) {
+       if (dynamic_cast<Engine_Slave*>(new_slave)) {
                /* JACK cannot support seamless looping at present */
                Config->set_seamless_loop (false);
        } else {
@@ -514,13 +514,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        if (auto_return_enabled ||
            (ptw & PostTransportLocate) ||
            (_requested_return_frame >= 0) ||
-           synced_to_jack()) {
+           synced_to_engine()) {
 
                if (pending_locate_flush) {
                        flush_all_inserts ();
                }
 
-               if ((auto_return_enabled || synced_to_jack() || _requested_return_frame >= 0) &&
+               if ((auto_return_enabled || synced_to_engine() || _requested_return_frame >= 0) &&
                    !(ptw & PostTransportLocate)) {
 
                        /* no explicit locate queued */
@@ -543,7 +543,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
 
                                                /* don't try to handle loop play when synced to JACK */
 
-                                               if (!synced_to_jack()) {
+                                               if (!synced_to_engine()) {
 
                                                        Location *location = _locations->auto_loop_location();
 
@@ -734,7 +734,7 @@ Session::set_play_loop (bool yn)
                return;
        }
 
-       if (yn && Config->get_seamless_loop() && synced_to_jack()) {
+       if (yn && Config->get_seamless_loop() && synced_to_engine()) {
                warning << string_compose (
                        _("Seamless looping cannot be supported while %1 is using JACK transport.\n"
                          "Recommend changing the configured options"), PROGRAM_NAME)
@@ -811,7 +811,7 @@ Session::flush_all_inserts ()
 void
 Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force)
 {
-       if (synced_to_jack()) {
+       if (synced_to_engine()) {
 
                double sp;
                framepos_t pos;
@@ -926,7 +926,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
 
        bool transport_was_stopped = !transport_rolling();
 
-       if (transport_was_stopped && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
+       if (transport_was_stopped && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_engine() && play_loop)) {
                realtime_stop (false, true); // XXX paul - check if the 2nd arg is really correct
                transport_was_stopped = true;
        } else {
@@ -1067,7 +1067,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
                        set_track_monitor_input_status (true);
                }
 
-               if (synced_to_jack ()) {
+               if (synced_to_engine ()) {
                        if (clear_state) {
                                /* do this here because our response to the slave won't
                                   take care of it.
@@ -1090,7 +1090,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
                        set_track_monitor_input_status (false);
                }
 
-               if (synced_to_jack()) {
+               if (synced_to_engine()) {
                        _engine.transport_start ();
                } else {
                        start_transport ();
@@ -1100,7 +1100,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
 
                /* not zero, not 1.0 ... varispeed */
 
-               if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) {
+               if ((synced_to_engine()) && speed != 0.0 && speed != 1.0) {
                        warning << string_compose (
                                _("Global varispeed cannot be supported while %1 is connected to JACK transport control"),
                                PROGRAM_NAME)
@@ -1429,8 +1429,8 @@ Session::switch_to_sync_source (SyncSource src)
                }
                break;
 
-       case JACK:
-               if (_slave && dynamic_cast<JACK_Slave*>(_slave)) {
+       case Engine:
+               if (_slave && dynamic_cast<Engine_Slave*>(_slave)) {
                        return;
                }
 
@@ -1438,7 +1438,7 @@ Session::switch_to_sync_source (SyncSource src)
                        return;
                }
 
-               new_slave = new JACK_Slave (*AudioEngine::instance());
+               new_slave = new Engine_Slave (*AudioEngine::instance());
                break;
 
        default:
@@ -1632,9 +1632,9 @@ bool
 Session::maybe_stop (framepos_t limit)
 {
        if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
-               if (synced_to_jack () && config.get_jack_time_master ()) {
+               if (synced_to_engine () && config.get_jack_time_master ()) {
                        _engine.transport_stop ();
-               } else if (!synced_to_jack ()) {
+               } else if (!synced_to_engine ()) {
                        stop_transport ();
                }
                return true;
index e7b76481493155ffcbb7beb22aacc16b0b64505f..0c98461974e0138adcfabf81b4951736b8689c10 100644 (file)
@@ -395,12 +395,12 @@ string_to_sync_source (string str)
        }
 
        if (str == _("JACK")) {
-               return JACK;
+               return Engine;
        }
 
        fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
        /*NOTREACHED*/
-       return JACK;
+       return Engine;
 }
 
 /** @param sh Return a short version of the string */
@@ -408,7 +408,10 @@ const char*
 sync_source_to_string (SyncSource src, bool sh)
 {
        switch (src) {
-       case JACK:
+       case Engine:
+               /* no other backends offer sync for now ... deal with this if we
+                * ever have to.
+                */
                return _("JACK");
 
        case MTC:
index d367b2101e2bd61f97991aac828c452bdccfa8c3..474a9c58c66bfcfdce8fbe8081b919963ea5027f 100644 (file)
@@ -69,6 +69,7 @@ libardour_sources = [
         'diskstream.cc',
         'element_import_handler.cc',
         'element_importer.cc',
+        'engine_slave.cc',
         'enums.cc',
         'event_type_map.cc',
         'export_channel.cc',
@@ -103,7 +104,6 @@ libardour_sources = [
         'interpolation.cc',
         'io.cc',
         'io_processor.cc',
-        'jack_slave.cc',
         'kmeterdsp.cc',
         'ladspa_plugin.cc',
         'location.cc',