Browse Source

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

tags/non-sequencer-v1.9.4
Jonathan Moore Liles 17 years ago
parent
commit
dce2463cb8
9 changed files with 27 additions and 25 deletions
  1. +5
    -5
      canvas.C
  2. +4
    -2
      debug.h
  3. +6
    -6
      grid.C
  4. +1
    -1
      gui/input.C
  5. +1
    -1
      gui/ui.fl
  6. +2
    -2
      instrument.C
  7. +3
    -3
      jack.C
  8. +2
    -2
      non.H
  9. +3
    -3
      pattern.C

+ 5
- 5
canvas.C View File

@@ -102,7 +102,7 @@ Canvas::grid ( Grid *g )
m.vp = &g->viewport; m.vp = &g->viewport;


char *s = m.vp->dump(); char *s = m.vp->dump();
DEBUG( "viewport: %s", s );
DMESSAGE( "viewport: %s", s );
free( s ); free( s );


m.ruler_drawn = false; m.ruler_drawn = false;
@@ -130,7 +130,7 @@ Canvas::_update_row_mapping ( void )
for ( int i = 128; i-- ; ) for ( int i = 128; i-- ; )
m.rtn[i] = m.ntr[i] = -1; m.rtn[i] = m.ntr[i] = -1;


DEBUG( "updating row mapping" );
DMESSAGE( "updating row mapping" );


