*/
-#ifndef __ardour_audiobackend_h__
-#define __ardour_audiobackend_h__
+#ifndef __libardour_audiobackend_h__
+#define __libardour_audiobackend_h__
#include <string>
#include <vector>
#include <stdint.h>
#include <stdlib.h>
+#include <boost/function.hpp>
+
namespace ARDOUR {
class AudioEngine;
}
-#endif /* __ardour_audiobackend_h__ */
+#endif /* __libardour_audiobackend_h__ */
*/
-#ifndef __ardour_jack_audiobackend_h__
-#define __ardour_jack_audiobackend_h__
+#ifndef __libardour_jack_audiobackend_h__
+#define __libardour_jack_audiobackend_h__
#include <string>
#include <vector>
#include <stdint.h>
+#include <jack/jack.h>
+#ifdef HAVE_JACK_SESSION
+#include <jack/session.h>
+#endif
+
#include "ardour/audio_backend.h"
namespace ARDOUR {
-class JACKAudioBackend : public {
+class JACKAudioBackend : public AudioBackend {
public:
JACKAudioBackend (AudioEngine& e);
~JACKAudioBackend ();
+ std::string name() const;
+ bool connected() const;
+ bool is_realtime () const;
+
std::vector<std::string> enumerate_devices () const;
std::vector<float> available_sample_rates (const std::string& device) const;
std::vector<uint32_t> available_buffer_sizes (const std::string& device) const;
-
- int set_parameters (const Parameters&);
- int get_parameters (Parameters&) const;
+ uint32_t available_input_channel_count (const std::string& device) const;
+ uint32_t available_output_channel_count (const std::string& device) const;
+
+ int set_device_name (const std::string&);
+ int set_sample_rate (float);
+ int set_buffer_size (uint32_t);
+ int set_sample_format (SampleFormat);
+ int set_interleaved (bool yn);
+ int set_input_channels (uint32_t);
+ int set_output_channels (uint32_t);
+ int set_systemic_input_latency (uint32_t);
+ int set_systemic_output_latency (uint32_t);
+
+ std::string get_device_name () const;
+ float get_sample_rate () const;
+ uint32_t get_buffer_size () const;
+ SampleFormat get_sample_format () const;
+ bool get_interleaved () const;
+ uint32_t get_input_channels () const;
+ uint32_t get_output_channels () const;
+ uint32_t get_systemic_input_latency () const;
+ uint32_t get_systemic_output_latency () const;
int start ();
int stop ();
int pause ();
- int freewheel ();
+ int freewheel (bool);
private:
jack_client_t* volatile _jack; /* could be reset to null by SIGPIPE or another thread */
static void _freewheel_callback (int , void *arg);
static void _registration_callback (jack_port_id_t, int, void *);
static void _connect_callback (jack_port_id_t, jack_port_id_t, int, void *);
- static void _latency_callback (jack_latency_callback_mode_t, void*);#
+ static void _latency_callback (jack_latency_callback_mode_t, void*);
static void halted (void *);
static void halted_info (jack_status_t,const char*,void *);
-ifdef HAVE_JACK_SESSION
+#ifdef HAVE_JACK_SESSION
static void _session_callback (jack_session_event_t *event, void *arg);
#endif
bool _target_interleaved;
uint32_t _target_input_channels;
uint32_t _target_output_channels;
- uin32_t _target_systemic_input_latency;
- uin32_t _target_systemic_input_latency;
+ uint32_t _target_systemic_input_latency;
+ uint32_t _target_systemic_output_latency;
};
-}
+} // namespace
#endif /* __ardour_audiobackend_h__ */
--- /dev/null
+/*
+ Copyright (C) 2013 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.
+
+*/
+
+#ifndef __libardour_jack_portengine_h__
+#define __libardour_jack_portengine_h__
+
+namespace ARDOUR {
+
+class JACKPortEngine : public PortEngine
+{
+ public:
+ JACKPortEngine (const std::string& client_name,
+ const std::string& session_uuid);
+};
+
+} // namespace
+
+#endif /* __libardour_jack_portengine_h__ */
PortEngine::PortHandle port_handle() { return _port_handle; }
- void get_connected_latency_range (jack_latency_range_t& range, bool playback) const;
+ void get_connected_latency_range (LatencyRange& range, bool playback) const;
- void set_private_latency_range (jack_latency_range_t& range, bool playback);
- const jack_latency_range_t& private_latency_range (bool playback) const;
+ void set_private_latency_range (LatencyRange& range, bool playback);
+ const LatencyRange& private_latency_range (bool playback) const;
- void set_public_latency_range (jack_latency_range_t& range, bool playback) const;
- jack_latency_range_t public_latency_range (bool playback) const;
+ void set_public_latency_range (LatencyRange& range, bool playback) const;
+ LatencyRange public_latency_range (bool playback) const;
virtual void reset ();
framecnt_t _port_buffer_offset; /* access only from process() tree */
- jack_latency_range_t _private_playback_latency;
- jack_latency_range_t _private_capture_latency;
+ LatencyRange _private_playback_latency;
+ LatencyRange _private_capture_latency;
private:
std::string _name; ///< port short name
typedef void* PortHandle;
- virtual bool connected() const = 0;
+ virtual bool connected() const = 0;
+ virtual void* private_handle() const = 0;
virtual int set_port_name (PortHandle, const std::string&) = 0;
virtual std::string get_port_name (PortHandle) const = 0;
virtual PortHandle* get_port_by_name (const std::string&) const = 0;
- virtual PortHandle register_port (const std::string&, DataType::Symbol, ARDOUR::PortFlags) = 0;
+ virtual std::string make_port_name_relative (const std::string& name) const = 0;
+ virtual std::string make_port_name_non_relative (const std::string& name) const = 0;
+ virtual bool port_is_mine (const std::string& fullname) const = 0;
+
+ virtual PortHandle register_port (const std::string& shortname, ARDOUR::DataType, ARDOUR::PortFlags) = 0;
virtual void unregister_port (PortHandle) = 0;
+
virtual bool connected (PortHandle) = 0;
- virtual int disconnect_all (PortHandle) = 0;
virtual bool connected_to (PortHandle, const std::string&) = 0;
- virtual int get_connections (PortHandle, std::vector<std::string>&) = 0;
virtual bool physically_connected (PortHandle) = 0;
+
+ virtual int get_connections (PortHandle, std::vector<std::string>&) = 0;
+
virtual int connect (PortHandle, const std::string&) = 0;
virtual int disconnect (PortHandle, const std::string&) = 0;
+ virtual int disconnect_all (PortHandle) = 0;
+
+ virtual int connect (const std::string& src, const std::string& dst) = 0;
+ virtual int disconnect (const std::string& src, const std::string& dst) = 0;
/* MIDI */
- virtual void midi_event_get (pframes_t& timestamp, size_t& size, uint8_t** buf, void* port_buffer, uint32_t event_index) = 0;
- virtual int midi_event_put (void* port_buffer, pframes_t timestamp, const uint8_t* buffer, size_t size) = 0;
+ virtual void midi_event_get (pframes_t& timestamp, size_t& size, uint8_t** buf, void* port_buffer, uint32_t event_index) = 0;
+ virtual int midi_event_put (void* port_buffer, pframes_t timestamp, const uint8_t* buffer, size_t size) = 0;
virtual uint32_t get_midi_event_count (void* port_buffer);
- virtual void midi_clear (void* port_buffer);
+ virtual void midi_clear (void* port_buffer);
/* Monitoring */
/* Latency management
*/
- struct LatencyRange {
- uint32_t min;
- uint32_t max;
- };
-
- virtual void set_latency_range (PortHandle, int dir, LatencyRange) = 0;
- virtual LatencyRange get_latency_range (PortHandle, int dir) = 0;
+ virtual void set_latency_range (PortHandle, bool for_playback, LatencyRange) = 0;
+ virtual LatencyRange get_latency_range (PortHandle, bool for_playback) = 0;
virtual LatencyRange get_connected_latency_range (PortHandle, int dir) = 0;
virtual void* get_buffer (PortHandle, pframes_t) = 0;
bool can_request_input_monitoring () const;
void request_input_monitoring (const std::string&, bool) const;
void ensure_input_monitoring (const std::string&, bool) const;
-
- std::string make_port_name_relative (const std::string&) const;
- std::string make_port_name_non_relative (const std::string&) const;
- bool port_is_mine (const std::string&) const;
class PortRegistrationFailure : public std::exception {
public:
framepos_t ltc_timecode_offset;
bool ltc_timecode_negative_offset;
- jack_latency_range_t ltc_out_latency;
+ LatencyRange ltc_out_latency;
void ltc_tx_initialize();
void ltc_tx_cleanup();
PBD::ScopedConnectionList port_connections;
PBD::ScopedConnection config_connection;
- jack_latency_range_t ltc_slave_latency;
+ LatencyRange ltc_slave_latency;
/* DLL - chase LTC */
int transport_direction;
IsOutput = 2,
};
+ struct LatencyRange {
+ uint32_t min; //< samples
+ uint32_t max; //< samples
+ };
} // namespace ARDOUR
+/*
+ Copyright (C) 2013 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 <jack/jack.h>
+
+#include "ardour/audioengine.h"
+#include "ardour/types.h"
#include "ardour/jack_audiobackend.h"
+using namespace ARDOUR;
+using std::string;
+
#define GET_PRIVATE_JACK_POINTER(j) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return; }
#define GET_PRIVATE_JACK_POINTER_RET(j,r) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return r; }
+JACKAudioBackend::JACKAudioBackend (AudioEngine& e)
+ : AudioBackend (e)
+ , _jack (0)
+ , _target_sample_rate (48000)
+ , _target_buffer_size (1024)
+ , _target_sample_format (FloatingPoint)
+ , _target_interleaved (false)
+ , _target_input_channels (-1)
+ , _target_output_channels (-1)
+ , _target_systemic_input_latency (0)
+ , _target_systemic_output_latency (0)
+{
+}
+
+int
+JACKAudioBackend::set_device_name (const string& dev)
+{
+ _target_device = dev;
+ return 0;
+}
+
int
JACKAudioBackend::start ()
{
if (!session.deletion_in_progress() && session.ltc_output_io()) { /* check if Port exits */
boost::shared_ptr<Port> ltcport = session.ltc_input_port();
- ltcport->get_connected_latency_range(ltc_slave_latency, false);
+ ltcport->get_connected_latency_range (ltc_slave_latency, false);
}
}
_private_capture_latency.max = 0;
/* Unfortunately we have to pass the DataType into this constructor so that
- we can create the right kind of JACK port; aside from this we'll use the
+ we can create the right kind of port; aside from this we'll use the
virtual function type () to establish type.
*/
throw failed_constructor ();
}
- if ((_jack_port = port_engine.register_port (_name, t.to_port_type (), _flags)) == 0) {
- cerr << "Failed to register JACK port \"" << _name << "\", reason is unknown from here\n";
+ if ((_port_handle = port_engine.register_port (_name, t, _flags)) == 0) {
+ cerr << "Failed to register port \"" << _name << "\", reason is unknown from here\n";
throw failed_constructor ();
}
Port::drop ()
{
if (_port_handle) {
- port_engine.unregister_port (port_handle);
+ port_engine.unregister_port (_port_handle);
_port_handle = 0;
}
}
int
Port::disconnect_all ()
{
- jack_port_disconnect (_engine->jack(), _jack_port);
+ port_engine.disconnect_all (_port_handle);
_connections.clear ();
/* a cheaper, less hacky way to do boost::shared_from_this() ...
*/
- boost::shared_ptr<Port> pself = _engine->get_port_by_name (name());
+ boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
PostDisconnect (pself, boost::shared_ptr<Port>()); // emit signal
return 0;
bool
Port::connected_to (std::string const & o) const
{
- if (!_engine->connected()) {
+ if (!port_engine.connected()) {
/* in some senses, this answer isn't the right one all the time,
because we know about our connections and will re-establish
- them when we reconnect to JACK.
+ them when we reconnect to the port engine.
*/
return false;
}
- return jack_port_connected_to (_jack_port,
- _engine->make_port_name_non_relative(o).c_str ());
+ return port_engine.connected_to (_port_handle, port_engine.make_port_name_non_relative (o));
}
-/** @param o Filled in with port full names of ports that we are connected to */
int
Port::get_connections (std::vector<std::string> & c) const
{
- int n = 0;
-
- if (_engine->connected()) {
- const char** jc = jack_port_get_connections (_jack_port);
- if (jc) {
- for (int i = 0; jc[i]; ++i) {
- c.push_back (jc[i]);
- ++n;
- }
-
- if (jack_free) {
- jack_free (jc);
- } else {
- free (jc);
- }
- }
- }
-
- return n;
+ return port_engine.get_connections (_port_handle, c);
}
int
Port::connect (std::string const & other)
{
- std::string const other_shrt = _engine->make_port_name_non_relative (other);
- std::string const this_shrt = _engine->make_port_name_non_relative (_name);
+ std::string const other_name = port_engine.make_port_name_non_relative (other);
+ std::string const our_name = port_engine.make_port_name_non_relative (_name);
int r = 0;
}
if (sends_output ()) {
- r = jack_connect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ());
+ port_engine.connect (our_name, other_name);
} else {
- r = jack_connect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str());
+ port_engine.connect (other_name, our_name);
}
if (r == 0) {
int
Port::disconnect (std::string const & other)
{
- std::string const other_fullname = _engine->make_port_name_non_relative (other);
- std::string const this_fullname = _engine->make_port_name_non_relative (_name);
+ std::string const other_fullname = port_engine.make_port_name_non_relative (other);
+ std::string const this_fullname = port_engine.make_port_name_non_relative (_name);
int r = 0;
if (sends_output ()) {
- r = _engine->disconnect (this_fullname, other_fullname);
+ r = port_engine.disconnect (this_fullname, other_fullname);
} else {
- r = _engine->disconnect (other_fullname, this_fullname);
+ r = port_engine.disconnect (other_fullname, this_fullname);
}
if (r == 0) {
/* a cheaper, less hacky way to do boost::shared_from_this() ...
*/
- boost::shared_ptr<Port> pself = _engine->get_port_by_name (name());
- boost::shared_ptr<Port> pother = _engine->get_port_by_name (other);
+ boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
+ boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (other);
if (pself && pother) {
/* Disconnecting from another Ardour port: need to allow
void
Port::request_input_monitoring (bool yn)
{
- port_eengine.request_input_monitoring (_port_handle, yn);
+ port_engine.request_input_monitoring (_port_handle, yn);
}
void
}
void
-Port::set_public_latency_range (jack_latency_range_t& range, bool playback) const
+Port::set_public_latency_range (LatencyRange& range, bool playback) const
{
- /* this sets the visible latency that the rest of JACK sees. because we do latency
- compensation, all (most) of our visible port latency values are identical.
+ /* this sets the visible latency that the rest of the port system
+ sees. because we do latency compensation, all (most) of our visible
+ port latency values are identical.
*/
- if (!jack_port_set_latency_range) {
- return;
- }
-
DEBUG_TRACE (DEBUG::Latency,
string_compose ("SET PORT %1 %4 PUBLIC latency now [%2 - %3]\n",
name(), range.min, range.max,
(playback ? "PLAYBACK" : "CAPTURE")));;
- jack_port_set_latency_range (_jack_port,
- (playback ? JackPlaybackLatency : JackCaptureLatency),
- &range);
+ port_engine.set_latency_range (_port_handle, playback, range);
}
void
-Port::set_private_latency_range (jack_latency_range_t& range, bool playback)
+Port::set_private_latency_range (LatencyRange& range, bool playback)
{
if (playback) {
_private_playback_latency = range;
_private_capture_latency.max));
}
- /* push to public (JACK) location so that everyone else can see it */
+ /* push to public (port system) location so that everyone else can see it */
set_public_latency_range (range, playback);
}
-const jack_latency_range_t&
+const LatencyRange&
Port::private_latency_range (bool playback) const
{
if (playback) {
}
}
-jack_latency_range_t
+LatencyRange
Port::public_latency_range (bool /*playback*/) const
{
- jack_latency_range_t r;
+ LatencyRange r;
+
+ r = port_engine.get_latency_range (_port_handle, sends_output() ? true : false);
- jack_port_get_latency_range (_jack_port,
- sends_output() ? JackPlaybackLatency : JackCaptureLatency,
- &r);
DEBUG_TRACE (DEBUG::Latency, string_compose (
"GET PORT %1: %4 PUBLIC latency range %2 .. %3\n",
name(), r.min, r.max,
}
void
-Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) const
+Port::get_connected_latency_range (LatencyRange& range, bool playback) const
{
- if (!jack_port_get_latency_range) {
- return;
- }
-
vector<string> connections;
- jack_client_t* jack = _engine->jack();
-
- if (!jack) {
- range.min = 0;
- range.max = 0;
- PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg;
- return;
- }
get_connections (connections);
for (vector<string>::const_iterator c = connections.begin();
c != connections.end(); ++c) {
- jack_latency_range_t lr;
+ LatencyRange lr;
if (!AudioEngine::instance()->port_is_mine (*c)) {
- /* port belongs to some other JACK client, use
- * JACK to lookup its latency information.
+ /* port belongs to some other port-system client, use
+ * the port engine to lookup its latency information.
*/
- jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str());
+ PortEngine::PortHandle remote_port = port_engine.get_port_by_name (*c);
if (remote_port) {
- jack_port_get_latency_range (
- remote_port,
- (playback ? JackPlaybackLatency : JackCaptureLatency),
- &lr);
+ lr = port_engine.get_latency_range (remote_port, playback);
DEBUG_TRACE (DEBUG::Latency, string_compose (
"\t%1 <-> %2 : latter has latency range %3 .. %4\n",
int
Port::reestablish ()
{
- jack_client_t* jack = _engine->jack();
-
- if (!jack) {
- return -1;
- }
-
- _jack_port = jack_port_register (jack, _name.c_str(), type().to_jack_type(), _flags, 0);
+ _port_handle = port_engine.register_port (_name, type(), _flags);
- if (_jack_port == 0) {
+ if (_port_handle == 0) {
PBD::error << string_compose (_("could not reregister %1"), _name) << endmsg;
return -1;
}
return 0;
}
-/** @param n Short port name (no JACK client name) */
+/** @param n Short port name (no port-system client name) */
int
Port::set_name (std::string const & n)
{
return 0;
}
- int const r = jack_port_set_name (_jack_port, n.c_str());
+ int const r = port_engine.set_port_name (_port_handle, n);
if (r == 0) {
- _engine->port_renamed (_name, n);
+ AudioEngine::instance()->port_renamed (_name, n);
_name = n;
}
bool
Port::physically_connected () const
{
- const char** jc = jack_port_get_connections (_jack_port);
-
- if (jc) {
- for (int i = 0; jc[i]; ++i) {
-
- jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]);
-
- if (port && (jack_port_flags (port) & JackPortIsPhysical)) {
- if (jack_free) {
- jack_free (jc);
- } else {
- free (jc);
- }
- return true;
- }
- }
- if (jack_free) {
- jack_free (jc);
- } else {
- free (jc);
- }
- }
-
- return false;
+ return port_engine.physically_connected (_port_handle);
}
void
PortInsert::stop_latency_detection ()
{
- _latency_flush_frames = signal_latency() + _session.engine().frames_per_cycle();
+ _latency_flush_frames = signal_latency() + _session.engine().samples_per_cycle();
_latency_detect = false;
}
*/
if (_measured_latency == 0) {
- return _session.engine().frames_per_cycle() + _input->latency();
+ return _session.engine().samples_per_cycle() + _input->latency();
} else {
return _measured_latency;
}
*/
if (_measured_latency == 0) {
- return _session.engine().frames_per_cycle() + _input->signal_latency();
+ return _session.engine().samples_per_cycle() + _input->signal_latency();
} else {
return _measured_latency;
}
DEBUG_TRACE (DEBUG::Processors, string_compose (
"%1 adding processor %2\n", name(), processor->name()));
- if (!_session.engine().connected() || !processor) {
+ if (!AudioEngine::instance()->port_engine().connected() || !processor) {
return 1;
}
loc = _processors.end ();
}
- if (!_session.engine().connected()) {
+ if (!_session.engine().port_engine().connected()) {
return 1;
}
void
Route::clear_processors (Placement p)
{
- if (!_session.engine().connected()) {
+ if (!_session.engine().port_engine().connected()) {
return;
}
return 0;
}
- if (!_session.engine().connected()) {
+ if (!_session.engine().port_engine().connected()) {
return 1;
}
{
ProcessorList deleted;
- if (!_session.engine().connected()) {
+ if (!_session.engine().port_engine().connected()) {
return 1;
}
universally true, but the alternative is way too corner-case to worry about.
*/
- jack_latency_range_t all_connections;
+ LatencyRange all_connections;
if (from.empty()) {
all_connections.min = 0;
for (PortSet::iterator p = from.begin(); p != from.end(); ++p) {
- jack_latency_range_t range;
+ LatencyRange range;
p->get_connected_latency_range (range, playback);
latency compensation into account.
*/
- jack_latency_range_t range;
+ LatencyRange range;
range.min = value;
range.max = value;
interpolation.add_channel_to (0, 0);
- if (!eng.connected()) {
+ if (!eng.port_engine().connected()) {
throw failed_constructor();
}
BootMessage (_("Set block size and sample rate"));
- set_block_size (_engine.frames_per_cycle());
- set_frame_rate (_engine.frame_rate());
+ set_block_size (_engine.samples_per_cycle());
+ set_frame_rate (_engine.sample_rate());
BootMessage (_("Using configuration"));
_worst_output_latency = 0;
- if (!_engine.connected()) {
+ if (!_engine.port_engine().connected()) {
return;
}
_worst_input_latency = 0;
- if (!_engine.connected()) {
+ if (!_engine.port_engine().connected()) {
return;
}
/* we are ready to go ... */
- if (!_engine.connected()) {
+ if (!_engine.port_engine().connected()) {
return -1;
}
* This filter is adaptive so that fast vari-speed signals
* will not be affected by it.
*/
-#define LTC_RISE_TIME(speed) MIN (100, MAX(40, (4000000 / ((speed==0)?1:speed) / engine().frame_rate())))
+#define LTC_RISE_TIME(speed) MIN (100, MAX(40, (4000000 / ((speed==0)?1:speed) / engine().sample_rate())))
#define TV_STANDARD(tcf) \
(timecode_to_frames_per_second(tcf)==25.0 ? LTC_TV_625_50 : \
* To do better than this, resampling (or a rewrite of the
* encoder) is required.
*/
- ltc_speed -= ((ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_frame) / engine().frame_rate();
+ ltc_speed -= ((ltc_enc_pos + ltc_enc_cnt - poff) - cycle_start_frame) / engine().sample_rate();
}
set_history_depth (Config->get_history_depth());
- _current_frame_rate = _engine.frame_rate ();
+ _current_frame_rate = _engine.sample_rate ();
_nominal_frame_rate = _current_frame_rate;
_base_frame_rate = _current_frame_rate;
}
}
- jack_session_reply (_engine.jack(), event);
+ /* this won't be called if the port engine in use is not JACK, so we do
+ not have to worry about the type of PortEngine::private_handle()
+ */
+
+ jack_client_t* jack_client = (jack_client_t*) AudioEngine::instance()->port_engine().private_handle();
+
+ if (jack_client) {
+ jack_session_reply (jack_client, event);
+ }
if (event->type == JackSessionSaveAndQuit) {
Quit (); /* EMIT SIGNAL */
return 1;
}
- if (!_engine.connected ()) {
+ if (!_engine.port_engine().connected ()) {
error << string_compose (_("the %1 audio engine is not connected and state saving would lose all I/O connections. Session not saved"),
PROGRAM_NAME)
<< endmsg;
#include "ardour/session.h"
#include "ardour/slave.h"
#include "ardour/operations.h"
+#include "ardour/jack_portengine.h"
#include "i18n.h"
break;
case JACK:
+ /* if we are not using JACK as the port engine, we can't do
+ * this
+ */
+ if (dynamic_cast<JACKPortEngine*>(&AudioEngine::instance()->port_engine())) {
+ return;
+ }
+
if (_slave && dynamic_cast<JACK_Slave*>(_slave)) {
return;
}
return;
}
- new_slave = new JACK_Slave (_engine.jack());
+ new_slave = new JACK_Slave ((jack_client_t*) AudioEngine::instance()->port_engine().private_handle());
break;
default:
pframes_t
SlaveSessionProxy::frames_since_cycle_start() const
{
- return session.engine().frames_since_cycle_start();
+ return session.engine().samples_since_cycle_start();
}
framepos_t
SlaveSessionProxy::frame_time() const
{
- return session.engine().frame_time();
+ return session.engine().sample_time();
}
void