* 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
This commit is contained in:
Hans Baier 2008-08-06 22:57:45 +00:00
parent 8164a0992d
commit e5dc9734eb
2 changed files with 12 additions and 26 deletions

View file

@ -134,11 +134,6 @@ class MIDIClock_Slave : public Slave, public sigc::trackable {
nframes_t first_midi_clock_frame;
nframes_t first_midi_clock_time;
static const int32_t accumulator_size = 128;
float accumulator[accumulator_size];
int32_t accumulator_index;
bool have_first_accumulated_speed;
void reset ();
void start (MIDI::Parser& parser);
void stop (MIDI::Parser& parser);

View file

@ -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) {