X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fticker.cc;h=0b4e64e0df3917e75c44adb1e942c0acf9865a0b;hb=a406d9183adc67075a4e802fd8254c2560df9964;hp=fdae97e4bcd5ed9d477e8770d128cbe6599c74dd;hpb=e8c59e4155a6fa40863c2d761ab8e1c5b81c589b;p=ardour.git diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index fdae97e4bc..0b4e64e0df 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -24,11 +24,7 @@ #include "ardour/ticker.h" #include "ardour/session.h" #include "ardour/tempo.h" - -#ifdef DEBUG_MIDI_CLOCK -#include -using namespace std; -#endif +#include "ardour/debug.h" using namespace ARDOUR; @@ -74,9 +70,11 @@ void MidiClockTicker::transport_state_changed() float speed = _session->transport_speed(); framepos_t position = _session->transport_frame(); -#ifdef DEBUG_MIDI_CLOCK - cerr << "Transport state change, speed:" << speed << "position:" << position<< " play loop " << _session->get_play_loop() << endl; -#endif + + DEBUG_TRACE (PBD::DEBUG::MidiClock, + string_compose ("Transport state change, speed: %1 position: %2 play loop: %3\n", speed, position, _session->get_play_loop()) + ); + if (speed == 1.0f) { _last_tick = position; @@ -105,14 +103,13 @@ void MidiClockTicker::transport_state_changed() send_stop_event(0); } - tick(position, *((ARDOUR::BBT_Time *) 0), *((Timecode::Time *)0)); + tick(position, *((Timecode::BBT_Time *) 0), *((Timecode::Time *)0)); } void MidiClockTicker::position_changed (framepos_t position) { -#ifdef DEBUG_MIDI_CLOCK - cerr << "Position changed:" << position << endl; -#endif + DEBUG_TRACE (PBD::DEBUG::MidiClock, string_compose ("Position change: %1\n", position)); + _last_tick = position; } @@ -121,13 +118,10 @@ void MidiClockTicker::transport_looped() Location* loop_location = _session->locations()->auto_loop_location(); assert(loop_location); -#ifdef DEBUG_MIDI_CLOCK - cerr << "Transport looped, position:" << _session->transport_frame() - << " loop start " << loop_location->start( ) - << " loop end " << loop_location->end( ) - << " play loop " << _session->get_play_loop() - << endl; -#endif + DEBUG_TRACE (PBD::DEBUG::MidiClock, + string_compose ("Transport looped, position: %1, loop start: %2, loop end: %3, play loop: %4\n", + _session->transport_frame(), loop_location->start(), loop_location->end(), _session->get_play_loop()) + ); // adjust _last_tick, so that the next MIDI clock message is sent // in due time (and the tick interval is still constant) @@ -135,7 +129,7 @@ void MidiClockTicker::transport_looped() _last_tick = loop_location->start() - elapsed_since_last_tick; } -void MidiClockTicker::tick (const framepos_t& transport_frames, const BBT_Time& /*transport_bbt*/, const Timecode::Time& /*transport_smpt*/) +void MidiClockTicker::tick (const framepos_t& transport_frames, const Timecode::BBT_Time& /*transport_bbt*/, const Timecode::Time& /*transport_smpt*/) { if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f || _midi_port == 0) return; @@ -144,14 +138,11 @@ void MidiClockTicker::tick (const framepos_t& transport_frames, const BBT_Time& double next_tick = _last_tick + one_ppqn_in_frames(transport_frames); framecnt_t next_tick_offset = framecnt_t(next_tick) - transport_frames; -#ifdef DEBUG_MIDI_CLOCK - cerr << "Transport:" << transport_frames - << ":Last tick time:" << _last_tick << ":" - << ":Next tick time:" << next_tick << ":" - << "Offset:" << next_tick_offset << ":" - << "cycle length:" << _midi_port->nframes_this_cycle() - << endl; -#endif + DEBUG_TRACE (PBD::DEBUG::MidiClock, + string_compose ("Transport: %1, last tick time: %2, next tick time: %3, offset: %4, cycle length: %5\n", + transport_frames, _last_tick, next_tick, next_tick_offset, _midi_port->nframes_this_cycle() + ) + ); if (next_tick_offset >= _midi_port->nframes_this_cycle()) return; @@ -182,7 +173,7 @@ void MidiClockTicker::send_midi_clock_event (pframes_t offset) return; } - DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Tick with offset %1", offset)); + DEBUG_TRACE (PBD::DEBUG::MidiClock, string_compose ("Tick with offset %1\n", offset)); static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_CLOCK }; _midi_port->write (_midi_clock_tick, 1, offset);