[beast/devel: 31/77] BSE: use BSE_KEY_DEBUG() to implement debug macros



commit 0f369b8257cf97ac6f30ffe3bc7e65eb0a03d28f
Author: Tim Janik <timj gnu org>
Date:   Sun Apr 7 16:19:55 2013 +0200

    BSE: use BSE_KEY_DEBUG() to implement debug macros

 bse/bseengine.cc          |   12 +++-----
 bse/bseloader-bsewave.cc  |    4 +-
 bse/bseloader-guspatch.cc |   44 +++++++++++++++++---------------
 bse/bsemididecoder.cc     |   60 +++++++++++++++++++++++---------------------
 bse/bsemidifile.cc        |   27 ++++++++++---------
 bse/bsemidireceiver.cc    |   43 +++++++++++++++-----------------
 bse/bseobject.cc          |   21 ++++++++-------
 bse/bsepcmdevice-null.cc  |    7 +++--
 bse/bsepcmdevice-oss.cc   |   27 ++++++++++---------
 bse/bseplugin.cc          |   20 ++++++--------
 bse/bseprocedure.cc       |   23 +++++++++-------
 bse/bsestorage.cc         |   13 +++++++--
 bse/bseundostack.cc       |   28 +++++++++++---------
 bse/gslvorbis-cutter.cc   |   30 +++++++++++-----------
 bse/gslvorbis-enc.cc      |    9 +++---
 bse/gslwaveosc.cc         |   15 ++++++-----
 16 files changed, 199 insertions(+), 184 deletions(-)
