2 * Copyright (C) 2013-2019 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2015-2018 Robin Gareus <robin@gareus.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "ardour/audioengine.h"
24 #include "ardour/audio_backend.h"
25 #include "ardour/session.h"
26 #include "ardour/transport_master.h"
31 using namespace ARDOUR;
33 Engine_TransportMaster::Engine_TransportMaster (AudioEngine& e)
34 : TransportMaster (Engine, X_("JACK"))
41 Engine_TransportMaster::~Engine_TransportMaster ()
46 Engine_TransportMaster::init ()
51 Engine_TransportMaster::usable () const
53 return AudioEngine::instance()->current_backend_name() == X_("JACK");
57 Engine_TransportMaster::check_backend()
59 if (AudioEngine::instance()->current_backend_name() == X_("JACK")) {
67 Engine_TransportMaster::reset (bool)
73 Engine_TransportMaster::locked() const
79 Engine_TransportMaster::ok() const
85 Engine_TransportMaster::pre_process (pframes_t, samplepos_t, boost::optional<samplepos_t>)
91 Engine_TransportMaster::speed_and_position (double& sp, samplepos_t& position, samplepos_t& lp, samplepos_t & when, samplepos_t now)
93 boost::shared_ptr<AudioBackend> backend = engine.current_backend();
95 /* 3rd argument (now) doesn't matter here because we're always being
96 * called synchronously with the engine.
99 if (backend && backend->speed_and_position (sp, position)) {
112 Engine_TransportMaster::position_string () const
115 return PBD::to_string (_session->audible_sample());
118 return std::string();
122 Engine_TransportMaster::delta_string () const
128 Engine_TransportMaster::allow_request (TransportRequestSource src, TransportRequestType type) const
131 if (_session->config.get_jack_time_master()) {
142 Engine_TransportMaster::update_interval () const
144 return AudioEngine::instance()->samples_per_cycle();