ardour
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ARDOUR::LTC_Slave Class Reference

#include <slave.h>

Inheritance diagram for ARDOUR::LTC_Slave:
ARDOUR::TimecodeSlave ARDOUR::Slave

Public Member Functions

 LTC_Slave (Session &)
 
 ~LTC_Slave ()
 
bool speed_and_position (double &, framepos_t &)
 
bool locked () const
 
bool ok () const
 
framecnt_t resolution () const
 
bool requires_seekahead () const
 
framecnt_t seekahead_distance () const
 
bool give_slave_full_control_over_transport_speed () const
 
Timecode::TimecodeFormat apparent_timecode_format () const
 
std::string approximate_current_position () const
 
std::string approximate_current_delta () const
 
- Public Member Functions inherited from ARDOUR::TimecodeSlave
 TimecodeSlave ()
 
- Public Member Functions inherited from ARDOUR::Slave
 Slave ()
 
virtual ~Slave ()
 
virtual bool starting () const
 
virtual bool is_always_synced () const
 

Private Member Functions

void parse_ltc (const pframes_t, const Sample *const, const framecnt_t)
 
void process_ltc (framepos_t const)
 
void init_engine_dll (framepos_t, int32_t)
 
bool detect_discontinuity (LTCFrameExt *, int, bool)
 
bool detect_ltc_fps (int, bool)
 
bool equal_ltc_frame_time (LTCFrame *a, LTCFrame *b)
 
void reset ()
 
void resync_xrun ()
 
void resync_latency ()
 
void parse_timecode_offset ()
 
void parameter_changed (std::string const &p)
 

Private Attributes

Sessionsession
 
bool did_reset_tc_format
 
Timecode::TimecodeFormat saved_tc_format
 
LTCDecoder * decoder
 
double frames_per_ltc_frame
 
Timecode::Time timecode
 
LTCFrameExt prev_frame
 
bool fps_detected
 
framecnt_t monotonic_cnt
 
framecnt_t last_timestamp
 
framecnt_t last_ltc_frame
 
double ltc_speed
 
frameoffset_t current_delta
 
int delayedlocked
 
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
 
PBD::ScopedConnectionList port_connections
 
PBD::ScopedConnection config_connection
 
LatencyRange ltc_slave_latency
 
int transport_direction
 
int engine_dll_initstate
 
double t0
 time at the beginning of the MTC quater frame More...
 
double t1
 calculated end of the MTC quater frame More...
 
double e2
 second order loop error More...
 
double b
 
double c
 DLL filter coefficients. More...
 

Additional Inherited Members

- Public Attributes inherited from ARDOUR::TimecodeSlave
framepos_t timecode_offset
 
bool timecode_negative_offset
 

Detailed Description

Definition at line 339 of file slave.h.

Constructor & Destructor Documentation

LTC_Slave::LTC_Slave ( Session s)

Definition at line 44 of file ltc_slave.cc.

LTC_Slave::~LTC_Slave ( )

Definition at line 73 of file ltc_slave.cc.

Member Function Documentation

Timecode::TimecodeFormat LTC_Slave::apparent_timecode_format ( ) const
virtual

Implements ARDOUR::TimecodeSlave.

Definition at line 568 of file ltc_slave.cc.

std::string LTC_Slave::approximate_current_delta ( ) const
virtual
Returns
- current time-delta between engine and sync-source

Reimplemented from ARDOUR::Slave.

Definition at line 597 of file ltc_slave.cc.

std::string LTC_Slave::approximate_current_position ( ) const
virtual

Implements ARDOUR::TimecodeSlave.

Definition at line 588 of file ltc_slave.cc.

bool LTC_Slave::detect_discontinuity ( LTCFrameExt *  frame,
int  fps,
bool  fuzzy 
)
private

Definition at line 194 of file ltc_slave.cc.

bool LTC_Slave::detect_ltc_fps ( int  frameno,
bool  df 
)
private

Definition at line 219 of file ltc_slave.cc.

