summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/slave.h
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2012-10-10 14:03:15 +0000
committerRobin Gareus <robin@gareus.org>2012-10-10 14:03:15 +0000
commita2b412803543e8892565bb96ccc091058a4f941f (patch)
tree30a70c5d4e7bd1238b3c0eb1d4cebd267211d288 /libs/ardour/ardour/slave.h
parent62ce39de7e971ec2b2b37e2e639ad0367fa49056 (diff)
fix and improve MTC-slave
- MTC-speed average (MIDI thread) * base timing on quarter-frames * replace hann-window average with a DLL - MTC/engine alignment * replace 1st order PI-controller with 2nd order DLL The 2nd DLL is needed because the jack-process callback effectively quantizes the transport-speed to integer audio-frames (speed * nframes). This leaves a delta on every cycle because the remainder from previous cycles is not compensated for. Theoretically it is possible to merge the two DLLs into one. However, with callbacks coming from by two independent threads it is cleaner to track the MTC and JACK engine-alignment speeds independently. git-svn-id: svn://localhost/ardour2/branches/3.0@13226 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/slave.h')
-rw-r--r--libs/ardour/ardour/slave.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h
index 1602b8bc8e..be6b966560 100644
--- a/libs/ardour/ardour/slave.h
+++ b/libs/ardour/ardour/slave.h
@@ -32,8 +32,6 @@
#include "midi++/parser.h"
#include "midi++/types.h"
-class PIChaser;
-
namespace MIDI {
class Port;
}
@@ -243,7 +241,6 @@ class MTC_Slave : public Slave {
MIDI::Port* port;
PBD::ScopedConnectionList port_connections;
bool can_notify_on_unknown_rate;
- PIChaser* pic;
static const int frame_tolerance;
@@ -253,18 +250,28 @@ class MTC_Slave : public Slave {
MIDI::byte last_mtc_fps_byte;
framepos_t window_begin;
framepos_t window_end;
- framepos_t last_mtc_timestamp;
- framepos_t last_mtc_frame;
+ framepos_t first_mtc_timestamp;
bool did_reset_tc_format;
TimecodeFormat saved_tc_format;
- size_t speed_accumulator_size;
- double* speed_accumulator;
- size_t speed_accumulator_cnt;
- bool have_first_speed_accumulator;
- double average_speed;
Glib::Threads::Mutex reset_lock;
uint32_t reset_pending;
bool reset_position;
+ int transport_direction;
+ int busy_guard1;
+ int busy_guard2;
+
+ /* DLL - chase MTC */
+ double t0; ///< time at the beginning of the MTC quater frame
+ double t1; ///< calculated end of the MTC quater frame
+ double e2; ///< second order loop error
+ double b, c, omega; ///< DLL filter coefficients
+
+ /* DLL - sync engine */
+ int engine_dll_initstate;
+ double te0; ///< time at the beginning of the engine process
+ double te1; ///< calculated sync time
+ double ee2; ///< second order loop error
+ double be, ce, oe; ///< DLL filter coefficients
void reset (bool with_pos);
void queue_reset (bool with_pos);
@@ -276,7 +283,8 @@ class MTC_Slave : public Slave {
void read_current (SafeTime *) const;
void reset_window (framepos_t);
bool outside_window (framepos_t) const;
- void process_apparent_speed (double);
+ void init_mtc_dll(framepos_t, double);
+ void init_engine_dll (framepos_t, framepos_t);
};
class MIDIClock_Slave : public Slave {