25 #include <glibmm/threads.h>
26 #include <glibmm/timer.h>
109 guard1.fetch_add (1, std::memory_order_acquire);
113 guard2.fetch_add (1, std::memory_order_acquire);
122 std::cerr <<
"SafeTime: atomic read of current time failed, sleeping!" << std::endl;
126 dst.
guard1.store (guard1.load (std::memory_order_seq_cst), std::memory_order_seq_cst);
130 dst.
guard2.store (guard2.load (std::memory_order_seq_cst), std::memory_order_seq_cst);
133 }
while (dst.
guard1.load (std::memory_order_seq_cst) != dst.
guard2.load (std::memory_order_seq_cst));
152 static std::shared_ptr<TransportMaster>
factory (
SyncSource, std::string
const&,
bool removeable);
214 virtual void reset (
bool with_position) = 0;
230 virtual bool ok ()
const = 0;
292 return _sclock_synced;
306 return _current_delta;
327 return loop_location () != 0;
363 std::shared_ptr<Port>
port ()
const
387 return _request_mask;
438 virtual void connection_handler (std::weak_ptr<ARDOUR::Port>, std::string name1, std::weak_ptr<ARDOUR::Port>, std::string name2,
bool yn);
488 return timecode_format_valid;
577 void connection_handler (std::weak_ptr<ARDOUR::Port>, std::string, std::weak_ptr<ARDOUR::Port>, std::string,
bool);
624 void connection_handler (std::weak_ptr<ARDOUR::Port>, std::string, std::weak_ptr<ARDOUR::Port>, std::string,
bool);
649 double a1, a2, b0, b1, b2;
731 void connection_handler (std::weak_ptr<ARDOUR::Port>, std::string, std::weak_ptr<ARDOUR::Port>, std::string,
bool);
bool requires_seekahead() const
samplecnt_t update_interval() const
~Engine_TransportMaster()
void reset(bool with_position)
std::string delta_string() const
void pre_process(pframes_t nframes, samplepos_t now, std::optional< samplepos_t >)
std::string position_string() const
Engine_TransportMaster(AudioEngine &)
samplecnt_t resolution() const
bool speed_and_position(double &speed, samplepos_t &pos, samplepos_t &, samplepos_t &, samplepos_t)
bool sample_clock_synced() const
bool allow_request(TransportRequestSource, TransportRequestType) const
uint64_t frames_since_reset
void init_dll(samplepos_t, int32_t)
void connection_handler(std::weak_ptr< ARDOUR::Port >, std::string, std::weak_ptr< ARDOUR::Port >, std::string, bool)
bool requires_seekahead() const
std::string position_string() const
void set_session(Session *)
samplecnt_t monotonic_cnt
Timecode::TimecodeFormat apparent_timecode_format() const
void set_sample_clock_synced(bool)
PBD::ScopedConnectionList session_connections
void parse_ltc(const pframes_t, Sample const *, samplecnt_t)
void pre_process(pframes_t nframes, samplepos_t now, std::optional< samplepos_t >)
samplecnt_t seekahead_distance() const
void process_ltc(samplepos_t const)
LatencyRange ltc_slave_latency
bool detect_ltc_fps(int, bool)
void resync_latency(bool)
PBD::ScopedConnection port_connection
LTC_TransportMaster(std::string const &)
samplecnt_t update_interval() const
samplecnt_t resolution() const
double samples_per_timecode_frame
void reset(bool with_pos)
std::string delta_string() const
void parse_timecode_offset()
bool detect_discontinuity(LTCFrameExt *, int, bool)
bool equal_ltc_sample_time(LTCFrame *a, LTCFrame *b)
double samples_per_ltc_frame
void parameter_changed(std::string const &p)
PBD::ScopedConnectionList port_connections
~MIDIClock_TransportMaster()
Constructor for unit tests.
void calculate_filter_coefficients(double qpm)
void set_session(Session *)
samplecnt_t update_interval() const
void reset(bool with_pos)
samplepos_t last_timestamp
the time stamp and should-be transport position of the last inbound MIDI clock message
void position(MIDI::Parser &parser, MIDI::byte *message, size_t size, 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 connection_handler(std::weak_ptr< ARDOUR::Port >, std::string, std::weak_ptr< ARDOUR::Port >, std::string, bool)
double one_ppqn_in_samples
the duration of one ppqn in sample time
std::string position_string() const
double should_be_position
samplecnt_t resolution() const
samplepos_t first_timestamp
the timestamp of the first MIDI clock message
void start(MIDI::Parser &parser, samplepos_t timestamp)
double _speed
a DLL to track MIDI clock
void update_midi_clock(MIDI::Parser &parser, samplepos_t timestamp)
void contineu(MIDI::Parser &parser, samplepos_t timestamp)
void stop(MIDI::Parser &parser, samplepos_t timestamp)
std::string delta_string() const
int ppqn
pulses per quarter note for one MIDI clock sample (default 24)
MIDIClock_TransportMaster(std::string const &name, int ppqn=24)
bool requires_seekahead() const
void pre_process(pframes_t nframes, samplepos_t now, std::optional< samplepos_t >)
double quarter_frame_duration
void reset_window(samplepos_t)
void update_mtc_time(const MIDI::byte *, bool, samplepos_t)
void parse_timecode_offset()
samplecnt_t resolution() const
void reset(bool with_pos)
MIDI::byte last_mtc_fps_byte
samplepos_t first_mtc_timestamp
void init_mtc_dll(samplepos_t, double)
void handle_locate(const MIDI::byte *)
bool can_notify_on_unknown_rate
bool outside_window(samplepos_t) const
void set_session(Session *)
PBD::ScopedConnectionList port_connections
std::string position_string() const
Timecode::TimecodeFormat apparent_timecode_format() const
samplepos_t last_inbound_frame
void update_mtc_status(MIDI::MTC_Status)
void parameter_changed(std::string const &p)
void queue_reset(bool with_pos)
void connection_handler(std::weak_ptr< ARDOUR::Port >, std::string, std::weak_ptr< ARDOUR::Port >, std::string, bool)
MTC_TransportMaster(std::string const &)
samplecnt_t seekahead_distance() const
std::string delta_string() const
Timecode::TimecodeFormat mtc_timecode
Glib::Threads::Mutex reset_lock
void update_mtc_qtr(MIDI::Parser &, int, samplepos_t)
samplecnt_t update_interval() const
static const int sample_tolerance
void pre_process(pframes_t nframes, samplepos_t now, std::optional< samplepos_t >)
bool requires_seekahead() const
bool apparent_timecode_format_valid() const
void register_properties()
samplepos_t timecode_offset
PBD::Property< bool > _fr2997
bool timecode_format_valid
virtual Timecode::TimecodeFormat apparent_timecode_format() const =0
bool timecode_negative_offset
TimecodeTransportMaster(std::string const &name, SyncSource type)
std::shared_ptr< MidiPort > midi_port() const
std::shared_ptr< Port > create_midi_port(std::string const &port_name)
void resync_latency(bool)
virtual void set_session(Session *)
virtual ~TransportMasterViaMIDI()
PBD::ScopedConnectionList session_connections
MIDI::Parser & transport_parser()
LatencyRange midi_port_latency
std::shared_ptr< MidiPort > _midi_port
virtual void parameter_changed(std::string const &p)
The TransportMaster interface can be used to sync ARDOURs tempo to an external source like MTC,...
virtual std::string delta_string() const
virtual bool usable() const
std::shared_ptr< Port > port() const
PBD::Property< bool > _collect
static const std::string state_node_name
PBD::ScopedConnection backend_connection
virtual ~TransportMaster()
sampleoffset_t _current_delta
XMLNode & get_state() const
virtual bool speed_and_position(double &speed, samplepos_t &position, samplepos_t &lp, samplepos_t &when, samplepos_t now)
virtual samplecnt_t seekahead_distance() const
PBD::Property< bool > _connected
void connect_port_using_state()
PBD::Property< bool > _sclock_synced
sampleoffset_t current_delta() const
virtual bool starting() const
PBD::ScopedConnection port_connection
virtual std::string format_delta_time(sampleoffset_t) const
virtual void set_collect(bool)
std::string allowed_request_string() const
int set_state(XMLNode const &, int)
TransportRequestType request_mask() const
TransportMaster(SyncSource t, std::string const &name)
virtual bool requires_seekahead() const =0
TransportRequestSource request_type() const
void set_request_mask(TransportRequestType)
virtual void set_session(Session *)
virtual Location * loop_location() const
virtual bool allow_request(TransportRequestSource, TransportRequestType) const
virtual samplecnt_t update_interval() const =0
virtual bool locked() const =0
static void make_property_quarks()
static std::shared_ptr< TransportMaster > factory(XMLNode const &)
static std::shared_ptr< TransportMaster > factory(SyncSource, std::string const &, bool removeable)
virtual void pre_process(pframes_t nframes, samplepos_t now, std::optional< samplepos_t >)=0
virtual bool can_loop() const
virtual void create_port()=0
virtual bool sample_clock_synced() const
void set_name(std::string const &)
virtual void unregister_port()
PBD::Property< std::string > _name
virtual void connection_handler(std::weak_ptr< ARDOUR::Port >, std::string name1, std::weak_ptr< ARDOUR::Port >, std::string name2, bool yn)
virtual void reset(bool with_position)=0
virtual void set_sample_clock_synced(bool)
std::shared_ptr< Port > _port
virtual std::string position_string() const =0
PBD::Property< TransportRequestType > _request_mask
virtual void register_properties()
virtual samplecnt_t resolution() const =0
virtual bool ok() const =0
void set_removeable(bool yn)
virtual void check_backend()
std::string display_name(bool sh=true) const
GtkImageIconNameData name
libltc - en+decode linear timecode
PBD::PropertyDescriptor< bool > fr2997
PBD::PropertyDescriptor< bool > collect
PBD::PropertyDescriptor< bool > sclock_synced
PBD::PropertyDescriptor< bool > connected
PBD::PropertyDescriptor< ARDOUR::TransportRequestType > allowed_transport_requests
Temporal::samplecnt_t samplecnt_t
Temporal::sampleoffset_t sampleoffset_t
Temporal::samplepos_t samplepos_t
void safe_read(SafeTime &dst) const
void update(samplepos_t p, samplepos_t t, double s)
std::atomic< int > guard1
std::atomic< int > guard2