---
diff --git a/bse/bseengine.cc b/bse/bseengine.cc
index 0806cd7..66735aa 100644
--- a/bse/bseengine.cc
+++ b/bse/bseengine.cc
@@ -9,9 +9,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-static SFI_MSG_TYPE_DEFINE (debug_engine, "engine", SFI_MSG_DEBUG, NULL);
-#undef DEBUG // FIXME
-#define DEBUG(...)      sfi_debug (debug_engine, __VA_ARGS__)
+#define EDEBUG(...)     BSE_KEY_DEBUG ("engine", __VA_ARGS__)
 
 /* some systems don't have ERESTART (which is what linux returns for system
  * calls on pipes which are being interrupted). most probably just use EINTR,
@@ -1245,10 +1243,10 @@ bse_engine_configure (guint            latency_ms,
   bse_engine_wait_on_trans();
   bse_engine_user_thread_collect();
   if (success)
-    DEBUG ("configured%s: mixfreq=%uHz bsize=%uvals craster=%u (cfreq=%f)",
-           bse_engine_threaded ? "(threaded)" : "",
-           bse_engine_sample_freq(), bse_engine_block_size(), bse_engine_control_raster(),
-           bse_engine_sample_freq() / (float) bse_engine_control_raster());
+    EDEBUG ("configured%s: mixfreq=%uHz bsize=%uvals craster=%u (cfreq=%f)",
+            bse_engine_threaded ? "(threaded)" : "",
+            bse_engine_sample_freq(), bse_engine_block_size(), bse_engine_control_raster(),
+            bse_engine_sample_freq() / (float) bse_engine_control_raster());
   return success;
 }
 /**
diff --git a/bse/bseloader-bsewave.cc b/bse/bseloader-bsewave.cc
index 938590e..4ba3569 100644
--- a/bse/bseloader-bsewave.cc
+++ b/bse/bseloader-bsewave.cc
@@ -9,12 +9,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
+
 #define parse_or_return(scanner, token) { GslWaveTokenType _t = GslWaveTokenType (token); \
                                           if (GslWaveTokenType (g_scanner_get_next_token (scanner)) != _t) \
                                             return _t; \
                                         }
-static SFI_MSG_TYPE_DEFINE (debug_bsewave, "bsewave", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_bsewave, __VA_ARGS__)
+
 /* --- token types --- */
 typedef enum
 {
diff --git a/bse/bseloader-guspatch.cc b/bse/bseloader-guspatch.cc
index 6c8fbd7..f208e9c 100644
--- a/bse/bseloader-guspatch.cc
+++ b/bse/bseloader-guspatch.cc
@@ -5,9 +5,11 @@
 #include <string.h>
 #include <vector>
 #include <string>
+
 #undef  WITH_GUSPATCH_XINFOS
-static SFI_MSG_TYPE_DEFINE (debug_guspatch, "guspatch", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_guspatch, __VA_ARGS__)
+
+#define LDEBUG(...)     BSE_KEY_DEBUG ("loader", __VA_ARGS__)
+
 using std::vector;
 using std::string;
 /*
@@ -259,7 +261,7 @@ struct FileInfo
          {
            if (wave_format & PAT_FORMAT_LOOP_BACKWARDS)
              {
-               DEBUG ("unsupported loop type (backwards-pingpong)");
+               LDEBUG ("unsupported loop type (backwards-pingpong)");
                return GSL_WAVE_LOOP_PINGPONG;
              }
            else
@@ -271,7 +273,7 @@ struct FileInfo
          {
            if (wave_format & PAT_FORMAT_LOOP_BACKWARDS)
              {
-               DEBUG ("unsupported loop type (backwards-jump)");
+               LDEBUG ("unsupported loop type (backwards-jump)");
                return GSL_WAVE_LOOP_JUMP;
              }
            else
@@ -374,7 +376,7 @@ struct FileInfo
            fclose (patfile);
            return;
          }
-       DEBUG (" - read patch, srate = %d (%d bytes)", patch->sampleRate, patch->wavesize);
+       LDEBUG (" - read patch, srate = %d (%d bytes)", patch->sampleRate, patch->wavesize);
       }
     fclose (patfile);
     /* allocate and fill BseWaveFileInfo */
@@ -393,12 +395,12 @@ struct FileInfo
        /* fill GslWaveChunk */
        wdsc.chunks[i].mix_freq = patches[i]->sampleRate;
        wdsc.chunks[i].osc_freq = patches[i]->origFreq / 1000.0;
-       DEBUG ("orig_freq = %f (%d)", patches[i]->origFreq / 1000.0, patches[i]->origFreq);
-       DEBUG ("min_freq = %f", patches[i]->minFreq / 1000.0);
-       DEBUG ("max_freq = %f", patches[i]->maxFreq / 1000.0);
-       DEBUG ("fine_tune = %d", patches[i]->fineTune);
-       DEBUG ("scale_freq = %d", patches[i]->freqScale);
-       DEBUG ("scale_factor = %d", patches[i]->freqScaleFactor);
+       LDEBUG ("orig_freq = %f (%d)", patches[i]->origFreq / 1000.0, patches[i]->origFreq);
+       LDEBUG ("min_freq = %f", patches[i]->minFreq / 1000.0);
+       LDEBUG ("max_freq = %f", patches[i]->maxFreq / 1000.0);
+       LDEBUG ("fine_tune = %d", patches[i]->fineTune);
+       LDEBUG ("scale_freq = %d", patches[i]->freqScale);
+       LDEBUG ("scale_factor = %d", patches[i]->freqScaleFactor);
        /* fill xinfos */
        char**& xinfos = wdsc.chunks[i].xinfos;
        int frame_size = bytes_per_frame (patches[i]->waveFormat);
@@ -500,16 +502,16 @@ pat_create_chunk_handle (gpointer      data,
   FileInfo *file_info = reinterpret_cast<FileInfo*> (wave_dsc->file_info);
   const PatPatch *patch = file_info->patches[nth_chunk];
   const BseWaveChunkDsc *chunk = &wave_dsc->chunks[nth_chunk];
-  DEBUG ("pat loader chunk %d: gsl_wave_handle_new %s %d %d %d %f %f %u %d",
-         nth_chunk,
-         file_info->wfi.file_name,
-         wave_dsc->n_channels,
-         file_info->wave_format (patch->waveFormat),
-         G_LITTLE_ENDIAN,
-         chunk->mix_freq,
-         chunk->osc_freq,
-         file_info->data_offset (nth_chunk),
-         patch->wavesize / file_info->bytes_per_frame (patch->waveFormat));
+  LDEBUG ("pat loader chunk %d: gsl_wave_handle_new %s %d %d %d %f %f %u %d",
+          nth_chunk,
+          file_info->wfi.file_name,
+          wave_dsc->n_channels,
+          file_info->wave_format (patch->waveFormat),
+          G_LITTLE_ENDIAN,
+          chunk->mix_freq,
+          chunk->osc_freq,
+          file_info->data_offset (nth_chunk),
+          patch->wavesize / file_info->bytes_per_frame (patch->waveFormat));
   GslDataHandle *dhandle;
   dhandle = gsl_wave_handle_new (file_info->wfi.file_name,
                                 wave_dsc->n_channels,
diff --git a/bse/bsemididecoder.cc b/bse/bsemididecoder.cc
index 8a3316a..e781dc6 100644
--- a/bse/bsemididecoder.cc
+++ b/bse/bsemididecoder.cc
@@ -3,10 +3,12 @@
 #include "bsemidireceiver.hh"
 #include "bseengine.hh"
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_midi_decoder, "midi-decoder", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_midi_decoder, __VA_ARGS__)
+
+#define MDEBUG(...)     BSE_KEY_DEBUG ("midi-decoder", __VA_ARGS__)
+
 /* --- prototypes --- */
 static void     bse_midi_decoder_construct_event   (BseMidiDecoder *self);
+
 /* --- function --- */
 BseMidiDecoder*
 bse_midi_decoder_new (gboolean             auto_queue,
@@ -337,11 +339,11 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
         event->data.note.velocity = 0;
       else /* note-on or key-pressure */
         event->data.note.velocity = ival * DR7F;
-      DEBUG ("ch-%02x: note-%s: freq=%.3f velocity=%.4f (%02x %02x)", event->channel,
-             event->status == BSE_MIDI_NOTE_ON ? "on " :
-             event->status == BSE_MIDI_NOTE_OFF ? "off" : "pressure",
-             event->data.note.frequency, event->data.note.velocity,
-             self->bytes[0], self->bytes[1]);
+      MDEBUG ("ch-%02x: note-%s: freq=%.3f velocity=%.4f (%02x %02x)", event->channel,
+              event->status == BSE_MIDI_NOTE_ON ? "on " :
+              event->status == BSE_MIDI_NOTE_OFF ? "off" : "pressure",
+              event->data.note.frequency, event->data.note.velocity,
+              self->bytes[0], self->bytes[1]);
       break;
     case BSE_MIDI_CONTROL_CHANGE:       /* 7bit ctl-nr, 7bit value */
       if (self->n_bytes < 2)
@@ -349,22 +351,22 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       event->data.control.control = self->bytes[0] & 0x7f;
       ival = self->bytes[1] & 0x7f;
       event->data.control.value = ival * DR7F;
-      DEBUG ("ch-%02x: control[%02u]: %.4f (0x%02x)", event->channel,
-             event->data.control.control,
-             event->data.control.value, ival);
+      MDEBUG ("ch-%02x: control[%02u]: %.4f (0x%02x)", event->channel,
+              event->data.control.control,
+              event->data.control.value, ival);
       break;
     case BSE_MIDI_PROGRAM_CHANGE:       /* 7bit prg-nr */
       if (self->n_bytes < 1)
         return FALSE;
       event->data.program = self->bytes[0] & 0x7f;
-      DEBUG ("ch-%02x: program-change: 0x%02x", event->channel, event->data.program);
+      MDEBUG ("ch-%02x: program-change: 0x%02x", event->channel, event->data.program);
       break;
     case BSE_MIDI_CHANNEL_PRESSURE:     /* 7bit intensity */
       if (self->n_bytes < 1)
         return FALSE;
       ival = self->bytes[0] & 0x7f;
       event->data.intensity = ival * DR7F;
-      DEBUG ("ch-%02x: channel-pressure: %.4f (0x%02x)", event->channel, event->data.intensity, ival);
+      MDEBUG ("ch-%02x: channel-pressure: %.4f (0x%02x)", event->channel, event->data.intensity, ival);
       break;
     case BSE_MIDI_PITCH_BEND:           /* 14bit signed: 7lsb, 7msb */
       if (self->n_bytes < 2)
@@ -374,7 +376,7 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       ival |= v << 7;
       ival -= 0x2000;   /* range=0..0x3fff, center=0x2000 */
       event->data.pitch_bend = ival * DR2000;
-      DEBUG ("ch-%02x: pitch-bend: %.4f (0x%04x)", event->channel, event->data.pitch_bend, ival);
+      MDEBUG ("ch-%02x: pitch-bend: %.4f (0x%04x)", event->channel, event->data.pitch_bend, ival);
       break;
     case BSE_MIDI_MULTI_SYS_EX_START:   /* BSE_MIDI_SYS_EX split across multiple events */
     case BSE_MIDI_MULTI_SYS_EX_NEXT:    /* continuation, last data byte of final packet is 0xF7 */
@@ -382,7 +384,7 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
     case BSE_MIDI_SYS_EX:               /* data... (without final 0x7F) */
       event->data.sys_ex.n_bytes = self->n_bytes;
       event->data.sys_ex.bytes = self->bytes;
-      DEBUG ("ch-%02x: sys-ex: %u bytes", event->channel, self->n_bytes);
+      MDEBUG ("ch-%02x: sys-ex: %u bytes", event->channel, self->n_bytes);
       self->n_bytes = 0;
       self->bytes = NULL;
       break;
@@ -392,20 +394,20 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       event->data.song_pointer = self->bytes[0] & 0x7f;
       v = self->bytes[1] & 0x7f;
       event->data.song_pointer |= v << 7;
-      DEBUG ("ch-%02x: song-pointer: 0x%04x", event->channel, event->data.song_pointer);
+      MDEBUG ("ch-%02x: song-pointer: 0x%04x", event->channel, event->data.song_pointer);
       break;
     case BSE_MIDI_SONG_SELECT:          /* 7bit song-nr */
       if (self->n_bytes < 1)
         return FALSE;
       event->data.song_number = self->bytes[0] & 0x7f;
-      DEBUG ("ch-%02x: song-select: 0x%02x", event->channel, event->data.song_number);
+      MDEBUG ("ch-%02x: song-select: 0x%02x", event->channel, event->data.song_number);
       break;
     case BSE_MIDI_SEQUENCE_NUMBER:      /* 16bit sequence number (msb, lsb) */
       if (self->n_bytes < 2)
         return FALSE;
       event->data.sequence_number = self->bytes[0] << 8;
       event->data.sequence_number += self->bytes[1];
-      DEBUG ("ch-%02x: sequence-number: 0x%04x", event->channel, event->data.sequence_number);
+      MDEBUG ("ch-%02x: sequence-number: 0x%04x", event->channel, event->data.sequence_number);
       break;
     case BSE_MIDI_TEXT_EVENT:           /* 8bit text */
     case BSE_MIDI_COPYRIGHT_NOTICE:     /* 8bit text */
@@ -423,13 +425,13 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
     case BSE_MIDI_TEXT_EVENT_0E:        /* 8bit text */
     case BSE_MIDI_TEXT_EVENT_0F:        /* 8bit text */
       event->data.text = g_strndup ((const char*) self->bytes, self->n_bytes);
-      DEBUG ("ch-%02x: text event (0x%02X): %s", event->channel, event->status, event->data.text);
+      MDEBUG ("ch-%02x: text event (0x%02X): %s", event->channel, event->status, event->data.text);
       break;
     case BSE_MIDI_CHANNEL_PREFIX:       /* 8bit channel number (0..15) */
       if (self->n_bytes < 1)
         return FALSE;
       event->data.zprefix = self->bytes[0];
-      DEBUG ("ch-XX: channel zprefix: %u", event->data.zprefix);
+      MDEBUG ("ch-XX: channel zprefix: %u", event->data.zprefix);
       break;
     case BSE_MIDI_SET_TEMPO:            /* 24bit usecs-per-quarter-note (msb first) */
       if (self->n_bytes < 3)
@@ -437,7 +439,7 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       event->data.usecs_pqn = self->bytes[0] << 16;
       event->data.usecs_pqn += self->bytes[1] << 8;
       event->data.usecs_pqn += self->bytes[2];
-      DEBUG ("ch-%02x: set-tempo: usecs-per-quarter-note=%u", event->channel, event->data.usecs_pqn);
+      MDEBUG ("ch-%02x: set-tempo: usecs-per-quarter-note=%u", event->channel, event->data.usecs_pqn);
       break;
     case BSE_MIDI_SMPTE_OFFSET:         /* 8bit hour, minute, second, frame, 100th-frame-fraction */
       if (self->n_bytes < 5)
@@ -447,9 +449,9 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       event->data.smpte_offset.second = self->bytes[2];
       event->data.smpte_offset.frame = self->bytes[3];
       event->data.smpte_offset.fraction = self->bytes[4];
-      DEBUG ("ch-%02x: smpte signature: hour=%u minute=%u second=%u frame=%u fraction=%u", event->channel,
-             event->data.smpte_offset.hour, event->data.smpte_offset.minute, event->data.smpte_offset.second,
-             event->data.smpte_offset.frame, event->data.smpte_offset.fraction);
+      MDEBUG ("ch-%02x: smpte signature: hour=%u minute=%u second=%u frame=%u fraction=%u", event->channel,
+              event->data.smpte_offset.hour, event->data.smpte_offset.minute, 
event->data.smpte_offset.second,
+              event->data.smpte_offset.frame, event->data.smpte_offset.fraction);
       break;
     case BSE_MIDI_TIME_SIGNATURE:       /* 8bit numerator, -ld(1/denominator), metro-clocks, 32nd-npq */
       if (self->n_bytes < 4)
@@ -458,9 +460,9 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
       event->data.time_signature.denominator = 1 << self->bytes[1];
       event->data.time_signature.metro_clocks = self->bytes[2];
       event->data.time_signature.notated_32nd = self->bytes[3];
-      DEBUG ("ch-%02x: time signature: %u/%u metro=%u 32/4=%u", event->channel,
-             event->data.time_signature.numerator, event->data.time_signature.denominator,
-             event->data.time_signature.metro_clocks, event->data.time_signature.notated_32nd);
+      MDEBUG ("ch-%02x: time signature: %u/%u metro=%u 32/4=%u", event->channel,
+              event->data.time_signature.numerator, event->data.time_signature.denominator,
+              event->data.time_signature.metro_clocks, event->data.time_signature.notated_32nd);
       break;
     case BSE_MIDI_KEY_SIGNATURE:        /* 8bit sharpsflats, majorminor */
       if (self->n_bytes < 2)
@@ -472,13 +474,13 @@ midi_decoder_extract_specific (BseMidiDecoder *self,
         event->data.key_signature.n_sharps = v & 0x3f;
       event->data.key_signature.major_key = self->bytes[1] == 0;
       event->data.key_signature.minor_key = self->bytes[1] != 0;
-      DEBUG ("ch-%02x: key signature: flats=%u sharps=%u major-key=%u", event->channel,
-             event->data.key_signature.n_flats, event->data.key_signature.n_sharps, 
event->data.key_signature.major_key);
+      MDEBUG ("ch-%02x: key signature: flats=%u sharps=%u major-key=%u", event->channel,
+              event->data.key_signature.n_flats, event->data.key_signature.n_sharps, 
event->data.key_signature.major_key);
       break;
     case BSE_MIDI_SEQUENCER_SPECIFIC:   /* manufacturer specific sequencing data */
       event->data.sys_ex.n_bytes = self->n_bytes;
       event->data.sys_ex.bytes = self->bytes;
-      DEBUG ("ch-%02x: sequencer specific: %u bytes", event->channel, self->n_bytes);
+      MDEBUG ("ch-%02x: sequencer specific: %u bytes", event->channel, self->n_bytes);
       self->n_bytes = 0;
       self->bytes = NULL;
       break;
diff --git a/bse/bsemidifile.cc b/bse/bsemidifile.cc
index 68ad497..0bed360 100644
--- a/bse/bsemidifile.cc
+++ b/bse/bsemidifile.cc
@@ -9,8 +9,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-static SFI_MSG_TYPE_DEFINE (debug_midi_file, "midi-file", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_midi_file, __VA_ARGS__)
+
+#define MDEBUG(...)     BSE_KEY_DEBUG ("midi-file", __VA_ARGS__)
+
 typedef struct {
   uint32       type;   /* four letter chunk identifier */
   uint32       length; /* length of data to follow, big-endian */
@@ -47,7 +48,7 @@ smf_read_header (int        fd,
   n_bytes = 4 + 4 + 2 + 2 + 2;
   if (read (fd, header, n_bytes) != n_bytes)
     {
-      DEBUG ("failed to read midi file header: %s", g_strerror (errno));
+      MDEBUG ("failed to read midi file header: %s", g_strerror (errno));
       return gsl_error_from_errno (errno, BSE_ERROR_IO);
     }
   /* endianess corrections */
@@ -59,38 +60,38 @@ smf_read_header (int        fd,
   /* validation */
   if (header->chunk.type != ('M' << 24 | 'T' << 16 | 'h' << 8 | 'd'))
     {
-      DEBUG ("unmatched token 'MThd'");
+      MDEBUG ("unmatched token 'MThd'");
       return BSE_ERROR_FORMAT_INVALID;
     }
   if (header->chunk.length < 6)
     {
-      DEBUG ("truncated midi file header");
+      MDEBUG ("truncated midi file header");
       return BSE_ERROR_FORMAT_INVALID;
     }
   if (header->format > 2)
     {
-      DEBUG ("unknown midi file format");
+      MDEBUG ("unknown midi file format");
       return BSE_ERROR_FORMAT_UNKNOWN;
     }
   if (header->format == 0 && header->n_tracks != 1)
     {
-      DEBUG ("invalid number of tracks: %d", header->n_tracks);
+      MDEBUG ("invalid number of tracks: %d", header->n_tracks);
       return BSE_ERROR_FORMAT_INVALID;
     }
   if (header->n_tracks < 1)
     {
-      DEBUG ("midi file without tracks");
+      MDEBUG ("midi file without tracks");
       return BSE_ERROR_NO_DATA;
     }
   if (header->division & 0x8000)        // FIXME: this allowes only tpqn
     {
-      DEBUG ("SMPTE time encoding not supported");
+      MDEBUG ("SMPTE time encoding not supported");
       return BSE_ERROR_FORMAT_UNKNOWN;
     }
   /* read up remaining unused header bytes */
   if (dummy_read (fd, header->chunk.length - 6) != header->chunk.length - 6)
     {
-      DEBUG ("failed to read midi file header: %s", g_strerror (errno));
+      MDEBUG ("failed to read midi file header: %s", g_strerror (errno));
       return gsl_error_from_errno (errno, BSE_ERROR_IO);
     }
   return BSE_ERROR_NONE;
@@ -106,7 +107,7 @@ smf_read_track (BseMidiFile    *smf,
   n_bytes = 4 + 4;
   if (read (fd, &chunk, n_bytes) != n_bytes)
     {
-      DEBUG ("failed to read midi track header: %s", g_strerror (errno));
+      MDEBUG ("failed to read midi track header: %s", g_strerror (errno));
       return gsl_error_from_errno (errno, BSE_ERROR_IO);
     }
   /* endianess corrections */
@@ -115,7 +116,7 @@ smf_read_track (BseMidiFile    *smf,
   /* validation */
   if (chunk.type != ('M' << 24 | 'T' << 16 | 'r' << 8 | 'k'))
     {
-      DEBUG ("unmatched token 'MTrk'");
+      MDEBUG ("unmatched token 'MTrk'");
       return BSE_ERROR_FORMAT_INVALID;
     }
   /* read up and decode track data */
@@ -126,7 +127,7 @@ smf_read_track (BseMidiFile    *smf,
       int l = MIN (n_bytes, sizeof (buffer));
       if (read (fd, buffer, l) < 0)
         {
-          DEBUG ("failed to read (got %d bytes) midi track: %s", l, g_strerror (errno));
+          MDEBUG ("failed to read (got %d bytes) midi track: %s", l, g_strerror (errno));
           return gsl_error_from_errno (errno, BSE_ERROR_IO);
         }
       bse_midi_decoder_push_smf_data (md, l, buffer);
diff --git a/bse/bsemidireceiver.cc b/bse/bsemidireceiver.cc
index 4c6d0ea..7f4cba9 100644
--- a/bse/bsemidireceiver.cc
+++ b/bse/bsemidireceiver.cc
@@ -15,11 +15,8 @@ using namespace Bse;
 using namespace Birnet;
 using namespace std;
 
-static SFI_MSG_TYPE_DEFINE (debug_midi_receiver, "midi-receiver", SFI_MSG_DEBUG, NULL);
-#undef DEBUG // FIXME
-#define DEBUG(...)              sfi_debug (debug_midi_receiver, __VA_ARGS__)
-static SFI_MSG_TYPE_DEFINE (debug_midi_events, "midi-events", SFI_MSG_DEBUG, NULL);
-#define DEBUG_EVENTS(...)       sfi_debug (debug_midi_events, __VA_ARGS__)
+#define MDEBUG(...)     BSE_KEY_DEBUG ("midi-receiver", __VA_ARGS__)
+#define EDEBUG(...)     BSE_KEY_DEBUG ("midi-events", __VA_ARGS__)
 
 /* --- variables --- */
 static Bse::Mutex global_midi_mutex;
@@ -647,10 +644,10 @@ voice_input_module_access_U (BseModule *module,
 {
   VoiceInput *vinput = (VoiceInput*) module->user_data;
   VoiceInputData *mdata = (VoiceInputData *) data;
-  DEBUG ("Synth<%p:%08llx>: ProcessEvent=%s Freq=%.2fHz",
-         vinput, bse_module_tick_stamp (module),
-         voice_change_to_string (mdata->vtype),
-         BSE_FREQ_FROM_VALUE (mdata->freq_value));
+  MDEBUG ("Synth<%p:%08llx>: ProcessEvent=%s Freq=%.2fHz",
+          vinput, bse_module_tick_stamp (module),
+          voice_change_to_string (mdata->vtype),
+          BSE_FREQ_FROM_VALUE (mdata->freq_value));
   switch (mdata->vtype)
     {
     case VOICE_ON:
@@ -744,10 +741,10 @@ change_voice_input_L (VoiceInput      *vinput,
   mdata.velocity = velocity;
   bse_trans_add (trans, bse_job_flow_access (vinput->fmodule, tick_stamp, voice_input_module_access_U, 
g_memdup (&mdata, sizeof (mdata)), g_free));
   vinput->tick_stamp = tick_stamp;
-  DEBUG ("Synth<%p:%08llx>: QueueEvent=%s Freq=%.2fHz",
-         vinput, tick_stamp,
-         voice_change_to_string (vtype),
-         BSE_FREQ_FROM_VALUE (freq_value));
+  MDEBUG ("Synth<%p:%08llx>: QueueEvent=%s Freq=%.2fHz",
+          vinput, tick_stamp,
+          voice_change_to_string (vtype),
+          BSE_FREQ_FROM_VALUE (freq_value));
 }
 static void
 voice_input_module_free_U (gpointer        data,
@@ -1640,8 +1637,8 @@ update_midi_signal_L (BseMidiReceiver  *self,
   change_midi_control_modules_L (signal_modules, tick_stamp,
                                  signal, value, trans);
 #if 0
-  DEBUG ("MidiChannel[%u]: Signal %3u Value=%f (%s)", channel,
-        signal, value, bse_midi_signal_name (signal));
+  MDEBUG ("MidiChannel[%u]: Signal %3u Value=%f (%s)", channel,
+          signal, value, bse_midi_signal_name (signal));
 #endif
 }
 static inline void
@@ -1780,7 +1777,7 @@ midi_receiver_process_event_L (BseMidiReceiver *self,
           MidiChannel *mchannel;
         case BSE_MIDI_NOTE_ON:
           mchannel = self->peek_channel (event->channel);
-         DEBUG_EVENTS ("MidiChannel[%u]: NoteOn  %fHz Velo=%f (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: NoteOn  %fHz Velo=%f (stamp:%llu)", event->channel,
                         event->data.note.frequency, event->data.note.velocity, event->delta_time);
          if (mchannel)
             mchannel->start_note (event->delta_time,
@@ -1793,7 +1790,7 @@ midi_receiver_process_event_L (BseMidiReceiver *self,
        case BSE_MIDI_KEY_PRESSURE:
        case BSE_MIDI_NOTE_OFF:
           mchannel = self->peek_channel (event->channel);
-          DEBUG_EVENTS ("MidiChannel[%u]: %s %fHz (stamp:%llu)", event->channel,
+          EDEBUG ("MidiChannel[%u]: %s %fHz (stamp:%llu)", event->channel,
                         event->status == BSE_MIDI_NOTE_OFF ? "NoteOff" : "NotePressure",
                         event->data.note.frequency, event->delta_time);
           if (mchannel)
@@ -1807,7 +1804,7 @@ midi_receiver_process_event_L (BseMidiReceiver *self,
             }
          break;
        case BSE_MIDI_CONTROL_CHANGE:
-         DEBUG_EVENTS ("MidiChannel[%u]: Control %2u Value=%f (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: Control %2u Value=%f (stamp:%llu)", event->channel,
                         event->data.control.control, event->data.control.value, event->delta_time);
          process_midi_control_L (self, event->channel, event->delta_time,
                                  event->data.control.control, event->data.control.value,
@@ -1815,7 +1812,7 @@ midi_receiver_process_event_L (BseMidiReceiver *self,
                                   trans);
          break;
        case BSE_MIDI_X_CONTINUOUS_CHANGE:
-         DEBUG_EVENTS ("MidiChannel[%u]: X Continuous Control %2u Value=%f (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: X Continuous Control %2u Value=%f (stamp:%llu)", event->channel,
                         event->data.control.control, event->data.control.value, event->delta_time);
          process_midi_control_L (self, event->channel, event->delta_time,
                                  event->data.control.control, event->data.control.value,
@@ -1823,28 +1820,28 @@ midi_receiver_process_event_L (BseMidiReceiver *self,
                                  trans);
          break;
        case BSE_MIDI_PROGRAM_CHANGE:
-         DEBUG_EVENTS ("MidiChannel[%u]: Program %u (Value=%f) (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: Program %u (Value=%f) (stamp:%llu)", event->channel,
                         event->data.program, event->data.program / (gfloat) 0x7f, event->delta_time);
          update_midi_signal_L (self, event->channel, event->delta_time,
                                BSE_MIDI_SIGNAL_PROGRAM, event->data.program / (gfloat) 0x7f,
                                trans);
          break;
        case BSE_MIDI_CHANNEL_PRESSURE:
-         DEBUG_EVENTS ("MidiChannel[%u]: Channel Pressure Value=%f (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: Channel Pressure Value=%f (stamp:%llu)", event->channel,
                         event->data.intensity, event->delta_time);
          update_midi_signal_L (self, event->channel, event->delta_time,
                                BSE_MIDI_SIGNAL_PRESSURE, event->data.intensity,
                                trans);
          break;
        case BSE_MIDI_PITCH_BEND:
-         DEBUG_EVENTS ("MidiChannel[%u]: Pitch Bend Value=%f (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: Pitch Bend Value=%f (stamp:%llu)", event->channel,
                         event->data.pitch_bend, event->delta_time);
          update_midi_signal_L (self, event->channel, event->delta_time,
                                BSE_MIDI_SIGNAL_PITCH_BEND, event->data.pitch_bend,
                                trans);
          break;
        default:
-         DEBUG_EVENTS ("MidiChannel[%u]: Ignoring Event %u (stamp:%llu)", event->channel,
+         EDEBUG ("MidiChannel[%u]: Ignoring Event %u (stamp:%llu)", event->channel,
                         event->status, event->delta_time);
          break;
        }
diff --git a/bse/bseobject.cc b/bse/bseobject.cc
index 06e5a25..0d35a07 100644
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@ -7,8 +7,9 @@
 #include "bsegconfig.hh"
 #include "bsesource.hh"                /* debug hack */
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_leaks, "leaks", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_leaks, __VA_ARGS__)
+
+#define LDEBUG(...)     BSE_KEY_DEBUG ("leaks", __VA_ARGS__)
+
 enum
 {
   PROP_0,
@@ -39,19 +40,19 @@ static guint       object_signals[SIGNAL_LAST] = { 0, };
 void
 bse_object_debug_leaks (void)
 {
-  if (sfi_msg_check (debug_leaks))
+  if (Bse::bse_debug_enabled ("leaks"))
     {
       GList *list, *objects = bse_objects_list (BSE_TYPE_OBJECT);
       for (list = objects; list; list = list->next)
        {
          BseObject *object = (BseObject*) list->data;
-         DEBUG ("stale %s:\t prepared=%u locked=%u ref_count=%u id=%u ((BseObject*)%p)",
-                 G_OBJECT_TYPE_NAME (object),
-                 BSE_IS_SOURCE (object) && BSE_SOURCE_PREPARED (object),
-                 object->lock_count > 0,
-                 G_OBJECT (object)->ref_count,
-                 BSE_OBJECT_ID (object),
-                 object);
+         LDEBUG ("stale %s:\t prepared=%u locked=%u ref_count=%u id=%u ((BseObject*)%p)",
+                  G_OBJECT_TYPE_NAME (object),
+                  BSE_IS_SOURCE (object) && BSE_SOURCE_PREPARED (object),
+                  object->lock_count > 0,
+                  G_OBJECT (object)->ref_count,
+                  BSE_OBJECT_ID (object),
+                  object);
        }
       g_list_free (objects);
     }
diff --git a/bse/bsepcmdevice-null.cc b/bse/bsepcmdevice-null.cc
index b8f13cb..896c921 100644
--- a/bse/bsepcmdevice-null.cc
+++ b/bse/bsepcmdevice-null.cc
@@ -3,8 +3,9 @@
 #include "bsesequencer.hh"
 #include "bseengine.hh"
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_pcm, "pcm", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_pcm, __VA_ARGS__)
+
+#define PDEBUG(...)     BSE_KEY_DEBUG ("pcm", __VA_ARGS__)
+
 typedef struct
 {
   BsePcmHandle handle;
@@ -56,7 +57,7 @@ bse_pcm_device_null_open (BseDevice     *device,
   else
     null->sleep_us = 10 * 1000;
   BSE_PCM_DEVICE (device)->handle = handle;
-  DEBUG ("NULL: opening PCM readable=%d writable=%d: %s", require_readable, require_writable, 
bse_error_blurb (BSE_ERROR_NONE));
+  PDEBUG ("NULL: opening PCM readable=%d writable=%d: %s", require_readable, require_writable, 
bse_error_blurb (BSE_ERROR_NONE));
   return BSE_ERROR_NONE;
 }
 static void
diff --git a/bse/bsepcmdevice-oss.cc b/bse/bsepcmdevice-oss.cc
index ad60164..a8a3d0e 100644
--- a/bse/bsepcmdevice-oss.cc
+++ b/bse/bsepcmdevice-oss.cc
@@ -25,8 +25,9 @@ BSE_DUMMY_TYPE (BsePcmDeviceOSS);
 #else
 #error unsupported byte order in G_BYTE_ORDER
 #endif
-static SFI_MSG_TYPE_DEFINE (debug_pcm, "pcm", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_pcm, __VA_ARGS__)
+
+#define PDEBUG(...)     BSE_KEY_DEBUG ("pcm", __VA_ARGS__)
+
 /* --- OSS PCM handle --- */
 typedef struct
 {
@@ -190,7 +191,7 @@ bse_pcm_device_oss_open (BseDevice     *device,
       g_free (oss->frag_buf);
       g_free (oss);
     }
-  DEBUG ("OSS: opening \"%s\" readable=%d writable=%d: %s", dname, require_readable, require_writable, 
bse_error_blurb (error));
+  PDEBUG ("OSS: opening \"%s\" readable=%d writable=%d: %s", dname, require_readable, require_writable, 
bse_error_blurb (error));
   return error;
 }
 static void
@@ -298,15 +299,15 @@ oss_device_setup (OSSHandle *oss,
       req_queue_length = MIN (req_queue_length, oss->queue_length);
       oss->queue_length = CLAMP (25 * handle->mix_freq / 1000, req_queue_length, oss->queue_length);
     }
-  DEBUG ("OSS: setup: w=%d r=%d n_channels=%d mix_freq=%u queue=%u nfrags=%u fsize=%u bufsz=%u",
-         handle->writable,
-         handle->readable,
-         handle->n_channels,
-         handle->mix_freq,
-         oss->queue_length,
-         oss->n_frags,
-         oss->frag_size / oss->frame_size,
-         info.bytes / oss->frame_size);
+  PDEBUG ("OSS: setup: w=%d r=%d n_channels=%d mix_freq=%u queue=%u nfrags=%u fsize=%u bufsz=%u",
+          handle->writable,
+          handle->readable,
+          handle->n_channels,
+          handle->mix_freq,
+          oss->queue_length,
+          oss->n_frags,
+          oss->frag_size / oss->frame_size,
+          info.bytes / oss->frame_size);
   return BSE_ERROR_NONE;
 }
 static void
@@ -355,7 +356,7 @@ oss_device_retrigger (OSSHandle *oss)
   while (n < 0 && errno == EAGAIN); /* retry on signals */
   g_free (silence);
   glong d_long = fcntl (oss->fd, F_GETFL);
-  DEBUG ("OSS: retriggering device (blocking=%u, r=%d, w=%d)...", (int) !(d_long & O_NONBLOCK), 
handle->readable, handle->writable);
+  PDEBUG ("OSS: retriggering device (blocking=%u, r=%d, w=%d)...", (int) !(d_long & O_NONBLOCK), 
handle->readable, handle->writable);
   oss->needs_trigger = FALSE;
 }
 static gboolean
diff --git a/bse/bseplugin.cc b/bse/bseplugin.cc
index 5e2bd79..29595c7 100644
--- a/bse/bseplugin.cc
+++ b/bse/bseplugin.cc
@@ -10,10 +10,8 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>
-static SFI_MSG_TYPE_DEFINE (debug_plugins, "plugins", SFI_MSG_DEBUG, NULL);
 
-#undef DEBUG    // FIXME
-#define DEBUG(...)      sfi_debug (debug_plugins, __VA_ARGS__)
+#define PDEBUG(...)     BSE_KEY_DEBUG ("plugins", __VA_ARGS__)
 
 /* --- prototypes --- */
 static void        bse_plugin_init             (BsePlugin        *plugin);
@@ -227,7 +225,7 @@ bse_plugin_use (GTypePlugin *gplugin)
   g_object_ref (G_OBJECT (plugin));
   if (!plugin->use_count)
     {
-      DEBUG ("reloading-plugin: %s", plugin->fname);
+      PDEBUG ("reloading-plugin: %s", plugin->fname);
       plugin->use_count++;
       startup_plugin = plugin;
       plugin->gmodule = g_module_open (plugin->fname, GModuleFlags (0)); /* reopen for use non-lazy */
@@ -277,7 +275,7 @@ bse_plugin_unload (BsePlugin *plugin)
   /* reset plugin local pointers */
   if (plugin->force_clean)
     plugin->chain = NULL;
-  DEBUG ("unloaded-plugin: %s", plugin->fname);
+  PDEBUG ("unloaded-plugin: %s", plugin->fname);
 }
 static void
 bse_plugin_unuse (GTypePlugin *gplugin)
@@ -579,7 +577,7 @@ bse_plugin_check_load (const gchar *const_file_name)
     }
   else
     file_name = g_strdup (const_file_name);
-  DEBUG ("register: %s", file_name);
+  PDEBUG ("register: %s", file_name);
   /* load module */
   BsePlugin *plugin = (BsePlugin*) g_object_new (BSE_TYPE_PLUGIN, NULL);
   plugin->fname = g_strdup (file_name);
@@ -589,7 +587,7 @@ bse_plugin_check_load (const gchar *const_file_name)
   if (!gmodule)
     {
       cerror = g_module_error ();
-      DEBUG ("error: %s: %s", file_name, cerror);
+      PDEBUG ("error: %s: %s", file_name, cerror);
       g_free (file_name);
       g_object_unref (plugin);
       return cerror;
@@ -598,7 +596,7 @@ bse_plugin_check_load (const gchar *const_file_name)
     {
       g_module_close (gmodule);
       cerror = "Plugin already loaded";
-      DEBUG ("error: %s: %s", file_name, cerror);
+      PDEBUG ("error: %s: %s", file_name, cerror);
       g_free (file_name);
       g_object_unref (plugin);
       return cerror;
@@ -608,7 +606,7 @@ bse_plugin_check_load (const gchar *const_file_name)
   if (cerror)
     {
       g_module_close (gmodule);
-      DEBUG ("error: %s: %s", file_name, cerror);
+      PDEBUG ("error: %s: %s", file_name, cerror);
       g_free (file_name);
       g_object_unref (plugin);
       return cerror;
@@ -635,7 +633,7 @@ bse_plugin_check_load (const gchar *const_file_name)
     {
       g_module_close (gmodule);
       error = NULL; /* empty plugin */
-      DEBUG ("plugin empty: %s", file_name);
+      PDEBUG ("plugin empty: %s", file_name);
       g_free (file_name);
       g_object_unref (plugin);
     }
@@ -719,7 +717,7 @@ bse_plugin_path_list_files (gboolean include_drivers,
         {
           char *name = (char*) fname->data;
           bool match = plugin_extension_filter (name, G_N_ELEMENTS (exts), exts);
-          DEBUG ("PluginExtensionFilter: %s: %s", name, match ? "(match)" : "(ignored)");
+          PDEBUG ("PluginExtensionFilter: %s: %s", name, match ? "(match)" : "(ignored)");
           if (match)
             ring = sfi_ring_append (ring, name);
           else
diff --git a/bse/bseprocedure.cc b/bse/bseprocedure.cc
index c5c7f68..4670283 100644
--- a/bse/bseprocedure.cc
+++ b/bse/bseprocedure.cc
@@ -7,12 +7,15 @@
 #include "bsestorage.hh"
 #include "bseexports.hh"
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_procs, "procs", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_procs, __VA_ARGS__)
+
+#define PDEBUG(...)       BSE_KEY_DEBUG ("procs", __VA_ARGS__)
+#define PDEBUG_ENABLED()  Bse::bse_debug_enabled ("procs")
+#define HACK_DEBUG /* very slow and leaks memory */ while (0) g_printerr
+
 /* --- macros --- */
 #define parse_or_return         bse_storage_scanner_parse_or_return
 #define peek_or_return          bse_storage_scanner_peek_or_return
-#define HACK_DEBUG /* very slow and leaks memory */ while (0) g_printerr
+
 /* --- prototypes --- */
 static void     bse_procedure_base_init           (BseProcedureClass        *proc);
 static void     bse_procedure_base_finalize       (BseProcedureClass        *proc);
@@ -212,13 +215,13 @@ bse_procedure_call (BseProcedureClass  *proc,
     error = BSE_ERROR_PROC_PARAM_INVAL;
   else
     {
-      if (sfi_msg_check (debug_procs))
+      if (PDEBUG_ENABLED())
         {
           if (proc->n_in_pspecs && G_TYPE_IS_OBJECT (G_PARAM_SPEC_VALUE_TYPE (proc->in_pspecs[0])))
-            DEBUG ("executing procedure \"%s\" on object %s",
-                   BSE_PROCEDURE_NAME (proc), bse_object_debug_name (g_value_get_object (ivalues + 0)));
+            PDEBUG ("executing procedure \"%s\" on object %s",
+                    BSE_PROCEDURE_NAME (proc), bse_object_debug_name (g_value_get_object (ivalues + 0)));
           else
-            DEBUG ("executing procedure \"%s\"", BSE_PROCEDURE_NAME (proc));
+            PDEBUG ("executing procedure \"%s\"", BSE_PROCEDURE_NAME (proc));
         }
       if (marshal)
         error = marshal (marshal_data, proc, ivalues, ovalues);
@@ -301,7 +304,7 @@ bse_procedure_call_collect (BseProcedureClass  *proc,
 {
   guint i, bail_out = FALSE;
   BseErrorType error = BSE_ERROR_NONE;
-  HACK_DEBUG ("call %s: ", BSE_PROCEDURE_NAME (proc));
+  PDEBUG ("call %s: ", BSE_PROCEDURE_NAME (proc));
   /* collect first arg */
   if (first_value && first_value != ivalues) /* may skip this since bse_procedure_call() does extra 
validation */
     {
@@ -360,7 +363,7 @@ bse_procedure_call_collect (BseProcedureClass  *proc,
         error = BSE_ERROR_PROC_PARAM_INVAL;
       else
         error = bse_procedure_call (proc, ivalues, ovalues, marshal, marshal_data);
-      HACK_DEBUG ("  call result: %s", bse_error_blurb (error));
+      PDEBUG ("  call result: %s", bse_error_blurb (error));
       signal_exec_status (error, proc, ovalues);
       /* free input arguments */
       for (i = 0; i < proc->n_in_pspecs; i++)
@@ -386,7 +389,7 @@ bse_procedure_call_collect (BseProcedureClass  *proc,
         }
     }
   else
-    HACK_DEBUG ("  call skipped");
+    PDEBUG ("  call skipped");
   return error;
 }
 /**
diff --git a/bse/bsestorage.cc b/bse/bsestorage.cc
index 6b9e80e..4f1a273 100644
--- a/bse/bsestorage.cc
+++ b/bse/bsestorage.cc
@@ -14,9 +14,9 @@
 #include <string.h>
 #include <errno.h>
 /* --- macros --- */
-#define DEBUG           sfi_nodebug
 #define parse_or_return sfi_scanner_parse_or_return
 #define peek_or_return  sfi_scanner_peek_or_return
+
 /* --- typedefs --- */
 struct _BseStorageDBlock
 {
@@ -422,11 +422,13 @@ bse_storage_item_get_compat_type (BseItem *item)
     type = G_OBJECT_TYPE_NAME (item);
   return type;
 }
+
 typedef struct {
   BseContainer *container;
   gchar        *uname;
   BseItem      *item;
 } UNameChild;
+
 static guint
 uname_child_hash (gconstpointer uc)
 {
@@ -435,6 +437,7 @@ uname_child_hash (gconstpointer uc)
   h ^= G_HASH_LONG ((long) uchild->container);
   return h;
 }
+
 static gint
 uname_child_equals (gconstpointer uc1,
                     gconstpointer uc2)
@@ -444,6 +447,7 @@ uname_child_equals (gconstpointer uc1,
   return (bse_string_equals (uchild1->uname, uchild2->uname) &&
           uchild1->container == uchild2->container);
 }
+
 static void
 uname_child_free (gpointer uc)
 {
@@ -453,6 +457,7 @@ uname_child_free (gpointer uc)
   g_object_unref (uchild->item);
   g_free (uchild);
 }
+
 static void
 storage_path_table_insert (BseStorage   *self,
                            BseContainer *container,
@@ -474,8 +479,9 @@ storage_path_table_insert (BseStorage   *self,
   if (uchild->item)
     g_object_unref (uchild->item);
   uchild->item = (BseItem*) g_object_ref (item);
-  DEBUG ("INSERT: (%p,%s) => %p", container, uname, item);
+  // DEBUG ("INSERT: (%p,%s) => %p", container, uname, item);
 }
+
 static inline BseItem*
 storage_path_table_lookup (BseStorage   *self,
                            BseContainer *container,
@@ -485,7 +491,7 @@ storage_path_table_lookup (BseStorage   *self,
   key.container = container;
   key.uname = (gchar*) uname;
   uchild = (UNameChild*) g_hash_table_lookup (self->path_table, &key);
-  DEBUG ("LOOKUP: (%p,%s) => %p", container, uname, uchild ? uchild->item : NULL);
+  // DEBUG ("LOOKUP: (%p,%s) => %p", container, uname, uchild ? uchild->item : NULL);
   if (uchild)
     return uchild->item;
   /* we resort to container lookups in case
@@ -494,6 +500,7 @@ storage_path_table_lookup (BseStorage   *self,
    */
   return bse_container_lookup_item (container, uname);
 }
+
 static BseItem*
 storage_path_table_resolve_upath (BseStorage   *self,
                                   BseContainer *container,
diff --git a/bse/bseundostack.cc b/bse/bseundostack.cc
index 1d59bd3..9702ce7 100644
--- a/bse/bseundostack.cc
+++ b/bse/bseundostack.cc
@@ -3,8 +3,10 @@
 #include "bseproject.hh"
 #include "bsecontainer.hh"
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_undo, "undo", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_undo, __VA_ARGS__)
+
+#define UDEBUG(...)       BSE_KEY_DEBUG ("undo", __VA_ARGS__)
+#define UDEBUG_ENABLED()  Bse::bse_debug_enabled ("undo")
+
 /* --- functions --- */
 BseUndoStack*
 bse_undo_stack_dummy (void)
@@ -93,7 +95,7 @@ bse_undo_group_open (BseUndoStack   *self,
       self->group->stamp = 0;
       self->group->name = g_strdup (name);
       self->group->undo_steps = NULL;
-      DEBUG ("undo open: { // %s", name);
+      UDEBUG ("undo open: { // %s", name);
     }
   self->n_open_groups++;
   self->debug_names = g_slist_prepend (self->debug_names, g_strdup (name));
@@ -112,12 +114,12 @@ bse_undo_stack_push (BseUndoStack *self,
   g_return_if_fail (ustep != NULL);
   if (self->ignore_steps)
     {
-      DEBUG ("undo step:  -    ignored: ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
+      UDEBUG ("undo step:  -    ignored: ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
       bse_undo_step_free (ustep);
     }
   else
     {
-      DEBUG ("undo step:  *    ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
+      UDEBUG ("undo step:  *    ((BseUndoFunc) %p) (%s)", ustep->undo_func, debug_name);
       ustep->debug_name = g_strdup (debug_name);
       self->group->undo_steps = sfi_ring_push_head (self->group->undo_steps, ustep);
     }
@@ -134,7 +136,7 @@ bse_undo_stack_push_add_on (BseUndoStack *self,
   /* add this step to the last undo step if we have one */
   if (self->group && self->group->undo_steps)
     {
-      DEBUG ("undo step:  *    ((BseUndoFunc) %p) [AddOn to current group]", ustep->undo_func);
+      UDEBUG ("undo step:  *    ((BseUndoFunc) %p) [AddOn to current group]", ustep->undo_func);
       ustep->debug_name = g_strdup ("AddOn");
       self->group->undo_steps = sfi_ring_push_head (self->group->undo_steps, ustep);
     }
@@ -142,13 +144,13 @@ bse_undo_stack_push_add_on (BseUndoStack *self,
     {
       BseUndoGroup *group = (BseUndoGroup*) self->undo_groups->data;    /* fetch last group */
       g_return_if_fail (group->undo_steps != NULL);     /* empty groups are not allowed */
-      DEBUG ("undo step:  *    ((BseUndoFunc) %p) [AddOn to last group]", ustep->undo_func);
+      UDEBUG ("undo step:  *    ((BseUndoFunc) %p) [AddOn to last group]", ustep->undo_func);
       ustep->debug_name = g_strdup ("AddOn");
       group->undo_steps = sfi_ring_push_head (group->undo_steps, ustep);
     }
   else
     {
-      DEBUG ("undo step:  -    ignored: ((BseUndoFunc) %p) [AddOn]", ustep->undo_func);
+      UDEBUG ("undo step:  -    ignored: ((BseUndoFunc) %p) [AddOn]", ustep->undo_func);
       bse_undo_step_free (ustep);
     }
 }
@@ -172,7 +174,7 @@ bse_undo_group_close (BseUndoStack *self)
           step_added = FALSE;
           g_free (self->group->name);
           g_free (self->group);
-          DEBUG ("undo skip  }");
+          UDEBUG ("undo skip  }");
         }
       else
         {
@@ -197,7 +199,7 @@ bse_undo_group_close (BseUndoStack *self)
               self->dirt_counter++;
             }
           bse_undo_stack_limit (self, self->max_steps);
-          DEBUG ("undo close }");
+          UDEBUG ("undo close }");
         }
       self->group = NULL;
       if (self->notify && step_added)
@@ -268,14 +270,14 @@ bse_undo_stack_undo (BseUndoStack *self)
     {
       self->n_undo_groups--;
       self->dirt_counter--;
-      DEBUG ("EXECUTE UNDO: %s", group->name);
-      if (sfi_msg_check (debug_undo))
+      UDEBUG ("EXECUTE UNDO: %s", group->name);
+      if (UDEBUG_ENABLED())
         {
           SfiRing *ring = group->undo_steps;
           for (ring = group->undo_steps; ring; ring = sfi_ring_walk (ring, group->undo_steps))
             {
               BseUndoStep *ustep = (BseUndoStep*) ring->data;
-              DEBUG ("   STEP UNDO: %s", ustep->debug_name);
+              UDEBUG ("   STEP UNDO: %s", ustep->debug_name);
             }
         }
       while (group->undo_steps)
diff --git a/bse/gslvorbis-cutter.cc b/bse/gslvorbis-cutter.cc
index b8e6dbd..c7ff54a 100644
--- a/bse/gslvorbis-cutter.cc
+++ b/bse/gslvorbis-cutter.cc
@@ -4,9 +4,9 @@
 #include <vorbis/codec.h>
 #include <string.h>
 #include <errno.h>
-static SFI_MSG_TYPE_DEFINE (debug_vorbis, "vorbis", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_vorbis, __VA_ARGS__)
-#define DIAG(...)       sfi_diag (__VA_ARGS__)
+
+#define VDEBUG(...)     BSE_KEY_DEBUG ("vorbis", __VA_ARGS__)
+
 /* --- structures --- */
 typedef struct {
   guint length;
@@ -205,7 +205,7 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
       error = vorbis_synthesis_headerin (&self->vinfo, &self->vcomment, opacket);
       if (error < 0)
         {
-          DIAG ("ignoring packet preceeding Vorbis stream: %s", ov_error_blurb (error));
+          VDEBUG ("ignoring packet preceeding Vorbis stream: %s", ov_error_blurb (error));
         }
       else /* valid vorbis stream start */
         {
@@ -218,7 +218,7 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
       error = vorbis_synthesis_headerin (&self->vinfo, &self->vcomment, opacket);
       if (error < 0)
         {
-          DIAG ("invalid Vorbis (comment) header packet: %s", ov_error_blurb (error));
+          VDEBUG ("invalid Vorbis (comment) header packet: %s", ov_error_blurb (error));
           vorbis_cutter_abort (self);
         }
       else
@@ -228,7 +228,7 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
       error = vorbis_synthesis_headerin (&self->vinfo, &self->vcomment, opacket);
       if (error < 0)
         {
-          DIAG ("invalid Vorbis (codebook) header packet: %s", ov_error_blurb (error));
+          VDEBUG ("invalid Vorbis (codebook) header packet: %s", ov_error_blurb (error));
           vorbis_cutter_abort (self);
         }
       else
@@ -242,7 +242,7 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
     default:    /* audio packets */
       window = vorbis_packet_blocksize (&self->vinfo, opacket);
       if (window < 0)
-        DIAG ("skipping package: %s", ov_error_blurb (window));
+        VDEBUG ("skipping package: %s", ov_error_blurb (window));
       else
         {
           self->n_packets++;
@@ -259,10 +259,10 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
       if (self->n_packets > 3)  /* audio packet */
         {
           gboolean last_on_page = FALSE;
-          DEBUG ("packet[%d]: b_o_s=%ld e_o_s=%ld packetno=%ld pgran=%ld granule=%ld", self->n_packets - 1,
-                 opacket->b_o_s, opacket->e_o_s,
-                 opacket->packetno, opacket->granulepos,
-                 self->tracking_granule);
+          VDEBUG ("packet[%d]: b_o_s=%ld e_o_s=%ld packetno=%ld pgran=%ld granule=%ld", self->n_packets - 1,
+                  opacket->b_o_s, opacket->e_o_s,
+                  opacket->packetno, opacket->granulepos,
+                  self->tracking_granule);
           /* update packet granulepos */
           if (opacket->granulepos < 0)
             opacket->granulepos = self->tracking_granule;
@@ -270,7 +270,7 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
             {
               if (!opacket->e_o_s &&    /* catch granule mismatches (before end) */
                   self->tracking_granule != opacket->granulepos)
-                DIAG ("failed to track position of input ogg stream, output possibly corrupted");
+                VDEBUG ("failed to track position of input ogg stream, output possibly corrupted");
               self->tracking_granule = opacket->granulepos;
               last_on_page = TRUE;      /* only the last packet of a page has a granule */
             }
@@ -294,9 +294,9 @@ vorbis_cutter_process_paket (GslVorbisCutter *self,
               }
         }
       else
-        DEBUG ("packet[%d]: b_o_s=%ld e_o_s=%ld packetno=%ld pgran=%ld", self->n_packets - 1,
-               opacket->b_o_s, opacket->e_o_s,
-               opacket->packetno, opacket->granulepos);
+        VDEBUG ("packet[%d]: b_o_s=%ld e_o_s=%ld packetno=%ld pgran=%ld", self->n_packets - 1,
+                opacket->b_o_s, opacket->e_o_s,
+                opacket->packetno, opacket->granulepos);
       /* copy packet to output stream */
       ogg_stream_packetin (&self->ostream, opacket);
       /* write output stream (vorbis needs certain packets to be page-flushed) */
diff --git a/bse/gslvorbis-enc.cc b/bse/gslvorbis-enc.cc
index d9e5293..1561e1f 100644
--- a/bse/gslvorbis-enc.cc
+++ b/bse/gslvorbis-enc.cc
@@ -6,8 +6,9 @@
 #include <vorbis/vorbisenc.h>
 #include <string.h>
 #include <errno.h>
-static SFI_MSG_TYPE_DEFINE (debug_vorbisenc, "vorbisenc", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_vorbisenc, __VA_ARGS__)
+
+#define VDEBUG(...)     BSE_KEY_DEBUG ("vorbis", __VA_ARGS__)
+
 /* --- structures --- */
 typedef struct {
   guint length;
@@ -216,8 +217,8 @@ gsl_vorbis_encoder_setup_stream (GslVorbisEncoder *self,
   g_return_val_if_fail (self->stream_setup == FALSE, BSE_ERROR_INTERNAL);
   self->serial = serial;
   vorbis_info_init (&self->vinfo);
-  DEBUG ("init: channels=%u mixfreq=%u quality=%f bitrate=%d\n",
-         self->n_channels, self->sample_freq, self->vbr_quality, self->vbr_nominal);
+  VDEBUG ("init: channels=%u mixfreq=%u quality=%f bitrate=%d\n",
+          self->n_channels, self->sample_freq, self->vbr_quality, self->vbr_nominal);
   if (self->vbr_nominal > 0)    /* VBR setup by nominal bitrate */
     result = vorbis_encode_setup_managed (&self->vinfo,
                                           self->n_channels,
diff --git a/bse/gslwaveosc.cc b/bse/gslwaveosc.cc
index c1b713b..2beab53 100644
--- a/bse/gslwaveosc.cc
+++ b/bse/gslwaveosc.cc
@@ -5,11 +5,13 @@
 #include "bseengine.hh"        /* for bse_engine_sample_freq() */
 #include "bsemain.hh"
 #include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_waveosc, "waveosc", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...)      sfi_debug (debug_waveosc, __VA_ARGS__)
+
+#define WDEBUG(...)     BSE_KEY_DEBUG ("waveosc", __VA_ARGS__)
+
 #define FRAC_SHIFT             (16)
 #define FRAC_MASK              ((1 << FRAC_SHIFT) - 1)
 #define        SIGNAL_LEVEL_INVAL      (-2.0)  /* trigger level-changed checks */
+
 /* --- prototype --- */
 static void    wave_osc_transform_filter       (GslWaveOscData *wosc,
                                                 gfloat          play_freq);
@@ -183,10 +185,10 @@ gsl_wave_osc_process (GslWaveOscData *wosc,
       !(fabs (wosc->y[0]) > BSE_SIGNAL_EPSILON && fabs (wosc->y[0]) < BSE_SIGNAL_KAPPA))
     {
       guint i;
-      DEBUG ("clearing filter state at:\n");
+      WDEBUG ("clearing filter state at:\n");
       for (i = 0; i < GSL_WAVE_OSC_FILTER_ORDER; i++)
        {
-         DEBUG ("%u) %+.38f\n", i, wosc->y[i]);
+         WDEBUG ("%u) %+.38f\n", i, wosc->y[i]);
          if (BSE_DOUBLE_IS_INF (wosc->y[0]) || fabs (wosc->y[0]) > BSE_SIGNAL_KAPPA)
            wosc->y[i] = BSE_DOUBLE_SIGN (wosc->y[0]) ? -1.0 : 1.0;
          else
@@ -239,7 +241,7 @@ gsl_wave_osc_set_filter (GslWaveOscData *wosc,
          wosc->b[GSL_WAVE_OSC_FILTER_ORDER - i] = wosc->b[i];
          wosc->b[i] = t;
        }
-      DEBUG ("filter: fc=%f fr=%f st=%f is=%u\n", freq_c/PI*2, freq_r/PI*2, step, wosc->istep);
+      WDEBUG ("filter: fc=%f fr=%f st=%f is=%u\n", freq_c/PI*2, freq_r/PI*2, step, wosc->istep);
     }
   if (clear_state)
     {
@@ -286,8 +288,7 @@ gsl_wave_osc_retrigger (GslWaveOscData *wosc,
   wosc->block.offset = wosc->config.start_offset;
   gsl_wave_chunk_use_block (wosc->wchunk, &wosc->block);
   wosc->x = wosc->block.start + CLAMP (wosc->config.channel, 0, wosc->wchunk->n_channels - 1);
-  DEBUG ("wave lookup: want=%f got=%f length=%llu\n",
-        base_freq, wosc->wchunk->osc_freq, wosc->wchunk->wave_length);
+  WDEBUG ("wave lookup: want=%f got=%f length=%llu\n", base_freq, wosc->wchunk->osc_freq, 
wosc->wchunk->wave_length);
   wosc->last_freq_level = BSE_SIGNAL_FROM_FREQ (base_freq);
   wosc->last_mod_level = 0;
   gsl_wave_osc_set_filter (wosc, base_freq, TRUE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]