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

#include <slave.h>

Inheritance diagram for ARDOUR::Engine_Slave:
ARDOUR::Slave

Public Member Functions

 Engine_Slave (AudioEngine &)
 
 ~Engine_Slave ()
 
bool speed_and_position (double &speed, framepos_t &pos)
 
bool starting () const
 
bool locked () const
 
bool ok () const
 
framecnt_t resolution () const
 
bool requires_seekahead () const
 
bool is_always_synced () const
 
- Public Member Functions inherited from ARDOUR::Slave
 Slave ()
 
virtual ~Slave ()
 
virtual framecnt_t seekahead_distance () const
 
virtual bool give_slave_full_control_over_transport_speed () const
 
virtual std::string approximate_current_delta () const
 

Private Attributes

AudioEngineengine
 
bool _starting
 

Detailed Description

Definition at line 494 of file slave.h.

Constructor & Destructor Documentation

Engine_Slave::Engine_Slave ( AudioEngine e)

Definition at line 30 of file engine_slave.cc.

Engine_Slave::~Engine_Slave ( )

Definition at line 39 of file engine_slave.cc.

Member Function Documentation

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

Reimplemented from ARDOUR::Slave.

Definition at line 507 of file slave.h.

bool Engine_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 44 of file engine_slave.cc.

bool Engine_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 50 of file engine_slave.cc.

bool ARDOUR::Engine_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 506 of file slave.h.

framecnt_t ARDOUR::Engine_Slave::resolution ( ) const
inlinevirtual
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 505 of file slave.h.

bool Engine_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 56 of file engine_slave.cc.

bool ARDOUR::Engine_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 from ARDOUR::Slave.

Definition at line 502 of file slave.h.

Member Data Documentation

bool ARDOUR::Engine_Slave::_starting
private

Definition at line 511 of file slave.h.

AudioEngine& ARDOUR::Engine_Slave::engine
private

Definition at line 510 of file slave.h.


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