summaryrefslogtreecommitdiff
path: root/libs/ardour/ticker.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-14 01:05:51 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-14 01:05:51 +0000
commit1238f09478e8def7f4e2bc8df9951ed78ca3ccd1 (patch)
tree15e6ac3b01eab7572420c3256418c3477926bfd1 /libs/ardour/ticker.cc
parent6f8cafdaffb4d2ee24bf035f5df370b7ca762fb8 (diff)
Use DEBUG_TRACE for all of the MIDI clock ticker code.
git-svn-id: svn://localhost/ardour2/branches/3.0@8264 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ticker.cc')
-rw-r--r--libs/ardour/ticker.cc44
1 files changed, 17 insertions, 27 deletions
diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc
index 4fbc18bd1f..1134cec859 100644
--- a/libs/ardour/ticker.cc
+++ b/libs/ardour/ticker.cc
@@ -26,11 +26,6 @@
#include "ardour/tempo.h"
#include "ardour/debug.h"
-#ifdef DEBUG_MIDI_CLOCK
-#include <iostream>
-using namespace std;
-#endif
-
using namespace ARDOUR;
void Ticker::set_session (Session* s)
@@ -75,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;
@@ -111,9 +108,8 @@ void MidiClockTicker::transport_state_changed()
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;
}
@@ -122,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)
@@ -145,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;
@@ -183,7 +173,7 @@ void MidiClockTicker::send_midi_clock_event (pframes_t offset)
return;
}
- DEBUG_TRACE (PBD::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);