bool LTC_Slave::equal_ltc_frame_time ( LTCFrame *  a,
LTCFrame *  b 
)
private

Definition at line 177 of file ltc_slave.cc.

bool ARDOUR::LTC_Slave::give_slave_full_control_over_transport_speed ( ) const
inlinevirtual
Returns
- whether ARDOUR should use the slave speed without any adjustments

Reimplemented from ARDOUR::Slave.

Definition at line 352 of file slave.h.

void LTC_Slave::init_engine_dll ( framepos_t  pos,
int32_t  inc 
)
private

Definition at line 409 of file ltc_slave.cc.

bool LTC_Slave::locked ( ) const
virtual

reports to ARDOUR whether the Slave is currently synced to its external time source.

Returns
- when returning false, the transport will stop rolling

Implements ARDOUR::Slave.

Definition at line 112 of file ltc_slave.cc.

bool LTC_Slave::ok ( ) const
virtual

reports to ARDOUR whether the slave is in a sane state

Returns
- when returning false, the transport will be stopped and the slave disconnected from ARDOUR.

Implements ARDOUR::Slave.

Definition at line 118 of file ltc_slave.cc.

void LTC_Slave::parameter_changed ( std::string const &  p)
private

Definition at line 96 of file ltc_slave.cc.

void LTC_Slave::parse_ltc ( const pframes_t  nframes,
const Sample * const  in,
const framecnt_t  posinfo 
)
private

Definition at line 157 of file ltc_slave.cc.

void LTC_Slave::parse_timecode_offset ( )
private

Definition at line 86 of file ltc_slave.cc.

void LTC_Slave::process_ltc ( framepos_t const  )
private

< audio-frame corresponding to LTC frame

Definition at line 301 of file ltc_slave.cc.

bool ARDOUR::LTC_Slave::requires_seekahead ( ) const
inlinevirtual
Returns
- when returning true, ARDOUR will wait for seekahead_distance() before transport starts rolling

Implements ARDOUR::Slave.

Definition at line 350 of file slave.h.

void LTC_Slave::reset ( )
private

Definition at line 145 of file ltc_slave.cc.

ARDOUR::framecnt_t LTC_Slave::resolution ( ) const
virtual
Returns
- the timing resolution of the Slave - If the distance of ARDOURs transport to the slave becomes greater than the resolution, sound will stop

Implements ARDOUR::Slave.

Definition at line 106 of file ltc_slave.cc.

void LTC_Slave::resync_latency ( )
private

Definition at line 132 of file ltc_slave.cc.

void LTC_Slave::resync_xrun ( )
private

Definition at line 124 of file ltc_slave.cc.

framecnt_t ARDOUR::LTC_Slave::seekahead_distance ( ) const
inlinevirtual
Returns
the number of frames that this slave wants to seek ahead. Relevant only if requires_seekahead() returns true.

Reimplemented from ARDOUR::Slave.

Definition at line 351 of file slave.h.

bool LTC_Slave::speed_and_position ( double &  speed,
framepos_t position 
)
virtual

This is the most important function to implement: Each process cycle, Session::follow_slave will call this method. and after the method call they should

Session::follow_slave will then try to follow the given position using a delay locked loop (DLL), starting with the first given transport speed. If the values of speed and position contradict each other, ARDOUR will always follow the position and disregard the speed. Although, a correct speed is important so that ARDOUR can sync to the master time source quickly.

For background information on delay locked loops, see http://www.kokkinizita.net/papers/usingdll.pdf

The method has the following precondition:

  • Slave::ok() should return true, otherwise playback will stop immediately and the method will not be called
  • when the references speed and position are passed into the Slave they are uninitialized

After the method call the following postconditions should be met:

  • The first position value on transport start should be 0, otherwise ARDOUR will try to locate to the new position rather than move to it
  • the references speed and position should be assigned to the Slaves current requested transport speed and transport position.
  • Slave::resolution() should be greater than the maximum distance of ARDOURs transport position to the slaves requested transport position.
  • Slave::locked() should return true, otherwise Session::no_roll will be called
  • Slave::starting() should be false, otherwise the transport will not move until it becomes true *
