Rename DEBUG macro. Avoid printing some debugging messages in the RT thread of the production build.

pull/3/head
Jonathan Moore Liles 2008-03-23 14:45:07 -05:00
parent 98aab77917
commit dce2463cb8
9 changed files with 27 additions and 25 deletions

View File

@ -102,7 +102,7 @@ Canvas::grid ( Grid *g )
m.vp = &g->viewport;
char *s = m.vp->dump();
DEBUG( "viewport: %s", s );
DMESSAGE( "viewport: %s", s );
free( s );
m.ruler_drawn = false;
@ -130,7 +130,7 @@ Canvas::_update_row_mapping ( void )
for ( int i = 128; i-- ; )
m.rtn[i] = m.ntr[i] = -1;
DEBUG( "updating row mapping" );
DMESSAGE( "updating row mapping" );
/* rebuild */
int r = 0;
@ -226,7 +226,7 @@ Canvas::resize_grid ( void )
return;
}
DEBUG( "resizing grid %dx%d", m.vp->w, m.vp->h );
DMESSAGE( "resizing grid %dx%d", m.vp->w, m.vp->h );
if ( m.previous )
{
@ -509,7 +509,7 @@ Canvas::draw_playhead ( void )
void
Canvas::draw ( void )
{
DEBUG( "drawing canvas" );
DMESSAGE( "drawing canvas" );
draw_mapping();
draw_ruler();
@ -524,7 +524,7 @@ Canvas::draw ( void )
void
Canvas::redraw ( void )
{
DEBUG( "redrawing canvas" );
DMESSAGE( "redrawing canvas" );
if ( ! m.grid_drawn )
draw();

View File

@ -99,10 +99,12 @@ warnf ( warning_t level,
#ifndef NDEBUG
#define DEBUG( fmt, args... ) warnf( W_MESSAGE, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args )
#define DMESSAGE( fmt, args... ) warnf( W_MESSAGE, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args )
#define DWARNING( fmt, args... ) warnf( W_WARNING, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args )
#define ASSERT( pred, fmt, args... ) do { if ( ! (pred) ) { warnf( W_ASSERTION, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ); abort(); } } while ( 0 )
#else
#define DEBUG( fmt, args... )
#define DMESSAGE( fmt, args... )
#define DWARNING( fmt, args... )
#define ASSERT( pred, fmt, args... )
#endif

12
grid.C
View File

@ -57,7 +57,7 @@ Grid::Grid ( void )
Grid::~Grid ( void )
{
DEBUG( "deleting grid" );
DMESSAGE( "deleting grid" );
if ( _name )
free( _name );
@ -333,7 +333,7 @@ Grid::put ( int x, int y, tick_t l )
if ( get( &d, x, y ) || get( &d, x + xl - 1, y ) )
return;
DEBUG( "put %d,%d", x, y );
DMESSAGE( "put %d,%d", x, y );
lock();
@ -379,7 +379,7 @@ Grid::move ( int x, int y, int nx, int ny )
if ( e )
{
DEBUG( "moving note" );
DMESSAGE( "moving note" );
event *on = e,
*off = e->link();
@ -410,7 +410,7 @@ Grid::adj_velocity ( int x, int y, int n )
if ( e )
{
DEBUG( "adjusting velocity" );
DMESSAGE( "adjusting velocity" );
{
int v = e->note_velocity();
@ -438,7 +438,7 @@ Grid::adj_duration ( int x, int y, int l )
if ( e )
{
DEBUG( "adjusting duration" );
DMESSAGE( "adjusting duration" );
{
int v = ts_to_x( e->note_duration() );
@ -781,7 +781,7 @@ Grid::resolution ( unsigned int n )
ASSERTION( "bad resolution: %d", n );
_ppqn = n / 4;
DEBUG( "%d setting resolution to %d", n, _ppqn );
DMESSAGE( "%d setting resolution to %d", n, _ppqn );
signal_events_change();

View File

@ -241,7 +241,7 @@ canvas_input_callback ( O_Canvas *widget, Canvas *c, int m )
int note;
if ( ( note = c->is_row_name( x, y ) ) >= 0 )
{
DEBUG( "click on row %d", note );
DMESSAGE( "click on row %d", note );
Instrument *i = ((pattern *)c->grid())->mapping.instrument();
if ( i )

View File

@ -1419,7 +1419,7 @@ return p;} {}
if ( _c )
{
DEBUG( "Resizing canvas." );
DMESSAGE( "Resizing canvas." );
_c->resize( 0 + 1, 0 + 1, w - 1, h - 1 );
}

View File

@ -188,7 +188,7 @@ Instrument::read ( const char *s )
else
m.velocity = velocity;
DEBUG( "name: \"%s\", note: %d, velocity: %d%%", m.name, note, m.velocity );
DMESSAGE( "name: \"%s\", note: %d, velocity: %d%%", m.name, note, m.velocity );
_map[ note ] = m;
}
@ -222,7 +222,7 @@ Instrument::write ( const char *s ) const
}
}
DEBUG( "wrote %d lines to instrument file \"%s\"", n, pat );
DMESSAGE( "wrote %d lines to instrument file \"%s\"", n, pat );
fclose( fp );

6
jack.C
View File

@ -121,7 +121,7 @@ midi_output_event ( int port, const midievent *e, tick_t duration )
if ( duration )
{
if ( notes_on[ port ][ e->channel() ][ e->note() ] > transport.ticks_per_period * subticks_per_tick )
WARNING( "duplicate note on?" );
DWARNING( "duplicate note on?" );
else
{
notes_on[ port ][ e->channel() ][ e->note() ] = (duration + e->timestamp()) * subticks_per_tick;
@ -227,7 +227,7 @@ process ( jack_nframes_t nframes, void *arg )
goto schedule;
if ( ph != onph )
WARNING( "dropped ticks" );
DWARNING( "dropped ticks" );
onph = nph;
@ -414,7 +414,7 @@ midi_init ( void )
for ( int i = 32 * 16 * MAX_PORT; i-- ; )
freelist.append( new event );
DEBUG( "allocated output buffer space for %lu events", freelist.size() );
DMESSAGE( "allocated output buffer space for %lu events", freelist.size() );
/* clear notes */
for ( int p = MAX_PORT; p--; )

4
non.H
View File

@ -105,12 +105,12 @@ struct song_settings
if ( b )
{
MESSAGE( "song is now dirty" );
DMESSAGE( "song is now dirty" );
signal_dirty();
}
else
{
MESSAGE( "song is now clean" );
DMESSAGE( "song is now clean" );
signal_clean();
}
}

View File

@ -76,7 +76,7 @@ pattern::_add ( void )
pattern::~pattern ( void )
{
DEBUG( "deleting pattern %d", number() );
DMESSAGE( "deleting pattern %d", number() );
signal_create_destroy();
}
@ -415,7 +415,7 @@ pattern::play ( tick_t start, tick_t end ) const
if ( _index < end - start )
{
DEBUG( "Triggered pattern %d at tick %lu (ls: %lu, le: %lu, o: %lu)", number(), start, _start, _end, offset );
DMESSAGE( "Triggered pattern %d at tick %lu (ls: %lu, le: %lu, o: %lu)", number(), start, _start, _end, offset );
_cleared = false;
}
@ -473,7 +473,7 @@ try_again:
offset += d->length;
goto try_again;
DEBUG( "out of events, resetting to satisfy loop" );
DMESSAGE( "out of events, resetting to satisfy loop" );
done: ;