diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-08-06 22:57:45 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-08-06 22:57:45 +0000 |
commit | e5dc9734eb16f7744038e98ef7a996e10e584309 (patch) | |
tree | e7ee407026f3728fdb2a12fc9312908005093bbd /libs/ardour/midi_clock_slave.cc | |
parent | 8164a0992d005659fe4cce1dce12f6464438f371 (diff) |
* removed rolling speed average from MIDIClockSlave, ardour seems to keep time now
git-svn-id: svn://localhost/ardour2/branches/3.0@3663 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_clock_slave.cc')
-rw-r--r-- | libs/ardour/midi_clock_slave.cc | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 569f14eeb5..f7810f36d0 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -131,7 +131,13 @@ MIDIClock_Slave::stop (Parser& parser) std::cerr << "MIDIClock_Slave got stop message" << endl; midi_clock_speed = 0.0f; + midi_clock_frame = 0; _started = false; + + current.guard1++; + current.position = midi_clock_frame; + current.timestamp = 0; + current.guard2++; } void @@ -168,6 +174,11 @@ MIDIClock_Slave::speed_and_position (float& speed, nframes_t& pos) { //std::cerr << "MIDIClock_Slave speed and position() called" << endl; + if(_started == false) { + speed = 0.0; + pos = 0; + } + nframes_t now = session.engine().frame_time(); nframes_t frame_rate = session.frame_rate(); nframes_t elapsed; @@ -198,27 +209,7 @@ MIDIClock_Slave::speed_and_position (float& speed, nframes_t& pos) cerr << "speed_and_position: speed_now: " << speed_now ; - accumulator[accumulator_index++] = speed_now; - - if (accumulator_index >= accumulator_size) { - have_first_accumulated_speed = true; - accumulator_index = 0; - } - - if (have_first_accumulated_speed) { - float total = 0; - - for (int32_t i = 0; i < accumulator_size; ++i) { - total += accumulator[i]; - } - - midi_clock_speed = total / accumulator_size; - - } else { - - midi_clock_speed = speed_now; - - } + midi_clock_speed = speed_now; if (midi_clock_speed == 0.0f) { |