ardour
Public Member Functions | List of all members
ARDOUR::Slave Class Referenceabstract

The Slave interface can be used to sync ARDOURs tempo to an external source like MTC, MIDI Clock, etc. More...

#include <slave.h>

Inheritance diagram for ARDOUR::Slave:
ARDOUR::Engine_Slave ARDOUR::MIDIClock_Slave ARDOUR::TimecodeSlave ARDOUR::MIDIClock_SlaveTest ARDOUR::LTC_Slave ARDOUR::MTC_Slave

Public Member Functions

 Slave ()
 
virtual ~Slave ()
 
virtual bool speed_and_position (double &speed, framepos_t &position)=0
 
virtual bool locked () const =0
 
virtual bool ok () const =0
 
virtual bool starting () const
 
virtual framecnt_t resolution () const =0
 
virtual bool requires_seekahead () const =0
 
virtual framecnt_t seekahead_distance () const
 
virtual bool is_always_synced () const
 
virtual bool give_slave_full_control_over_transport_speed () const
 
virtual std::string approximate_current_delta () const
 

Detailed Description

The Slave interface can be used to sync ARDOURs tempo to an external source like MTC, MIDI Clock, etc.

The name of the interface may be a bit misleading: A subclass of Slave actually acts as a time master for ARDOUR, that means ARDOUR will try to follow the speed and transport position of the implementation of Slave. Therefore it is rather that class, that makes ARDOUR a slave by connecting it to its external time master.

Definition at line 62 of file slave.h.

Constructor & Destructor Documentation

ARDOUR::Slave::Slave ( )
inline

Definition at line 64 of file slave.h.

virtual ARDOUR::Slave::~Slave ( )
inlinevirtual

Definition at line 65 of file slave.h.

Member Function Documentation

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

Reimplemented in ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

Definition at line 178 of file slave.h.

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

Reimplemented in ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

Definition at line 173 of file slave.h.

virtual bool ARDOUR::Slave::is_always_synced ( ) const
inlinevirtual
Returns
- when returning true, ARDOUR will use transport speed 1.0 no matter what the slave returns

Reimplemented in ARDOUR::Engine_Slave.

Definition at line 168 of file slave.h.

virtual bool ARDOUR::Slave::locked ( ) const
pure virtual

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

Returns
- when returning false, the transport will stop rolling

Implemented in ARDOUR::Engine_Slave, ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

virtual bool ARDOUR::Slave::ok ( ) const
pure 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.

Implemented in ARDOUR::Engine_Slave, ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

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

Implemented in ARDOUR::Engine_Slave, ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

virtual framecnt_t ARDOUR::Slave::resolution ( ) const
pure 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

Implemented in ARDOUR::Engine_Slave, ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

virtual framecnt_t ARDOUR::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 in ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

Definition at line 162 of file slave.h.

virtual bool ARDOUR::Slave::speed_and_position ( double &  speed,
framepos_t position 
)
pure 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)

Implemented in ARDOUR::Engine_Slave, ARDOUR::MIDIClock_Slave, ARDOUR::LTC_Slave, and ARDOUR::MTC_Slave.

virtual bool ARDOUR::Slave::starting ( ) const
inlinevirtual

reports to ARDOUR whether the slave is in the process of starting to roll

Returns
- when returning false, transport will not move until this method returns true

Reimplemented in ARDOUR::Engine_Slave, and ARDOUR::MIDIClock_Slave.

Definition at line 143 of file slave.h.


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