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);
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
{
//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;
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) {