Parameters
speed- The transport speed requested
position- The transport position requested
Returns
- The return value is currently ignored (see Session::follow_slave)

Implements ARDOUR::Slave.

Definition at line 426 of file ltc_slave.cc.

Member Data Documentation

Timecode::TimecodeFormat ARDOUR::LTC_Slave::a3e_timecode
private

Definition at line 393 of file slave.h.

double ARDOUR::LTC_Slave::b
private

Definition at line 405 of file slave.h.

double ARDOUR::LTC_Slave::c
private

DLL filter coefficients.

Definition at line 405 of file slave.h.

PBD::ScopedConnection ARDOUR::LTC_Slave::config_connection
private

Definition at line 396 of file slave.h.

frameoffset_t ARDOUR::LTC_Slave::current_delta
private

Definition at line 385 of file slave.h.

LTCDecoder* ARDOUR::LTC_Slave::decoder
private

Definition at line 375 of file slave.h.

int ARDOUR::LTC_Slave::delayedlocked
private

Definition at line 386 of file slave.h.

bool ARDOUR::LTC_Slave::did_reset_tc_format
private

Definition at line 372 of file slave.h.

double ARDOUR::LTC_Slave::e2
private

second order loop error

Definition at line 404 of file slave.h.

int ARDOUR::LTC_Slave::engine_dll_initstate
private

Definition at line 401 of file slave.h.

bool ARDOUR::LTC_Slave::fps_detected
private

Definition at line 379 of file slave.h.

double ARDOUR::LTC_Slave::frames_per_ltc_frame
private

Definition at line 376 of file slave.h.

framecnt_t ARDOUR::LTC_Slave::last_ltc_frame
private

Definition at line 383 of file slave.h.

framecnt_t ARDOUR::LTC_Slave::last_timestamp
private

Definition at line 382 of file slave.h.

int ARDOUR::LTC_Slave::ltc_detect_fps_cnt
private

Definition at line 388 of file slave.h.

int ARDOUR::LTC_Slave::ltc_detect_fps_max
private

Definition at line 389 of file slave.h.

LatencyRange ARDOUR::LTC_Slave::ltc_slave_latency
private

Definition at line 397 of file slave.h.

double ARDOUR::LTC_Slave::ltc_speed
private

Definition at line 384 of file slave.h.

Timecode::TimecodeFormat ARDOUR::LTC_Slave::ltc_timecode
private

Definition at line 392 of file slave.h.

framecnt_t ARDOUR::LTC_Slave::monotonic_cnt
private

Definition at line 381 of file slave.h.

PBD::ScopedConnectionList ARDOUR::LTC_Slave::port_connections
private

Definition at line 395 of file slave.h.

LTCFrameExt ARDOUR::LTC_Slave::prev_frame
private

Definition at line 378 of file slave.h.

bool ARDOUR::LTC_Slave::printed_timecode_warning
private

Definition at line 390 of file slave.h.

Timecode::TimecodeFormat ARDOUR::LTC_Slave::saved_tc_format
private

Definition at line 373 of file slave.h.

Session& ARDOUR::LTC_Slave::session
private

Definition at line 371 of file slave.h.

bool ARDOUR::LTC_Slave::sync_lock_broken
private

Definition at line 391 of file slave.h.

double ARDOUR::LTC_Slave::t0
private

time at the beginning of the MTC quater frame

Definition at line 402 of file slave.h.

double ARDOUR::LTC_Slave::t1
private

calculated end of the MTC quater frame

Definition at line 403 of file slave.h.

Timecode::Time ARDOUR::LTC_Slave::timecode
private

Definition at line 377 of file slave.h.

int ARDOUR::LTC_Slave::transport_direction
private

Definition at line 400 of file slave.h.


The documentation for this class was generated from the following files: