most of libardour now actually compiles
This commit is contained in:
parent
2af6491c1c
commit
20b1a7d9d8
@ -17,8 +17,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __ardour_audiobackend_h__
|
||||
#define __ardour_audiobackend_h__
|
||||
#ifndef __libardour_audiobackend_h__
|
||||
#define __libardour_audiobackend_h__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -26,6 +26,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class AudioEngine;
|
||||
@ -342,5 +344,5 @@ class AudioBackend {
|
||||
|
||||
}
|
||||
|
||||
#endif /* __ardour_audiobackend_h__ */
|
||||
#endif /* __libardour_audiobackend_h__ */
|
||||
|
||||
|
@ -17,34 +17,62 @@
|
||||
|
||||
*/
|
||||
|
||||
#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;
|
||||
uint32_t available_input_channel_count (const std::string& device) const;
|
||||
uint32_t available_output_channel_count (const std::string& device) const;
|
||||
|
||||
int set_parameters (const Parameters&);
|
||||
int get_parameters (Parameters&) 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 */
|
||||
@ -60,10 +88,10 @@ class JACKAudioBackend : public {
|
||||
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
|
||||
|
||||
@ -103,11 +131,11 @@ ifdef HAVE_JACK_SESSION
|
||||
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__ */
|
||||
|
||||
|
34
libs/ardour/ardour/jack_portengine.h
Normal file
34
libs/ardour/ardour/jack_portengine.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
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__ */
|
@ -97,13 +97,13 @@ public:
|
||||
|
||||
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 ();
|
||||
|
||||
@ -147,8 +147,8 @@ protected:
|
||||
|
||||
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
|
||||
|
@ -88,20 +88,31 @@ class PortEngine {
|
||||
typedef void* PortHandle;
|
||||
|
||||
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 */
|
||||
|
||||
@ -120,13 +131,8 @@ class PortEngine {
|
||||
/* 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;
|
||||
|
@ -79,10 +79,6 @@ class PortManager
|
||||
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:
|
||||
PortRegistrationFailure (std::string const & why = "")
|
||||
|
@ -1213,7 +1213,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||
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();
|
||||
|
@ -391,7 +391,7 @@ public:
|
||||
|
||||
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;
|
||||
|
@ -602,6 +602,10 @@ namespace ARDOUR {
|
||||
IsOutput = 2,
|
||||
};
|
||||
|
||||
struct LatencyRange {
|
||||
uint32_t min; //< samples
|
||||
uint32_t max; //< samples
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
||||
|
@ -1,8 +1,55 @@
|
||||
/*
|
||||
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 ()
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ LTC_Slave::resync_latency()
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ Port::Port (std::string const & n, DataType t, PortFlags f)
|
||||
_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.
|
||||
*/
|
||||
|
||||
@ -73,8 +73,8 @@ Port::Port (std::string const & n, DataType t, PortFlags f)
|
||||
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 ();
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void
|
||||
Port::drop ()
|
||||
{
|
||||
if (_port_handle) {
|
||||
port_engine.unregister_port (port_handle);
|
||||
port_engine.unregister_port (_port_handle);
|
||||
_port_handle = 0;
|
||||
}
|
||||
}
|
||||
@ -106,12 +106,12 @@ Port::connected () const
|
||||
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;
|
||||
@ -123,48 +123,28 @@ Port::disconnect_all ()
|
||||
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;
|
||||
|
||||
@ -173,9 +153,9 @@ Port::connect (std::string const & other)
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -188,15 +168,15 @@ Port::connect (std::string const & other)
|
||||
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) {
|
||||
@ -205,8 +185,8 @@ Port::disconnect (std::string const & other)
|
||||
|
||||
/* 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
|
||||
@ -241,7 +221,7 @@ Port::disconnect (Port* o)
|
||||
void
|
||||
Port::request_input_monitoring (bool yn)
|
||||
{
|
||||
port_eengine.request_input_monitoring (_port_handle, yn);
|
||||
port_engine.request_input_monitoring (_port_handle, yn);
|
||||
}
|
||||
|
||||
void
|
||||
@ -276,28 +256,23 @@ Port::increment_port_buffer_offset (pframes_t nframes)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -315,12 +290,12 @@ Port::set_private_latency_range (jack_latency_range_t& range, bool playback)
|
||||
_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) {
|
||||
@ -340,14 +315,13 @@ Port::private_latency_range (bool playback) const
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@ -356,21 +330,9 @@ Port::public_latency_range (bool /*playback*/) const
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -384,21 +346,18 @@ Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) c
|
||||
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",
|
||||
@ -442,15 +401,9 @@ Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) c
|
||||
int
|
||||
Port::reestablish ()
|
||||
{
|
||||
jack_client_t* jack = _engine->jack();
|
||||
_port_handle = port_engine.register_port (_name, type(), _flags);
|
||||
|
||||
if (!jack) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
_jack_port = jack_port_register (jack, _name.c_str(), type().to_jack_type(), _flags, 0);
|
||||
|
||||
if (_jack_port == 0) {
|
||||
if (_port_handle == 0) {
|
||||
PBD::error << string_compose (_("could not reregister %1"), _name) << endmsg;
|
||||
return -1;
|
||||
}
|
||||
@ -475,7 +428,7 @@ Port::reconnect ()
|
||||
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)
|
||||
{
|
||||
@ -483,10 +436,10 @@ 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;
|
||||
}
|
||||
|
||||
@ -497,29 +450,6 @@ Port::set_name (std::string const & 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);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ PortInsert::start_latency_detection ()
|
||||
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;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ PortInsert::latency() const
|
||||
*/
|
||||
|
||||
if (_measured_latency == 0) {
|
||||
return _session.engine().frames_per_cycle() + _input->latency();
|
||||
return _session.engine().samples_per_cycle() + _input->latency();
|
||||
} else {
|
||||
return _measured_latency;
|
||||
}
|
||||
@ -240,7 +240,7 @@ PortInsert::signal_latency() const
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
|
||||
loc = _processors.end ();
|
||||
}
|
||||
|
||||
if (!_session.engine().connected()) {
|
||||
if (!_session.engine().port_engine().connected()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1329,7 +1329,7 @@ Route::ab_plugins (bool forward)
|
||||
void
|
||||
Route::clear_processors (Placement p)
|
||||
{
|
||||
if (!_session.engine().connected()) {
|
||||
if (!_session.engine().port_engine().connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1416,7 +1416,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_session.engine().connected()) {
|
||||
if (!_session.engine().port_engine().connected()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1508,7 +1508,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams*
|
||||
{
|
||||
ProcessorList deleted;
|
||||
|
||||
if (!_session.engine().connected()) {
|
||||
if (!_session.engine().port_engine().connected()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3777,7 +3777,7 @@ Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, framecn
|
||||
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;
|
||||
@ -3792,7 +3792,7 @@ Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, framecn
|
||||
|
||||
for (PortSet::iterator p = from.begin(); p != from.end(); ++p) {
|
||||
|
||||
jack_latency_range_t range;
|
||||
LatencyRange range;
|
||||
|
||||
p->get_connected_latency_range (range, playback);
|
||||
|
||||
@ -3857,7 +3857,7 @@ Route::set_public_port_latencies (framecnt_t value, bool playback) const
|
||||
latency compensation into account.
|
||||
*/
|
||||
|
||||
jack_latency_range_t range;
|
||||
LatencyRange range;
|
||||
|
||||
range.min = value;
|
||||
range.max = value;
|
||||
|
@ -170,7 +170,7 @@ Session::Session (AudioEngine &eng,
|
||||
|
||||
interpolation.add_channel_to (0, 0);
|
||||
|
||||
if (!eng.connected()) {
|
||||
if (!eng.port_engine().connected()) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
|
||||
@ -346,8 +346,8 @@ Session::when_engine_running ()
|
||||
|
||||
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"));
|
||||
|
||||
@ -4677,7 +4677,7 @@ Session::set_worst_playback_latency ()
|
||||
|
||||
_worst_output_latency = 0;
|
||||
|
||||
if (!_engine.connected()) {
|
||||
if (!_engine.port_engine().connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4699,7 +4699,7 @@ Session::set_worst_capture_latency ()
|
||||
|
||||
_worst_input_latency = 0;
|
||||
|
||||
if (!_engine.connected()) {
|
||||
if (!_engine.port_engine().connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ Session::start_audio_export (framepos_t position)
|
||||
|
||||
/* we are ready to go ... */
|
||||
|
||||
if (!_engine.connected()) {
|
||||
if (!_engine.port_engine().connected()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ using namespace Timecode;
|
||||
* 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 : \
|
||||
@ -534,7 +534,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
|
||||
* 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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
||||
|
||||
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;
|
||||
|
||||
@ -736,7 +736,15 @@ Session::jack_session_event (jack_session_event_t * event)
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
||||
@ -757,7 +765,7 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||
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;
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/slave.h"
|
||||
#include "ardour/operations.h"
|
||||
#include "ardour/jack_portengine.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
@ -1416,6 +1417,13 @@ Session::switch_to_sync_source (SyncSource src)
|
||||
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;
|
||||
}
|
||||
@ -1424,7 +1432,7 @@ Session::switch_to_sync_source (SyncSource src)
|
||||
return;
|
||||
}
|
||||
|
||||
new_slave = new JACK_Slave (_engine.jack());
|
||||
new_slave = new JACK_Slave ((jack_client_t*) AudioEngine::instance()->port_engine().private_handle());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -50,13 +50,13 @@ SlaveSessionProxy::transport_frame() const
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user