Tempo ramps - port audio unit and midi clock slave.
authornick_m <mainsbridge@gmail.com>
Sun, 20 Dec 2015 20:14:10 +0000 (07:14 +1100)
committernick_m <mainsbridge@gmail.com>
Fri, 27 May 2016 13:38:09 +0000 (23:38 +1000)
- untested.

libs/ardour/audio_unit.cc
libs/ardour/midi_clock_slave.cc

index 15b63c8f37b3b4933c8080f666e6fd8a02098b16..6a927680aa4f6a0eeaf43e0119bc953ab0c16351 100644 (file)
@@ -1810,8 +1810,8 @@ AUPlugin::get_musical_time_location_callback (UInt32*   outDeltaSampleOffsetToNe
                        *outDeltaSampleOffsetToNextBeat = 0;
                } else {
                        *outDeltaSampleOffsetToNextBeat = (UInt32)
-                               floor (((Timecode::BBT_Time::ticks_per_beat - bbt.ticks)/Timecode::BBT_Time::ticks_per_beat) * // fraction of a beat to next beat
-                                      metric.tempo().frames_per_beat (_session.frame_rate())); // frames per beat
+                               double beat_frac_to_next = (Timecode::BBT_Time::ticks_per_beat - bbt.ticks) / Timecode::BBT_Time::ticks_per_beat ;
+                               tmap.frame_at_beat (tmap.beat_at_frame (_session.transport_frame() + input_offset) + beat_frac_to_next);
                }
        }
 
index 8c95272fde239987e8f13edcec63021fc82bff34..44bb31e05c6a1827d8a50a7662f18ecf0b31dd74 100644 (file)
@@ -83,7 +83,7 @@ void
 MIDIClock_Slave::calculate_one_ppqn_in_frames_at(framepos_t time)
 {
        const Tempo& current_tempo = session->tempo_map().tempo_at(time);
-       double frames_per_beat = current_tempo.frames_per_beat(session->frame_rate());
+       double frames_per_beat = session->tempo_map().frames_per_beat_at (time, session->frame_rate());
 
        double quarter_notes_per_beat = 4.0 / current_tempo.note_type();
        double frames_per_quarter_note = frames_per_beat / quarter_notes_per_beat;