X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fmidi_clock_slave.cc;h=9743327ec6146c7331435dafe333016385e7c57d;hb=91ab5e31751105d59386aab6a6e16ac5582904dc;hp=25f92a482c521a5cfd48c745e56b82d3c746fb7f;hpb=caac41a9cb2d86985595c590b151b0197b7b0c4c;p=ardour.git diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 25f92a482c..9743327ec6 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "pbd/error.h" @@ -45,7 +44,7 @@ using namespace PBD; MIDIClock_Slave::MIDIClock_Slave (Session& s, MidiPort& p, int ppqn) : ppqn (ppqn) - , bandwidth (10.0 / 60.0) // 1 BpM = 1 / 60 Hz + , bandwidth (2.0 / 60.0) // 1 BpM = 1 / 60 Hz { session = (ISlaveSessionProxy *) new SlaveSessionProxy(s); rebind (p); @@ -55,7 +54,7 @@ MIDIClock_Slave::MIDIClock_Slave (Session& s, MidiPort& p, int ppqn) MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn) : session(session_proxy) , ppqn (ppqn) - , bandwidth (10.0 / 60.0) // 1 BpM = 1 / 60 Hz + , bandwidth (2.0 / 60.0) // 1 BpM = 1 / 60 Hz { reset (); } @@ -83,8 +82,8 @@ MIDIClock_Slave::rebind (MidiPort& port) 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()); + const Tempo& current_tempo = session->tempo_map().tempo_at_frame (time); + double const 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; @@ -206,7 +205,6 @@ MIDIClock_Slave::start (Parser& /*parser*/, framepos_t timestamp) void MIDIClock_Slave::reset () { - bandwidth = (256.0 / session->frames_per_cycle()) * 10.0 / 60.0; DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MidiClock_Slave reset(): calculated filter bandwidth is %1 for period size %2\n", bandwidth, session->frames_per_cycle())); should_be_position = session->transport_frame(); @@ -262,7 +260,7 @@ MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/) } void -MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) +MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size) { // we are note supposed to get position messages while we are running // so lets be robust and ignore those @@ -271,8 +269,8 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) } assert(size == 3); - byte lsb = message[1]; - byte msb = message[2]; + MIDI::byte lsb = message[1]; + MIDI::byte msb = message[2]; assert((lsb <= 0x7f) && (msb <= 0x7f)); uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb);