22 #include <sys/types.h>
29 #include "ardour/debug.h"
35 #include <glibmm/timer.h>
52 const int MTC_Slave::frame_tolerance = 2;
114 Timecode::Time offset_tc;
115 Timecode::parse_timecode_format(
session.
config.get_slave_timecode_offset(), offset_tc);
125 if (p ==
"slave-timecode-offset"
126 || p ==
"timecode-format"
225 mtc[3] = mmc_tc[0] & 0xf;
240 error <<
_(
"MTC Slave: atomic read of current time failed, sleeping!") <<
endmsg;
254 b = 1.4142135623730950488 *
omega;
275 double mtc_speed = 0;
283 mtc_speed = (
t1 -
t0) / qtr_d;
313 TimecodeFormat tc_format;
314 bool reset_tc =
true;
333 tc_format = timecode_24;
339 tc_format = timecode_25;
342 case MTC_30_FPS_DROP:
343 if (
Config->get_timecode_source_2997()) {
344 tc_format = Timecode::timecode_2997000drop;
347 tc_format = timecode_2997drop;
357 tc_format = timecode_30;
362 error <<
string_compose (
_(
"Unknown rate/drop value %1 in incoming MTC stream, session values used instead"),
373 TimecodeFormat cur_timecode =
session.
config.get_timecode_format();
374 if (
Config->get_timecode_sync_frame_rate()) {
380 if (cur_timecode != tc_format) {
381 if (ceil(Timecode::timecode_to_frames_per_second(cur_timecode)) != ceil(Timecode::timecode_to_frames_per_second(tc_format))) {
383 Timecode::timecode_format_name(cur_timecode),
384 Timecode::timecode_format_name(tc_format))
395 if (ceil(Timecode::timecode_to_frames_per_second(cur_timecode)) != ceil(Timecode::timecode_to_frames_per_second(tc_format))) {
397 Timecode::timecode_format_name(tc_format),
399 Timecode::timecode_format_name(cur_timecode))
447 long int mtc_off = (long) rint(7.0 * qtr);
572 be = 1.4142135623730950488 *
oe;
592 bool engine_dll_reinitialized =
false;
611 engine_dll_reinitialized =
true;
637 double speed_flt = last.
speed;
640 if (speed_flt == 0.0
f) {
654 const double e = double (last.
position + elapsed - sess_pos);
678 if (fabs (speed - 1.0) <= 0.001)
682 speed, pos, last.
position, elapsed, pos - sess_pos));
689 Timecode::TimecodeFormat
701 return " --:--:--:--";
703 return Timecode::timecode_format_sampletime(
717 snprintf(delta,
sizeof(delta),
"\u2012\u2012\u2012\u2012");
719 snprintf(delta,
sizeof(delta),
"\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64
"</span>sm",
722 return std::string(delta);
void parameter_changed(std::string const &p)
bool timecode_negative_offset
double timecode_frames_per_second() const
void read_current(SafeTime *) const
LIBPBD_API const char * pthread_name()
double te1
calculated sync time
bool actively_recording() const
pframes_t samples_per_cycle() const
double omega
DLL filter coefficients.
framepos_t last_inbound_frame
MIDI::Parser & self_parser()
Glib::Threads::Mutex reset_lock
Timecode::TimecodeFormat a3e_timecode
LIBPBD_API Transmitter error
LIBPBD_API Transmitter warning
double te0
time at the beginning of the engine process
framepos_t first_mtc_timestamp
std::ostream & endmsg(std::ostream &ostr)
SessionConfiguration config
double t0
time at the beginning of the MTC quater frame
void request_locate(framepos_t frame, bool with_roll=false)
framecnt_t frame_rate() const
bool speed_and_position(double &, framepos_t &)
void update_mtc_status(MIDI::MTC_Status)
void parse_timecode_offset()
framepos_t timecode_offset
double frames_per_timecode_frame() const
PBD::ScopedConnectionList port_connections
bool can_notify_on_unknown_rate
bool timecode_drop_frames() const
LIBARDOUR_API RCConfiguration * Config
bool outside_window(framepos_t) const
void update_mtc_time(const MIDI::byte *, bool, framepos_t)
PBD::ScopedConnection config_connection
framepos_t transport_frame() const
void request_transport_speed(double speed, bool as_default=false)
void reset(bool with_pos)
framepos_t sample_time_at_cycle_start()
#define DEBUG_TRACE(bits, str)
Timecode::TimecodeFormat saved_tc_format
std::string approximate_current_delta() const
double speedup_due_to_tc_mismatch
PBD::Signal1< void, std::string > ParameterChanged
static const int frame_tolerance
MIDI::byte get_mtc_timecode_bits() const
std::string approximate_current_position() const
bool give_slave_full_control_over_transport_speed() const
double quarter_frame_duration
void timecode_to_sample(Timecode::Time &timecode, framepos_t &sample, bool use_offset, bool use_subframes) const
frameoffset_t current_delta
LIBARDOUR_API uint64_t MTC
Timecode::TimecodeFormat apparent_timecode_format() const
MIDI::byte last_mtc_fps_byte
void init_mtc_dll(framepos_t, double)
double t1
calculated end of the MTC quater frame
double ee2
second order loop error
void init_engine_dll(framepos_t, framepos_t)
bool printed_timecode_warning
void update_mtc_qtr(MIDI::Parser &, int, framepos_t)
void queue_reset(bool with_pos)
void reset_window(framepos_t)
Timecode::TimecodeFormat mtc_timecode
void handle_locate(const MIDI::byte *)
double oe
DLL filter coefficients.
framecnt_t resolution() const
framecnt_t seekahead_distance() const
std::string string_compose(const std::string &fmt, const T1 &o1)
double e2
second order loop error