[beast/devel: 35/77] BSE: use BSE_KEY_DEBUG() instead of sfi debugging
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 35/77] BSE: use BSE_KEY_DEBUG() instead of sfi debugging
- Date: Wed, 1 May 2013 17:30:16 +0000 (UTC)
commit 6152069ae54e0d43e0e3ff3e6816074b0233bf56
Author: Tim Janik <timj gnu org>
Date: Sun Apr 7 19:34:04 2013 +0200
BSE: use BSE_KEY_DEBUG() instead of sfi debugging
bse/bsebiquadfilter.cc | 25 +++++++++--------
bse/bsemididevice-null.cc | 8 +++--
bse/bsemididevice-oss.cc | 10 +++++--
bse/bsetrack.cc | 7 +++-
bse/gsldatahandle-mad.cc | 65 +++++++++++++++++++++++---------------------
bse/gslosctable.cc | 33 ++++++++++++-----------
6 files changed, 81 insertions(+), 67 deletions(-)
---
diff --git a/bse/bsebiquadfilter.cc b/bse/bsebiquadfilter.cc
index e71f027..8a710a5 100644
--- a/bse/bsebiquadfilter.cc
+++ b/bse/bsebiquadfilter.cc
@@ -3,8 +3,9 @@
#include <bse/bsecategories.hh>
#include <bse/bseengine.hh>
#include <bse/bsemathsignal.hh>
-static SFI_MSG_TYPE_DEFINE (debug_biquadfilter, "biquadfilter", SFI_MSG_DEBUG, NULL);
-#define DEBUG(...) sfi_debug (debug_biquadfilter, __VA_ARGS__)
+
+#define FDEBUG(...) BSE_KEY_DEBUG ("biquadfilter", __VA_ARGS__)
+
#define FREQ_DELTA 0.1
/* --- parameters --- */
enum
@@ -319,18 +320,18 @@ bse_biquad_filter_update_modules (BseBiquadFilter *self)
gsl_biquad_config_init (&c, GslBiquadType (self->filter_type), GslBiquadNormalize
(self->norm_type));
gsl_biquad_config_setup (&c, self->freq / nyquist_freq, self->gain, 0);
gsl_biquad_filter_config (&biquad, &c, TRUE);
- DEBUG ("Bxx(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
- biquad.xc0, biquad.xc1, biquad.xc2, biquad.yc1, biquad.yc2);
+ FDEBUG ("Bxx(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
+ biquad.xc0, biquad.xc1, biquad.xc2, biquad.yc1, biquad.yc2);
gsl_biquad_config_approx_gain (&c, self->gain);
gsl_biquad_filter_config (&approx, &c, TRUE);
- DEBUG ("Byy(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
- approx.xc0, approx.xc1, approx.xc2, approx.yc1, approx.yc2);
- DEBUG ("Bdd(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
- biquad.xc0 - approx.xc0,
- biquad.xc1 - approx.xc1,
- biquad.xc2 - approx.xc2,
- biquad.yc1 - approx.yc1,
- biquad.yc2 - approx.yc2);
+ FDEBUG ("Byy(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
+ approx.xc0, approx.xc1, approx.xc2, approx.yc1, approx.yc2);
+ FDEBUG ("Bdd(z) = (%.14g + (%.14g + %.14g * z) * z) / (1 + (%.14g + %.14g * z) * z)\n",
+ biquad.xc0 - approx.xc0,
+ biquad.xc1 - approx.xc1,
+ biquad.xc2 - approx.xc2,
+ biquad.yc1 - approx.yc1,
+ biquad.yc2 - approx.yc2);
}
}
}
diff --git a/bse/bsemididevice-null.cc b/bse/bsemididevice-null.cc
index c895ad3..6028188 100644
--- a/bse/bsemididevice-null.cc
+++ b/bse/bsemididevice-null.cc
@@ -1,13 +1,15 @@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#include "bsemididevice-null.hh"
#include "bseserver.hh"
-static SFI_MSG_TYPE_DEFINE (debug_midi, "midi", SFI_MSG_DEBUG, NULL);
-#define MIDI_DEBUG(...) sfi_debug (debug_midi, __VA_ARGS__)
+
+#define MDEBUG(...) BSE_KEY_DEBUG ("midi-null", __VA_ARGS__)
+
/* --- structs --- */
typedef struct
{
BseMidiHandle handle;
} NULLHandle;
+
/* --- functions --- */
static void
bse_midi_device_null_init (BseMidiDeviceNULL *null)
@@ -34,7 +36,7 @@ bse_midi_device_null_open (BseDevice *device,
handle->writable = require_writable;
bse_device_set_opened (device, "null", handle->readable, handle->writable);
BSE_MIDI_DEVICE (device)->handle = handle;
- MIDI_DEBUG ("NULL: opening MIDI readable=%d writable=%d: %s", require_readable, require_writable,
bse_error_blurb (BSE_ERROR_NONE));
+ MDEBUG ("opening MIDI 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/bsemididevice-oss.cc b/bse/bsemididevice-oss.cc
index 7bc9dae..e6efc27 100644
--- a/bse/bsemididevice-oss.cc
+++ b/bse/bsemididevice-oss.cc
@@ -5,6 +5,7 @@
#include "gslcommon.hh" // FIXME: remove
#include "bsesequencer.hh"
#include "topconfig.h"
+
#ifndef BSE_MIDI_DEVICE_CONF_OSS
BSE_DUMMY_TYPE (BseMidiDeviceOSS);
#else /* BSE_MIDI_DEVICE_CONF_OSS */
@@ -13,6 +14,7 @@ BSE_DUMMY_TYPE (BseMidiDeviceOSS);
#elif HAVE_SOUNDCARD_H
#include <soundcard.h>
#endif
+
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/time.h>
@@ -20,14 +22,16 @@ BSE_DUMMY_TYPE (BseMidiDeviceOSS);
#include <errno.h>
#include <string.h>
#include <fcntl.h>
-static SFI_MSG_TYPE_DEFINE (debug_midi, "midi", SFI_MSG_DEBUG, NULL);
-#define MIDI_DEBUG(...) sfi_debug (debug_midi, __VA_ARGS__)
+
+#define MDEBUG(...) BSE_KEY_DEBUG ("midi-oss", __VA_ARGS__)
+
/* --- structs --- */
typedef struct
{
BseMidiHandle handle;
int fd;
} OSSHandle;
+
/* --- prototypes --- */
static gboolean oss_midi_io_handler (void *data,
uint n_pfds,
@@ -160,7 +164,7 @@ bse_midi_device_oss_open (BseDevice *device,
close (oss->fd);
g_free (oss);
}
- MIDI_DEBUG ("OSS: opening \"%s\" readable=%d writable=%d: %s", dname, require_readable, require_writable,
bse_error_blurb (error));
+ MDEBUG ("opening \"%s\" readable=%d writable=%d: %s", dname, require_readable, require_writable,
bse_error_blurb (error));
return error;
}
static void
diff --git a/bse/bsetrack.cc b/bse/bsetrack.cc
index 5b1a1cc..bc03d0e 100644
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@ -16,11 +16,13 @@
#include "bsewaverepo.hh"
#include "bsecxxplugin.hh"
#include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_xref, "xref", SFI_MSG_DEBUG, NULL);
-#define XREF_DEBUG(...) sfi_debug (debug_xref, __VA_ARGS__)
+
+#define XREF_DEBUG(...) BSE_KEY_DEBUG ("xref", __VA_ARGS__)
+
#define upper_power2(uint_n) sfi_alloc_upper_power2 (MAX ((uint_n), 4))
#define parse_or_return bse_storage_scanner_parse_or_return
#define peek_or_return bse_storage_scanner_peek_or_return
+
enum {
PROP_0,
PROP_MUTED,
@@ -31,6 +33,7 @@ enum {
PROP_PNET,
PROP_OUTPUTS
};
+
/* --- prototypes --- */
static void bse_track_class_init (BseTrackClass *klass);
static void bse_track_init (BseTrack *self);
diff --git a/bse/gsldatahandle-mad.cc b/bse/gsldatahandle-mad.cc
index 807fe31..0555b98 100644
--- a/bse/gsldatahandle-mad.cc
+++ b/bse/gsldatahandle-mad.cc
@@ -13,16 +13,18 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+
+#define MDEBUG(...) BSE_KEY_DEBUG ("mad", __VA_ARGS__)
+
BIRNET_STATIC_ASSERT (BSE_HAVE_LIBMAD + 42); // assert BSE_HAVE_LIBMAD2 is defined
#if BSE_HAVE_LIBMAD
#include <mad.h>
-/* --- debugging and errors --- */
-static SFI_MSG_TYPE_DEFINE (debug_mad, "mad", SFI_MSG_DEBUG, NULL);
-#define MAD_DEBUG(...) sfi_debug (debug_mad, __VA_ARGS__)
+
/* --- defines --- */
#define FILE_BUFFER_SIZE (1024 * 44) /* approximately 1 second at 320 kbit */
#define SEEK_BY_READ_AHEAD(h) (((h)->sample_rate / ((h)->frame_size * 2))) /* FIXME */
#define MAX_CHANNELS (5)
+
/* --- typedefs & structures --- */
typedef struct
{
@@ -138,7 +140,7 @@ check_frame_validity (MadHandle *handle,
}
if (reason)
{
- MAD_DEBUG ("skipping frame: %s", reason);
+ MDEBUG ("skipping frame: %s", reason);
return FALSE;
}
else
@@ -240,19 +242,19 @@ create_seek_table (MadHandle *handle,
if (0)
{
if (mad_frame_decode (&handle->frame, &handle->stream) < 0)
- MAD_DEBUG ("failed to read seektable frame: %s", mad_stream_errorstr (&handle->stream));
+ MDEBUG ("failed to read seektable frame: %s", mad_stream_errorstr (&handle->stream));
mad_synth_frame (&handle->synth, &handle->frame);
- MAD_DEBUG ("frame(%u) PCM:%u => FILE:%u FDIFF:%d (%x %x %x) br:%lu time:%ld/%lu mode:%u ext:%u
flags:0x%x phase:%u",
- i, i * handle->frame_size, this_pos, this_pos - seeks[MAX (i, 1) - 1],
- handle->stream.this_frame[0], handle->stream.this_frame[1],
- (handle->stream.this_frame[1] >> 1) & 3,
- handle->frame.header.bitrate,
- handle->frame.header.duration.seconds,
- handle->frame.header.duration.fraction,
- handle->frame.header.mode,
- handle->frame.header.mode_extension,
- handle->frame.header.flags,
- handle->synth.phase);
+ MDEBUG ("frame(%u) PCM:%u => FILE:%u FDIFF:%d (%x %x %x) br:%lu time:%ld/%lu mode:%u ext:%u
flags:0x%x phase:%u",
+ i, i * handle->frame_size, this_pos, this_pos - seeks[MAX (i, 1) - 1],
+ handle->stream.this_frame[0], handle->stream.this_frame[1],
+ (handle->stream.this_frame[1] >> 1) & 3,
+ handle->frame.header.bitrate,
+ handle->frame.header.duration.seconds,
+ handle->frame.header.duration.fraction,
+ handle->frame.header.mode,
+ handle->frame.header.mode_extension,
+ handle->frame.header.flags,
+ handle->synth.phase);
}
}
if (!handle->eof)
@@ -261,7 +263,7 @@ create_seek_table (MadHandle *handle,
/* frame read failed for a reason other than eof */
if (!handle->error)
handle->error = BSE_ERROR_IO;
- MAD_DEBUG ("failed to read seektable frame: %s", handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
+ MDEBUG ("failed to read seektable frame: %s", handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
return NULL;
}
}
@@ -345,7 +347,7 @@ dh_mad_open (GslDataHandle *dhandle,
error = BSE_ERROR_NO_SEEK_INFO;
goto OPEN_FAILED;
}
- MAD_DEBUG ("frames in seektable: %u", handle->n_seeks);
+ MDEBUG ("frames in seektable: %u", handle->n_seeks);
}
}
/* validate/setup handle length */
@@ -420,22 +422,22 @@ dh_mad_read (GslDataHandle *dhandle,
if (handle->accumulate_state_frames < 10)
{
handle->accumulate_state_frames++;
- MAD_DEBUG ("retrying seek with accumulate_state_frames=%d",
- handle->accumulate_state_frames);
+ MDEBUG ("retrying seek with accumulate_state_frames=%d",
+ handle->accumulate_state_frames);
/* force dh_mad_read to retry the seek */
dh_mad_coarse_seek (dhandle, 0);
return dh_mad_read (dhandle, voffset, n_values, values);
}
else
{
- MAD_DEBUG ("synthesizing frame failed, accumulate_state_frames is already %u: %s",
- handle->accumulate_state_frames, handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
+ MDEBUG ("synthesizing frame failed, accumulate_state_frames is already %u: %s",
+ handle->accumulate_state_frames, handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
return -1;
}
}
else
{
- MAD_DEBUG ("failed to synthesize frame: %s", handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
+ MDEBUG ("failed to synthesize frame: %s", handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (handle->error));
return -1;
}
}
@@ -515,15 +517,15 @@ dh_mad_coarse_seek (GslDataHandle *dhandle,
{
gboolean synth = i + 1 == handle->accumulate_state_frames;
if (!pcm_frame_read (handle, synth) && handle->stream.error != MAD_ERROR_BADDATAPTR)
- MAD_DEBUG ("failed to read frame ahead (%u) in coarse-seek: failed: %s", i,
- handle->stream.error ? mad_stream_errorstr (&handle->stream) : bse_error_blurb
(handle->error));
+ MDEBUG ("failed to read frame ahead (%u) in coarse-seek: failed: %s", i,
+ handle->stream.error ? mad_stream_errorstr (&handle->stream) : bse_error_blurb
(handle->error));
}
}
- MAD_DEBUG ("seek-done: at %llu (f:%llu) want %llu (f:%llu) got %llu (f:%llu) diff %lld (diff-requested
%lld)",
- opos, opos / handle->frame_size,
- pos, pos / handle->frame_size,
- handle->pcm_pos, handle->pcm_pos / handle->frame_size,
- handle->pcm_pos - opos, pos - opos);
+ MDEBUG ("seek-done: at %llu (f:%llu) want %llu (f:%llu) got %llu (f:%llu) diff %lld (diff-requested
%lld)",
+ opos, opos / handle->frame_size,
+ pos, pos / handle->frame_size,
+ handle->pcm_pos, handle->pcm_pos / handle->frame_size,
+ handle->pcm_pos - opos, pos - opos);
}
return handle->pcm_pos * dhandle->setup.n_channels;
}
@@ -601,7 +603,7 @@ dh_mad_new (const gchar *file_name,
*errorp = BSE_ERROR_NONE;
return &handle->dhandle;
}
- MAD_DEBUG ("failed to open \"%s\": %s", file_name, handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (error));
+ MDEBUG ("failed to open \"%s\": %s", file_name, handle->stream.error ? mad_stream_errorstr
(&handle->stream) : bse_error_blurb (error));
gsl_data_handle_unref (&handle->dhandle);
*errorp = error;
return NULL;
@@ -673,6 +675,7 @@ gsl_data_handle_mad_version (void)
return NULL;
}
#endif /* !BSE_HAVE_LIBMAD */
+
GslDataHandle*
gsl_data_handle_new_mad (const gchar *file_name,
gfloat osc_freq)
diff --git a/bse/gslosctable.cc b/bse/gslosctable.cc
index 249771d..509a994 100644
--- a/bse/gslosctable.cc
+++ b/bse/gslosctable.cc
@@ -4,8 +4,9 @@
#include "bsemath.hh"
#include "gslfft.hh"
#include <string.h>
-static SFI_MSG_TYPE_DEFINE (debug_osc, "osc", SFI_MSG_DEBUG, NULL);
-#define OSC_DEBUG(...) sfi_debug (debug_osc, __VA_ARGS__)
+
+#define ODEBUG(...) BSE_KEY_DEBUG ("osc", __VA_ARGS__)
+
#define OSC_FREQ_EPSILON (1e-3) /* range within which frequencies are "equal" */
/* compare mfreqs against each other, use an arbitrary sample rate
* for which OSC_FREQ_EPSILON makes sense
@@ -156,20 +157,20 @@ osc_table_entry_lookup_best (const GslOscTable *table,
if (i + 1 < g_bsearch_array_get_n_nodes (table->entry_array))
{
ep = (OscTableEntry**) g_bsearch_array_get_nth (table->entry_array, &osc_taconfig, i + 1);
- OSC_DEBUG ("osc-lookup: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
- mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
- table, i + 1, g_bsearch_array_get_n_nodes (table->entry_array));
+ ODEBUG ("osc-lookup: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
+ mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
+ table, i + 1, g_bsearch_array_get_n_nodes (table->entry_array));
}
else /* bad, might cause aliasing */
- OSC_DEBUG ("osc-lookup: mismatch, aliasing possible: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
- mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
- table, i, g_bsearch_array_get_n_nodes (table->entry_array));
+ ODEBUG ("osc-lookup: mismatch, aliasing possible: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
+ mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
+ table, i, g_bsearch_array_get_n_nodes (table->entry_array));
}
else
- OSC_DEBUG ("osc-lookup: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
- mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
- table, g_bsearch_array_get_index (table->entry_array, &osc_taconfig, ep),
- g_bsearch_array_get_n_nodes (table->entry_array));
+ ODEBUG ("osc-lookup: want_freq=%f got_freq=%f (table=%p, i=%u, n=%u)",
+ mfreq * table->mix_freq, (*ep)->mfreq * table->mix_freq,
+ table, g_bsearch_array_get_index (table->entry_array, &osc_taconfig, ep),
+ g_bsearch_array_get_n_nodes (table->entry_array));
if (min_mfreq)
{
/* fetch mfreq from previous */
@@ -306,8 +307,8 @@ gsl_osc_table_create (gfloat mix_freq,
table->entry_array = g_bsearch_array_insert (table->entry_array, &osc_taconfig, &e);
}
else if (e)
- OSC_DEBUG ("not inserting existing entry (freq=%f) for freq %f (nyquist=%f)",
- e->mfreq * table->mix_freq, mfreq * table->mix_freq, nyquist);
+ ODEBUG ("not inserting existing entry (freq=%f) for freq %f (nyquist=%f)",
+ e->mfreq * table->mix_freq, mfreq * table->mix_freq, nyquist);
}
return table;
}
@@ -345,7 +346,7 @@ gsl_osc_table_lookup (const GslOscTable *table,
else
{
/* shouldn't happen */
- OSC_DEBUG ("table lookup revealed NULL, empty table?");
+ ODEBUG ("table lookup revealed NULL, empty table?");
memset (wave, 0, sizeof (*wave));
}
}
@@ -367,7 +368,7 @@ gsl_osc_table_free (GslOscTable *table)
void
gsl_osc_cache_debug_dump (void)
{
- OSC_DEBUG ("left in cache: %u", g_bsearch_array_get_n_nodes (cache_entries));
+ ODEBUG ("left in cache: %u", g_bsearch_array_get_n_nodes (cache_entries));
}
void
gsl_osc_wave_fill_buffer (GslOscWaveForm type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]