/* rebuild */ /* rebuild */
int r = 0; int r = 0;
@@ -226,7 +226,7 @@ Canvas::resize_grid ( void )
return; 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 ) if ( m.previous )
{ {
@@ -509,7 +509,7 @@ Canvas::draw_playhead ( void )
void void
Canvas::draw ( void ) Canvas::draw ( void )
{ {
DEBUG( "drawing canvas" );
DMESSAGE( "drawing canvas" );


draw_mapping(); draw_mapping();
draw_ruler(); draw_ruler();
@@ -524,7 +524,7 @@ Canvas::draw ( void )
void void
Canvas::redraw ( void ) Canvas::redraw ( void )
{ {
DEBUG( "redrawing canvas" );
DMESSAGE( "redrawing canvas" );


if ( ! m.grid_drawn ) if ( ! m.grid_drawn )
draw(); draw();


+ 4
- 2
debug.h View File

@@ -99,10 +99,12 @@ warnf ( warning_t level,




#ifndef NDEBUG #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 ) #define ASSERT( pred, fmt, args... ) do { if ( ! (pred) ) { warnf( W_ASSERTION, __MODULE__, __FILE__, __FUNCTION__, __LINE__, fmt, ## args ); abort(); } } while ( 0 )
#else #else
#define DEBUG( fmt, args... )
#define DMESSAGE( fmt, args... )
#define DWARNING( fmt, args... )
#define ASSERT( pred, fmt, args... ) #define ASSERT( pred, fmt, args... )
#endif #endif




+ 6
- 6
grid.C View File

@@ -57,7 +57,7 @@ Grid::Grid ( void )


Grid::~Grid ( void ) Grid::~Grid ( void )
{ {
DEBUG( "deleting grid" );
DMESSAGE( "deleting grid" );


if ( _name ) if ( _name )
free( _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 ) ) if ( get( &d, x, y ) || get( &d, x + xl - 1, y ) )
return; return;


DEBUG( "put %d,%d", x, y );
DMESSAGE( "put %d,%d", x, y );


lock(); lock();


@@ -379,7 +379,7 @@ Grid::move ( int x, int y, int nx, int ny )


if ( e ) if ( e )
{ {
DEBUG( "moving note" );
DMESSAGE( "moving note" );


event *on = e, event *on = e,
*off = e->link(); *off = e->link();
@@ -410,7 +410,7 @@ Grid::adj_velocity ( int x, int y, int n )


if ( e ) if ( e )
{ {
DEBUG( "adjusting velocity" );
DMESSAGE( "adjusting velocity" );


{ {
int v = e->note_velocity(); int v = e->note_velocity();
@@ -438,7 +438,7 @@ Grid::adj_duration ( int x, int y, int l )


if ( e ) if ( e )
{ {
DEBUG( "adjusting duration" );
DMESSAGE( "adjusting duration" );


{ {
int v = ts_to_x( e->note_duration() ); int v = ts_to_x( e->note_duration() );
@@ -781,7 +781,7 @@ Grid::resolution ( unsigned int n )
ASSERTION( "bad resolution: %d", n ); ASSERTION( "bad resolution: %d", n );


_ppqn = n / 4; _ppqn = n / 4;
DEBUG( "%d setting resolution to %d", n, _ppqn );
DMESSAGE( "%d setting resolution to %d", n, _ppqn );


signal_events_change(); signal_events_change();




+ 1
- 1
gui/input.C View File

@@ -241,7 +241,7 @@ canvas_input_callback ( O_Canvas *widget, Canvas *c, int m )
int note; int note;
if ( ( note = c->is_row_name( x, y ) ) >= 0 ) 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(); Instrument *i = ((pattern *)c->grid())->mapping.instrument();


if ( i ) if ( i )


+ 1
- 1
gui/ui.fl View File

@@ -1419,7 +1419,7 @@ return p;} {}


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




+ 2
- 2
instrument.C View File

@@ -188,7 +188,7 @@ Instrument::read ( const char *s )
else else
m.velocity = velocity; 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; _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 ); fclose( fp );




+ 3
- 3
jack.C View File

@@ -121,7 +121,7 @@ midi_output_event ( int port, const midievent *e, tick_t duration )
if ( duration ) if ( duration )
{ {
if ( notes_on[ port ][ e->channel() ][ e->note() ] > transport.ticks_per_period * subticks_per_tick ) if ( notes_on[ port ][ e->channel() ][ e->note() ] > transport.ticks_per_period * subticks_per_tick )
WARNING( "duplicate note on?" );
DWARNING( "duplicate note on?" );
else else
{ {
notes_on[ port ][ e->channel() ][ e->note() ] = (duration + e->timestamp()) * subticks_per_tick; 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; goto schedule;


if ( ph != onph ) if ( ph != onph )
WARNING( "dropped ticks" );
DWARNING( "dropped ticks" );


onph = nph; onph = nph;


@@ -414,7 +414,7 @@ midi_init ( void )
for ( int i = 32 * 16 * MAX_PORT; i-- ; ) for ( int i = 32 * 16 * MAX_PORT; i-- ; )
freelist.append( new event ); 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 */ /* clear notes */
for ( int p = MAX_PORT; p--; ) for ( int p = MAX_PORT; p--; )


+ 2
- 2
non.H View File

@@ -105,12 +105,12 @@ struct song_settings


if ( b ) if ( b )
{ {
MESSAGE( "song is now dirty" );
DMESSAGE( "song is now dirty" );
signal_dirty(); signal_dirty();
} }
else else
{ {
MESSAGE( "song is now clean" );
DMESSAGE( "song is now clean" );
signal_clean(); signal_clean();
} }
} }


+ 3
- 3
pattern.C View File

@@ -76,7 +76,7 @@ pattern::_add ( void )


pattern::~pattern ( void ) pattern::~pattern ( void )
{ {
DEBUG( "deleting pattern %d", number() );
DMESSAGE( "deleting pattern %d", number() );
signal_create_destroy(); signal_create_destroy();
} }


@@ -415,7 +415,7 @@ pattern::play ( tick_t start, tick_t end ) const


if ( _index < end - start ) 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; _cleared = false;
} }
@@ -473,7 +473,7 @@ try_again:
offset += d->length; offset += d->length;
goto try_again; goto try_again;


DEBUG( "out of events, resetting to satisfy loop" );
DMESSAGE( "out of events, resetting to satisfy loop" );


done: ; done: ;




Loading…
Cancel
Save