diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2009-01-09 09:18:24 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2009-01-09 09:18:24 +0000 |
commit | 799b6ec97d2dea160ae11326fda8f50ae6c34faf (patch) | |
tree | 245d54368fd59c843ace28193fee1d7dcfd22a17 /libs/ardour/midi_clock_slave.cc | |
parent | 3f662b9f9dd317b27b273b6d796d0e72606ff346 (diff) |
* changed transport speed in session and slaves from float to double
* added some comments
git-svn-id: svn://localhost/ardour2/branches/3.0@4394 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_clock_slave.cc')
-rw-r--r-- | libs/ardour/midi_clock_slave.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index ec5dc3e5c9..f1ec1ad924 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -133,8 +133,8 @@ MIDIClock_Slave::update_midi_clock (Parser& parser, nframes_t timestamp) // calculate loop error // we use session.transport_frame() instead of t1 here - // because t1 is used to calculate the transport speed, and since this - // is float, the loop will compensate for accumulating rounding errors + // because t1 is used to calculate the transport speed, + // so the loop will compensate for accumulating rounding errors e = (double(last_position) - double(session.transport_frame())) / double(session.frame_rate()); @@ -242,7 +242,7 @@ MIDIClock_Slave::stop_if_no_more_clock_events(nframes_t& pos, nframes_t now) } bool -MIDIClock_Slave::speed_and_position (float& speed, nframes_t& pos) +MIDIClock_Slave::speed_and_position (double& speed, nframes_t& pos) { if (!_started || _starting) { speed = 0.0; @@ -257,15 +257,14 @@ MIDIClock_Slave::speed_and_position (float& speed, nframes_t& pos) } // calculate speed - double speed_double = ((t1 - t0) * session.frame_rate()) / one_ppqn_in_frames; - speed = float(speed_double); + speed = ((t1 - t0) * session.frame_rate()) / one_ppqn_in_frames; // calculate position if (engine_now > last_timestamp) { // we are in between MIDI clock messages // so we interpolate position according to speed nframes_t elapsed = engine_now - last_timestamp; - pos = nframes_t (last_position + double(elapsed) * speed_double); + pos = nframes_t (last_position + double(elapsed) * speed); } else { // A new MIDI clock message has arrived this cycle pos = last_position; |