X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fticker.cc;h=def219a4331654aea57d154fc2ce808c7318ddc3;hb=9a0f4b1ef354f5ccc7cbe49a28b4a5eb35e0eb99;hp=3fe6e66b81ceb2f97676181989ae3c50ab81a8ce;hpb=4dc63966f0872efe768dad61eb9b8785d06b92d1;p=ardour.git diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 3fe6e66b81..def219a433 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -49,10 +49,10 @@ public: bool sync (Session* s) { bool changed = false; - + double sp = s->transport_speed(); framecnt_t fr = s->transport_frame(); - + if (speed != sp) { speed = sp; changed = true; @@ -68,9 +68,10 @@ public: s->bbt_time (this->frame, *this); const TempoMap& tempo = s->tempo_map(); + const Meter& meter = tempo.meter_at_frame (frame); - const double divisions = tempo.meter_at(frame).divisions_per_bar(); - const double divisor = tempo.meter_at(frame).note_divisor(); + const double divisions = meter.divisions_per_bar(); + const double divisor = meter.note_divisor(); const double qnote_scale = divisor * 0.25f; double mb; @@ -120,7 +121,7 @@ void MidiClockTicker::set_session (Session* s) { SessionHandlePtr::set_session (s); - + if (_session) { _session->TransportStateChange.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::transport_state_changed, this)); _session->TransportLooped.connect_same_thread (_session_connections, boost::bind (&MidiClockTicker::transport_looped, this)); @@ -230,7 +231,7 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe send_position_event (llrint (_pos->midi_beats), 0, nframes); } else if (_pos->speed == 1.0f) { send_stop_event (0, nframes); - + if (_pos->frame == 0) { send_start_event (0, nframes); } else { @@ -249,21 +250,21 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe if (_pos->speed == 1.0f) { if (_session->get_play_loop()) { assert(_session->locations()->auto_loop_location()); - + if (_pos->frame == _session->locations()->auto_loop_location()->start()) { send_start_event (0, nframes); } else { send_continue_event (0, nframes); } - + } else if (_pos->frame == 0) { send_start_event (0, nframes); } else { send_continue_event (0, nframes); } - + // send_midi_clock_event (0); - + } else if (_pos->speed == 0.0f) { send_stop_event (0, nframes); send_position_event (llrint (_pos->midi_beats), 0, nframes); @@ -307,8 +308,8 @@ MidiClockTicker::tick (const framepos_t& /* transport_frame */, pframes_t nframe double MidiClockTicker::one_ppqn_in_frames (framepos_t transport_position) { - const Tempo& current_tempo = _session->tempo_map().tempo_at (transport_position); - double frames_per_beat = current_tempo.frames_per_beat (_session->nominal_frame_rate()); + const Tempo& current_tempo = _session->tempo_map().tempo_at_frame (transport_position); + double frames_per_beat = _session->tempo_map().frames_per_beat_at (transport_position, _session->nominal_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;