summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_clock_slave.cc
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2013-04-05 12:33:58 +0700
committerHans Baier <hansfbaier@googlemail.com>2013-04-05 12:33:58 +0700
commit5308c31767c4bf3b1022dff20e20bfff25ad9ba1 (patch)
treea9b6718eb1205cdc07f4f98d3265b952e293fe77 /libs/ardour/midi_clock_slave.cc
parent985e3dcc50fc7dd66a258ae0758956a1fff8f3bd (diff)
make MIDI clock work once more:
* increase filter bandwith to make it sync faster * use transport_frame instead of audible_frame for calculating the loop error (thanks robin!) * reduce the deadzone to 0.1% (thanks robin)
Diffstat (limited to 'libs/ardour/midi_clock_slave.cc')
-rw-r--r--libs/ardour/midi_clock_slave.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc
index 53dd186384..2df440ae11 100644
--- a/libs/ardour/midi_clock_slave.cc
+++ b/libs/ardour/midi_clock_slave.cc
@@ -43,7 +43,7 @@ using namespace PBD;
MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn)
: ppqn (ppqn)
- , bandwidth (1.0 / 60.0) // 1 BpM = 1 / 60 Hz
+ , bandwidth (10.0 / 60.0) // 1 BpM = 1 / 60 Hz
{
session = (ISlaveSessionProxy *) new SlaveSessionProxy(s);
rebind (p);
@@ -53,7 +53,7 @@ MIDIClock_Slave::MIDIClock_Slave (Session& s, MIDI::Port& p, int ppqn)
MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn)
: session(session_proxy)
, ppqn (ppqn)
- , bandwidth (1.0 / 60.0) // 1 BpM = 1 / 60 Hz
+ , bandwidth (10.0 / 60.0) // 1 BpM = 1 / 60 Hz
{
reset ();
}
@@ -149,10 +149,10 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp)
calculate_filter_coefficients();
// calculate loop error
- // we use session->audible_frame() instead of t1 here
+ // we use session->transport_frame() instead of t1 here
// because t1 is used to calculate the transport speed,
// so the loop will compensate for accumulating rounding errors
- error = (double(should_be_position) - double(session->audible_frame()));
+ error = (double(should_be_position) - double(session->transport_frame()));
e = error / double(session->frame_rate());
// update DLL
@@ -328,8 +328,8 @@ MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos)
// calculate speed
speed = ((t1 - t0) * session->frame_rate()) / one_ppqn_in_frames;
- // provide a 3% deadzone to lock the speed
- if (fabs(speed - 1.0) <= 0.03)
+ // provide a 0.1% deadzone to lock the speed
+ if (fabs(speed - 1.0) <= 0.001)
speed = 1.0;
// calculate position