mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 20:55:48 +01:00
NO-OP: clang-format/whitespace
This commit is contained in:
parent
21f2c01fcd
commit
a2094d97ad
1 changed files with 295 additions and 205 deletions
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/atomic.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <glibmm/threads.h>
|
||||
#include <glibmm/timer.h>
|
||||
|
|
@ -44,8 +44,8 @@
|
|||
#include "midi++/types.h"
|
||||
|
||||
/* used for delta_string(): (note: \u00B1 is the plus-or-minus sign) */
|
||||
#define PLUSMINUS(A) ( ((A)<0) ? "-" : (((A)>0) ? "+" : "\u00B1") )
|
||||
#define LEADINGZERO(A) ( (A)<10 ? " " : (A)<100 ? " " : (A)<1000 ? " " : (A)<10000 ? " " : "" )
|
||||
#define PLUSMINUS(A) (((A) < 0) ? "-" : (((A) > 0) ? "+" : "\u00B1"))
|
||||
#define LEADINGZERO(A) ((A) < 10 ? " " : (A) < 100 ? " " : (A) < 1000 ? " " : (A) < 10000 ? " " : "")
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
|
|
@ -58,15 +58,14 @@ class AudioPort;
|
|||
class Port;
|
||||
|
||||
namespace Properties {
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> fr2997;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> collect;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> connected;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> sclock_synced;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> fr2997;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> collect;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> connected;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> sclock_synced;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<ARDOUR::TransportRequestType> allowed_transport_requests;
|
||||
};
|
||||
}
|
||||
|
||||
struct LIBARDOUR_API SafeTime {
|
||||
|
||||
/* This object uses memory fences to provide psuedo-atomic updating of
|
||||
* non-atomic data. If after reading guard1 and guard2 with correct
|
||||
* memory fencing they have the same value, then we know that the other
|
||||
|
|
@ -95,31 +94,35 @@ struct LIBARDOUR_API SafeTime {
|
|||
double speed;
|
||||
boost::atomic<int> guard2;
|
||||
|
||||
SafeTime() {
|
||||
SafeTime ()
|
||||
{
|
||||
guard1.store (0);
|
||||
position = 0;
|
||||
position = 0;
|
||||
timestamp = 0;
|
||||
speed = 0;
|
||||
speed = 0;
|
||||
guard2.store (0);
|
||||
}
|
||||
|
||||
void reset () {
|
||||
void reset ()
|
||||
{
|
||||
guard1.store (0);
|
||||
position = 0;
|
||||
timestamp = 0;
|
||||
speed = 0;
|
||||
position = 0;
|
||||
timestamp = 0;
|
||||
speed = 0;
|
||||
guard2.store (0);
|
||||
}
|
||||
|
||||
void update (samplepos_t p, samplepos_t t, double s) {
|
||||
void update (samplepos_t p, samplepos_t t, double s)
|
||||
{
|
||||
guard1.fetch_add (1, boost::memory_order_acquire);
|
||||
position = p;
|
||||
position = p;
|
||||
timestamp = t;
|
||||
speed = s;
|
||||
speed = s;
|
||||
guard2.fetch_add (1, boost::memory_order_acquire);
|
||||
}
|
||||
|
||||
void safe_read (SafeTime& dst) const {
|
||||
void safe_read (SafeTime& dst) const
|
||||
{
|
||||
int tries = 0;
|
||||
|
||||
do {
|
||||
|
|
@ -129,9 +132,9 @@ struct LIBARDOUR_API SafeTime {
|
|||
tries = 0;
|
||||
}
|
||||
dst.guard1.store (guard1.load (boost::memory_order_seq_cst), boost::memory_order_seq_cst);
|
||||
dst.position = position;
|
||||
dst.position = position;
|
||||
dst.timestamp = timestamp;
|
||||
dst.speed = speed;
|
||||
dst.speed = speed;
|
||||
dst.guard2.store (guard2.load (boost::memory_order_seq_cst), boost::memory_order_seq_cst);
|
||||
tries++;
|
||||
|
||||
|
|
@ -148,14 +151,14 @@ struct LIBARDOUR_API SafeTime {
|
|||
* Ardour (GUI, control surfaces, OSC, etc.)
|
||||
*
|
||||
*/
|
||||
class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
||||
public:
|
||||
class LIBARDOUR_API TransportMaster : public PBD::Stateful
|
||||
{
|
||||
public:
|
||||
TransportMaster (SyncSource t, std::string const& name);
|
||||
virtual ~TransportMaster ();
|
||||
|
||||
TransportMaster (SyncSource t, std::string const & name);
|
||||
virtual ~TransportMaster();
|
||||
|
||||
static boost::shared_ptr<TransportMaster> factory (SyncSource, std::string const &, bool removeable);
|
||||
static boost::shared_ptr<TransportMaster> factory (XMLNode const &);
|
||||
static boost::shared_ptr<TransportMaster> factory (SyncSource, std::string const&, bool removeable);
|
||||
static boost::shared_ptr<TransportMaster> factory (XMLNode const&);
|
||||
|
||||
virtual void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>) = 0;
|
||||
|
||||
|
|
@ -224,7 +227,7 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
*
|
||||
* @return - when returning false, the transport will stop rolling
|
||||
*/
|
||||
virtual bool locked() const = 0;
|
||||
virtual bool locked () const = 0;
|
||||
|
||||
/**
|
||||
* reports to ARDOUR whether the slave is in a sane state
|
||||
|
|
@ -232,7 +235,7 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
* @return - when returning false, the transport will be stopped and the slave
|
||||
* disconnected from ARDOUR.
|
||||
*/
|
||||
virtual bool ok() const = 0;
|
||||
virtual bool ok () const = 0;
|
||||
|
||||
/**
|
||||
* reports to ARDOUR whether it is possible to use this slave
|
||||
|
|
@ -242,7 +245,10 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
* Only the JACK ("Engine") slave is ever likely to return false,
|
||||
* if JACK is not being used for the Audio/MIDI backend.
|
||||
*/
|
||||
virtual bool usable() const { return true; }
|
||||
virtual bool usable () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* reports to ARDOUR whether the slave is in the process of starting
|
||||
|
|
@ -250,13 +256,16 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
*
|
||||
* @return - when returning false, transport will not move until this method returns true
|
||||
*/
|
||||
virtual bool starting() const { return false; }
|
||||
virtual bool starting () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return - the timing resolution of the TransportMaster - If the distance of ARDOURs transport
|
||||
* to the slave becomes greater than the resolution, sound will stop
|
||||
*/
|
||||
virtual samplecnt_t resolution() const = 0;
|
||||
virtual samplecnt_t resolution () const = 0;
|
||||
|
||||
/**
|
||||
* @return - the expected update interval for the data source used by
|
||||
|
|
@ -264,7 +273,7 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
* this number indicates how long it is between changes to the known
|
||||
* position of the master.
|
||||
*/
|
||||
virtual samplecnt_t update_interval() const = 0;
|
||||
virtual samplecnt_t update_interval () const = 0;
|
||||
|
||||
/**
|
||||
* @return - when returning true, ARDOUR will wait for seekahead_distance() before transport
|
||||
|
|
@ -277,122 +286,165 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
* only if requires_seekahead() returns true.
|
||||
*/
|
||||
|
||||
virtual samplecnt_t seekahead_distance() const { return 0; }
|
||||
virtual samplecnt_t seekahead_distance () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return - when returning true, ARDOUR will use transport speed 1.0 no matter what
|
||||
* the slave returns
|
||||
*/
|
||||
virtual bool sample_clock_synced() const { return _sclock_synced; }
|
||||
virtual bool sample_clock_synced () const
|
||||
{
|
||||
return _sclock_synced;
|
||||
}
|
||||
virtual void set_sample_clock_synced (bool);
|
||||
|
||||
/**
|
||||
* @return - current time-delta between engine and sync-source
|
||||
*/
|
||||
virtual std::string delta_string() const { return ""; }
|
||||
virtual std::string delta_string () const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
sampleoffset_t current_delta() const { return _current_delta; }
|
||||
sampleoffset_t current_delta () const
|
||||
{
|
||||
return _current_delta;
|
||||
}
|
||||
|
||||
/* this is intended to be used by a UI and polled from a timeout. it should
|
||||
return a string describing the current position of the TC source. it
|
||||
should NOT do any computation, but should use a cached value
|
||||
of the TC source position.
|
||||
*/
|
||||
virtual std::string position_string() const = 0;
|
||||
virtual std::string position_string () const = 0;
|
||||
|
||||
virtual bool can_loop() const { return false; }
|
||||
virtual bool can_loop () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual Location* loop_location() const { return 0; }
|
||||
bool has_loop() const { return loop_location() != 0; }
|
||||
virtual Location* loop_location () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool has_loop () const
|
||||
{
|
||||
return loop_location () != 0;
|
||||
}
|
||||
|
||||
SyncSource type() const { return _type; }
|
||||
TransportRequestSource request_type() const {
|
||||
SyncSource type () const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
TransportRequestSource request_type () const
|
||||
{
|
||||
switch (_type) {
|
||||
case Engine: /* also JACK */
|
||||
return TRS_Engine;
|
||||
case MTC:
|
||||
return TRS_MTC;
|
||||
case LTC:
|
||||
return TRS_LTC;
|
||||
case MIDIClock:
|
||||
break;
|
||||
case Engine: /* also JACK */
|
||||
return TRS_Engine;
|
||||
case MTC:
|
||||
return TRS_MTC;
|
||||
case LTC:
|
||||
return TRS_LTC;
|
||||
case MIDIClock:
|
||||
break;
|
||||
}
|
||||
return TRS_MIDIClock;
|
||||
}
|
||||
|
||||
std::string name() const { return _name; }
|
||||
void set_name (std::string const &);
|
||||
std::string name () const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
void set_name (std::string const&);
|
||||
|
||||
int set_state (XMLNode const &, int);
|
||||
XMLNode& get_state();
|
||||
int set_state (XMLNode const&, int);
|
||||
XMLNode& get_state ();
|
||||
|
||||
static const std::string state_node_name;
|
||||
static void make_property_quarks ();
|
||||
static void make_property_quarks ();
|
||||
|
||||
virtual void set_session (Session*);
|
||||
|
||||
boost::shared_ptr<Port> port() const { return _port; }
|
||||
boost::shared_ptr<Port> port () const
|
||||
{
|
||||
return _port;
|
||||
}
|
||||
|
||||
bool check_collect();
|
||||
bool check_collect ();
|
||||
virtual void set_collect (bool);
|
||||
bool collect() const { return _collect; }
|
||||
bool collect () const
|
||||
{
|
||||
return _collect;
|
||||
}
|
||||
|
||||
/* called whenever the manager starts collecting (processing) this
|
||||
transport master. Typically will re-initialize any state used to
|
||||
deal with incoming data.
|
||||
*/
|
||||
virtual void init() = 0;
|
||||
virtual void init () = 0;
|
||||
|
||||
virtual void check_backend() {}
|
||||
virtual void check_backend () {}
|
||||
virtual bool allow_request (TransportRequestSource, TransportRequestType) const;
|
||||
std::string allowed_request_string () const;
|
||||
std::string allowed_request_string () const;
|
||||
|
||||
TransportRequestType request_mask() const { return _request_mask; }
|
||||
TransportRequestType request_mask () const
|
||||
{
|
||||
return _request_mask;
|
||||
}
|
||||
void set_request_mask (TransportRequestType);
|
||||
|
||||
/* this is set at construction, and not changeable later, so it is not
|
||||
* a property
|
||||
*/
|
||||
|
||||
bool removeable () const { return _removeable; }
|
||||
void set_removeable (bool yn) { _removeable = yn; }
|
||||
bool removeable () const
|
||||
{
|
||||
return _removeable;
|
||||
}
|
||||
void set_removeable (bool yn)
|
||||
{
|
||||
_removeable = yn;
|
||||
}
|
||||
|
||||
std::string display_name (bool sh/*ort*/ = true) const;
|
||||
std::string display_name (bool sh /*ort*/ = true) const;
|
||||
|
||||
virtual void unregister_port ();
|
||||
void connect_port_using_state ();
|
||||
void connect_port_using_state ();
|
||||
virtual void create_port () = 0;
|
||||
|
||||
protected:
|
||||
SyncSource _type;
|
||||
PBD::Property<std::string> _name;
|
||||
Session* _session;
|
||||
sampleoffset_t _current_delta;
|
||||
bool _pending_collect;
|
||||
bool _removeable;
|
||||
protected:
|
||||
SyncSource _type;
|
||||
PBD::Property<std::string> _name;
|
||||
Session* _session;
|
||||
sampleoffset_t _current_delta;
|
||||
bool _pending_collect;
|
||||
bool _removeable;
|
||||
PBD::Property<TransportRequestType> _request_mask; /* lists transport requests still accepted when we're in control */
|
||||
PBD::Property<bool> _sclock_synced;
|
||||
PBD::Property<bool> _collect;
|
||||
PBD::Property<bool> _connected;
|
||||
PBD::Property<bool> _sclock_synced;
|
||||
PBD::Property<bool> _collect;
|
||||
PBD::Property<bool> _connected;
|
||||
|
||||
SafeTime current;
|
||||
|
||||
/* DLL - chase incoming data */
|
||||
|
||||
int transport_direction;
|
||||
int dll_initstate;
|
||||
int transport_direction;
|
||||
int dll_initstate;
|
||||
|
||||
double t0;
|
||||
double t1;
|
||||
double e2;
|
||||
double b, c;
|
||||
|
||||
boost::shared_ptr<Port> _port;
|
||||
boost::shared_ptr<Port> _port;
|
||||
|
||||
XMLNode port_node;
|
||||
|
||||
PBD::ScopedConnection port_connection;
|
||||
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
||||
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
||||
|
||||
PBD::ScopedConnection backend_connection;
|
||||
|
||||
|
|
@ -402,39 +454,48 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
|
|||
/** a helper class for any TransportMaster that receives its input via a MIDI
|
||||
* port
|
||||
*/
|
||||
class LIBARDOUR_API TransportMasterViaMIDI {
|
||||
public:
|
||||
boost::shared_ptr<MidiPort> midi_port() const { return _midi_port; }
|
||||
boost::shared_ptr<Port> create_midi_port (std::string const & port_name);
|
||||
class LIBARDOUR_API TransportMasterViaMIDI
|
||||
{
|
||||
public:
|
||||
boost::shared_ptr<MidiPort> midi_port () const
|
||||
{
|
||||
return _midi_port;
|
||||
}
|
||||
boost::shared_ptr<Port> create_midi_port (std::string const& port_name);
|
||||
|
||||
protected:
|
||||
TransportMasterViaMIDI () {};
|
||||
protected:
|
||||
TransportMasterViaMIDI (){};
|
||||
|
||||
MIDI::Parser parser;
|
||||
MIDI::Parser parser;
|
||||
boost::shared_ptr<MidiPort> _midi_port;
|
||||
};
|
||||
|
||||
class LIBARDOUR_API TimecodeTransportMaster : public TransportMaster {
|
||||
public:
|
||||
TimecodeTransportMaster (std::string const & name, SyncSource type);
|
||||
class LIBARDOUR_API TimecodeTransportMaster : public TransportMaster
|
||||
{
|
||||
public:
|
||||
TimecodeTransportMaster (std::string const& name, SyncSource type);
|
||||
|
||||
virtual Timecode::TimecodeFormat apparent_timecode_format() const = 0;
|
||||
samplepos_t timecode_offset;
|
||||
bool timecode_negative_offset;
|
||||
virtual Timecode::TimecodeFormat apparent_timecode_format () const = 0;
|
||||
samplepos_t timecode_offset;
|
||||
bool timecode_negative_offset;
|
||||
|
||||
bool fr2997() const { return _fr2997; }
|
||||
bool fr2997 () const
|
||||
{
|
||||
return _fr2997;
|
||||
}
|
||||
void set_fr2997 (bool);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void register_properties ();
|
||||
|
||||
private:
|
||||
private:
|
||||
PBD::Property<bool> _fr2997;
|
||||
};
|
||||
|
||||
class LIBARDOUR_API MTC_TransportMaster : public TimecodeTransportMaster, public TransportMasterViaMIDI {
|
||||
public:
|
||||
MTC_TransportMaster (std::string const &);
|
||||
class LIBARDOUR_API MTC_TransportMaster : public TimecodeTransportMaster, public TransportMasterViaMIDI
|
||||
{
|
||||
public:
|
||||
MTC_TransportMaster (std::string const&);
|
||||
~MTC_TransportMaster ();
|
||||
|
||||
void set_session (Session*);
|
||||
|
|
@ -444,71 +505,75 @@ class LIBARDOUR_API MTC_TransportMaster : public TimecodeTransportMaster, public
|
|||
void unregister_port ();
|
||||
|
||||
void reset (bool with_pos);
|
||||
bool locked() const;
|
||||
bool ok() const;
|
||||
bool locked () const;
|
||||
bool ok () const;
|
||||
void handle_locate (const MIDI::byte*);
|
||||
|
||||
samplecnt_t update_interval () const;
|
||||
samplecnt_t resolution () const;
|
||||
bool requires_seekahead () const { return false; }
|
||||
samplecnt_t seekahead_distance() const;
|
||||
void init ();
|
||||
bool requires_seekahead () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
samplecnt_t seekahead_distance () const;
|
||||
void init ();
|
||||
|
||||
Timecode::TimecodeFormat apparent_timecode_format() const;
|
||||
std::string position_string() const;
|
||||
std::string delta_string() const;
|
||||
Timecode::TimecodeFormat apparent_timecode_format () const;
|
||||
std::string position_string () const;
|
||||
std::string delta_string () const;
|
||||
|
||||
void create_port ();
|
||||
|
||||
private:
|
||||
private:
|
||||
PBD::ScopedConnectionList port_connections;
|
||||
PBD::ScopedConnection config_connection;
|
||||
bool can_notify_on_unknown_rate;
|
||||
bool can_notify_on_unknown_rate;
|
||||
|
||||
static const int sample_tolerance;
|
||||
|
||||
samplepos_t mtc_frame; /* current time */
|
||||
double mtc_frame_dll;
|
||||
samplepos_t last_inbound_frame; /* when we got it; audio clocked */
|
||||
MIDI::byte last_mtc_fps_byte;
|
||||
samplepos_t window_begin;
|
||||
samplepos_t window_end;
|
||||
samplepos_t first_mtc_timestamp;
|
||||
bool did_reset_tc_format;
|
||||
samplepos_t mtc_frame; /* current time */
|
||||
double mtc_frame_dll;
|
||||
samplepos_t last_inbound_frame; /* when we got it; audio clocked */
|
||||
MIDI::byte last_mtc_fps_byte;
|
||||
samplepos_t window_begin;
|
||||
samplepos_t window_end;
|
||||
samplepos_t first_mtc_timestamp;
|
||||
bool did_reset_tc_format;
|
||||
Timecode::TimecodeFormat saved_tc_format;
|
||||
Glib::Threads::Mutex reset_lock;
|
||||
uint32_t reset_pending;
|
||||
bool reset_position;
|
||||
int transport_direction;
|
||||
int busy_guard1;
|
||||
int busy_guard2;
|
||||
Glib::Threads::Mutex reset_lock;
|
||||
uint32_t reset_pending;
|
||||
bool reset_position;
|
||||
int transport_direction;
|
||||
int busy_guard1;
|
||||
int busy_guard2;
|
||||
|
||||
double speedup_due_to_tc_mismatch;
|
||||
double quarter_frame_duration;
|
||||
double speedup_due_to_tc_mismatch;
|
||||
double quarter_frame_duration;
|
||||
Timecode::TimecodeFormat mtc_timecode;
|
||||
Timecode::TimecodeFormat a3e_timecode;
|
||||
Timecode::Time timecode;
|
||||
bool printed_timecode_warning;
|
||||
Timecode::Time timecode;
|
||||
bool printed_timecode_warning;
|
||||
|
||||
void queue_reset (bool with_pos);
|
||||
void maybe_reset ();
|
||||
|
||||
void update_mtc_qtr (MIDI::Parser&, int, samplepos_t);
|
||||
void update_mtc_time (const MIDI::byte *, bool, samplepos_t);
|
||||
void update_mtc_time (const MIDI::byte*, bool, samplepos_t);
|
||||
void update_mtc_status (MIDI::MTC_Status);
|
||||
void reset_window (samplepos_t);
|
||||
bool outside_window (samplepos_t) const;
|
||||
void init_mtc_dll(samplepos_t, double);
|
||||
void parse_timecode_offset();
|
||||
void parameter_changed(std::string const & p);
|
||||
void init_mtc_dll (samplepos_t, double);
|
||||
void parse_timecode_offset ();
|
||||
void parameter_changed (std::string const& p);
|
||||
|
||||
void resync_latency();
|
||||
LatencyRange mtc_slave_latency;
|
||||
void resync_latency ();
|
||||
LatencyRange mtc_slave_latency;
|
||||
};
|
||||
|
||||
class LIBARDOUR_API LTC_TransportMaster : public TimecodeTransportMaster {
|
||||
class LIBARDOUR_API LTC_TransportMaster : public TimecodeTransportMaster
|
||||
{
|
||||
public:
|
||||
LTC_TransportMaster (std::string const &);
|
||||
LTC_TransportMaster (std::string const&);
|
||||
~LTC_TransportMaster ();
|
||||
|
||||
void set_session (Session*);
|
||||
|
|
@ -516,62 +581,69 @@ public:
|
|||
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
|
||||
|
||||
void reset (bool with_pos);
|
||||
bool locked() const;
|
||||
bool ok() const;
|
||||
bool locked () const;
|
||||
bool ok () const;
|
||||
|
||||
samplecnt_t update_interval () const;
|
||||
samplecnt_t resolution () const;
|
||||
bool requires_seekahead () const { return false; }
|
||||
samplecnt_t seekahead_distance () const { return 0; }
|
||||
bool requires_seekahead () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
samplecnt_t seekahead_distance () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void init ();
|
||||
|
||||
Timecode::TimecodeFormat apparent_timecode_format() const;
|
||||
std::string position_string() const;
|
||||
std::string delta_string() const;
|
||||
Timecode::TimecodeFormat apparent_timecode_format () const;
|
||||
std::string position_string () const;
|
||||
std::string delta_string () const;
|
||||
|
||||
void create_port ();
|
||||
|
||||
private:
|
||||
void parse_ltc(const pframes_t, const Sample* const, const samplecnt_t);
|
||||
void process_ltc(samplepos_t const);
|
||||
private:
|
||||
void parse_ltc (const pframes_t, const Sample* const, const samplecnt_t);
|
||||
void process_ltc (samplepos_t const);
|
||||
void init_dll (samplepos_t, int32_t);
|
||||
bool detect_discontinuity(LTCFrameExt *, int, bool);
|
||||
bool detect_ltc_fps(int, bool);
|
||||
bool equal_ltc_sample_time(LTCFrame *a, LTCFrame *b);
|
||||
void resync_xrun();
|
||||
void resync_latency();
|
||||
void parse_timecode_offset();
|
||||
void parameter_changed(std::string const & p);
|
||||
bool detect_discontinuity (LTCFrameExt*, int, bool);
|
||||
bool detect_ltc_fps (int, bool);
|
||||
bool equal_ltc_sample_time (LTCFrame* a, LTCFrame* b);
|
||||
void resync_xrun ();
|
||||
void resync_latency ();
|
||||
void parse_timecode_offset ();
|
||||
void parameter_changed (std::string const& p);
|
||||
|
||||
bool did_reset_tc_format;
|
||||
bool did_reset_tc_format;
|
||||
Timecode::TimecodeFormat saved_tc_format;
|
||||
|
||||
LTCDecoder * decoder;
|
||||
LTCDecoder* decoder;
|
||||
double samples_per_ltc_frame;
|
||||
Timecode::Time timecode;
|
||||
LTCFrameExt prev_frame;
|
||||
bool fps_detected;
|
||||
|
||||
samplecnt_t monotonic_cnt;
|
||||
uint64_t frames_since_reset;
|
||||
int delayedlocked;
|
||||
samplecnt_t monotonic_cnt;
|
||||
uint64_t frames_since_reset;
|
||||
int delayedlocked;
|
||||
|
||||
int ltc_detect_fps_cnt;
|
||||
int ltc_detect_fps_max;
|
||||
bool printed_timecode_warning;
|
||||
bool sync_lock_broken;
|
||||
int ltc_detect_fps_cnt;
|
||||
int ltc_detect_fps_max;
|
||||
bool printed_timecode_warning;
|
||||
bool sync_lock_broken;
|
||||
Timecode::TimecodeFormat ltc_timecode;
|
||||
Timecode::TimecodeFormat a3e_timecode;
|
||||
double samples_per_timecode_frame;
|
||||
double samples_per_timecode_frame;
|
||||
|
||||
PBD::ScopedConnectionList port_connections;
|
||||
PBD::ScopedConnection config_connection;
|
||||
LatencyRange ltc_slave_latency;
|
||||
LatencyRange ltc_slave_latency;
|
||||
};
|
||||
|
||||
class LIBARDOUR_API MIDIClock_TransportMaster : public TransportMaster, public TransportMasterViaMIDI {
|
||||
public:
|
||||
MIDIClock_TransportMaster (std::string const & name, int ppqn = 24);
|
||||
class LIBARDOUR_API MIDIClock_TransportMaster : public TransportMaster, public TransportMasterViaMIDI
|
||||
{
|
||||
public:
|
||||
MIDIClock_TransportMaster (std::string const& name, int ppqn = 24);
|
||||
|
||||
/// Constructor for unit tests
|
||||
~MIDIClock_TransportMaster ();
|
||||
|
|
@ -585,35 +657,41 @@ class LIBARDOUR_API MIDIClock_TransportMaster : public TransportMaster, public T
|
|||
void rebind (MidiPort&);
|
||||
|
||||
void reset (bool with_pos);
|
||||
bool locked() const;
|
||||
bool ok() const;
|
||||
bool locked () const;
|
||||
bool ok () const;
|
||||
|
||||
samplecnt_t update_interval () const;
|
||||
samplecnt_t resolution () const;
|
||||
bool requires_seekahead () const { return false; }
|
||||
bool requires_seekahead () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void init ();
|
||||
|
||||
std::string position_string() const;
|
||||
std::string delta_string() const;
|
||||
std::string position_string () const;
|
||||
std::string delta_string () const;
|
||||
|
||||
float bpm() const { return _bpm; }
|
||||
float bpm () const
|
||||
{
|
||||
return _bpm;
|
||||
}
|
||||
|
||||
void create_port ();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
PBD::ScopedConnectionList port_connections;
|
||||
|
||||
/// pulses per quarter note for one MIDI clock sample (default 24)
|
||||
int ppqn;
|
||||
int ppqn;
|
||||
|
||||
/// the duration of one ppqn in sample time
|
||||
double one_ppqn_in_samples;
|
||||
double one_ppqn_in_samples;
|
||||
|
||||
/// the timestamp of the first MIDI clock message
|
||||
samplepos_t first_timestamp;
|
||||
samplepos_t first_timestamp;
|
||||
|
||||
/// the time stamp and should-be transport position of the last inbound MIDI clock message
|
||||
samplepos_t last_timestamp;
|
||||
samplepos_t last_timestamp;
|
||||
double should_be_position;
|
||||
|
||||
/// the number of midi clock messages received (zero-based)
|
||||
|
|
@ -623,7 +701,7 @@ class LIBARDOUR_API MIDIClock_TransportMaster : public TransportMaster, public T
|
|||
/// a DLL to track MIDI clock
|
||||
|
||||
double _speed;
|
||||
bool _running;
|
||||
bool _running;
|
||||
double _bpm;
|
||||
|
||||
void start (MIDI::Parser& parser, samplepos_t timestamp);
|
||||
|
|
@ -631,44 +709,56 @@ class LIBARDOUR_API MIDIClock_TransportMaster : public TransportMaster, public T
|
|||
void stop (MIDI::Parser& parser, samplepos_t timestamp);
|
||||
void position (MIDI::Parser& parser, MIDI::byte* message, size_t size, samplepos_t timestamp);
|
||||
// we can't use continue because it is a C++ keyword
|
||||
void calculate_one_ppqn_in_samples_at(samplepos_t time);
|
||||
samplepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes);
|
||||
void calculate_filter_coefficients (double qpm);
|
||||
void update_midi_clock (MIDI::Parser& parser, samplepos_t timestamp);
|
||||
void calculate_one_ppqn_in_samples_at (samplepos_t time);
|
||||
samplepos_t calculate_song_position (uint16_t song_position_in_sixteenth_notes);
|
||||
void calculate_filter_coefficients (double qpm);
|
||||
void update_midi_clock (MIDI::Parser& parser, samplepos_t timestamp);
|
||||
};
|
||||
|
||||
class LIBARDOUR_API Engine_TransportMaster : public TransportMaster
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Engine_TransportMaster (AudioEngine&);
|
||||
~Engine_TransportMaster ();
|
||||
~Engine_TransportMaster ();
|
||||
|
||||
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
|
||||
bool speed_and_position (double& speed, samplepos_t& pos, samplepos_t &, samplepos_t &, samplepos_t);
|
||||
void pre_process (pframes_t nframes, samplepos_t now, boost::optional<samplepos_t>);
|
||||
bool speed_and_position (double& speed, samplepos_t& pos, samplepos_t&, samplepos_t&, samplepos_t);
|
||||
|
||||
bool starting() const { return _starting; }
|
||||
void reset (bool with_position);
|
||||
bool locked() const;
|
||||
bool ok() const;
|
||||
bool usable() const;
|
||||
bool starting () const
|
||||
{
|
||||
return _starting;
|
||||
}
|
||||
void reset (bool with_position);
|
||||
bool locked () const;
|
||||
bool ok () const;
|
||||
bool usable () const;
|
||||
samplecnt_t update_interval () const;
|
||||
samplecnt_t resolution () const { return 1; }
|
||||
bool requires_seekahead () const { return false; }
|
||||
bool sample_clock_synced() const { return true; }
|
||||
samplecnt_t resolution () const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
bool requires_seekahead () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool sample_clock_synced () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
void init ();
|
||||
void check_backend();
|
||||
void check_backend ();
|
||||
bool allow_request (TransportRequestSource, TransportRequestType) const;
|
||||
|
||||
std::string position_string() const;
|
||||
std::string delta_string() const;
|
||||
std::string position_string () const;
|
||||
std::string delta_string () const;
|
||||
|
||||
void create_port () { }
|
||||
void create_port () {}
|
||||
|
||||
private:
|
||||
AudioEngine& engine;
|
||||
bool _starting;
|
||||
private:
|
||||
AudioEngine& engine;
|
||||
bool _starting;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
}
|
||||
|
||||
#endif /* __ardour_transport_master_h__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue