Skip to content

Commit

Permalink
use #defines for all non error printf's.
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Aug 28, 2012
1 parent acb3e2b commit d729886
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
14 changes: 6 additions & 8 deletions convolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int audiofile_read (const char *fn, const int sample_rate, float **buf, unsigned
}

if (resample_ratio != 1.0) {
fprintf(stderr, "convoLV2: resampling IR %ld -> %ld [frames * channels].\n",
VERBOSE_printf("convoLV2: resampling IR %ld -> %ld [frames * channels].\n",
(long int) frames_in,
(long int) frames_out);
SRC_STATE* src_state = src_new(SRC_QUALITY, nfo.channels, NULL);
Expand All @@ -154,7 +154,7 @@ int audiofile_read (const char *fn, const int sample_rate, float **buf, unsigned
src_data.data_in = rdb;
src_data.data_out = *buf;
src_process(src_state, &src_data);
fprintf(stderr, "convoLV2: resampled IR %ld -> %ld [frames * channels].\n",
VERBOSE_printf("convoLV2: resampled IR %ld -> %ld [frames * channels].\n",
src_data.input_frames_used * nfo.channels,
src_data.output_frames_gen * nfo.channels);

Expand Down Expand Up @@ -280,7 +280,7 @@ char *clv_dump_settings (LV2convolv *clv) {
}
off+= sprintf(rv + off, "convolution.size=%u\n", clv->size); // 18 + v
off+= sprintf(rv + off, "convolution.ir.file=%s\n", clv->ir_fn?clv->ir_fn:""); // 21 + s
fprintf(stderr, "%d / %d \n", off, MAX_CFG_SIZE);
//fprintf(stderr, "%d / %d \n", off, MAX_CFG_SIZE);
return rv;
}

Expand Down Expand Up @@ -344,7 +344,6 @@ int clv_initialize (
while (!g_atomic_int_compare_and_exchange(&fftw_guard, 0, 1)) {
usleep (1000);
}
fprintf(stderr, "CONFIGURE FFTW\n");

clv->convproc = new Convproc;
clv->convproc->set_options (options);
Expand Down Expand Up @@ -381,7 +380,7 @@ int clv_initialize (
return -1;
}

fprintf (stderr, "convoLV2: CFG %din, %dout | IR: %dchn, %dsamples\n",
VERBOSE_printf("convoLV2: CFG %din, %dout | IR: %dchn, %dsamples\n",
in_channel_cnt, out_channel_cnt, nchan, nfram);

for (c=0; c < MAX_CHANNEL_MAPS; c++) {
Expand All @@ -401,7 +400,7 @@ int clv_initialize (
return -1;
#else
clv->ir_chan[c] = ((clv->ir_chan[c]-1)%nchan)+1;
fprintf(stderr, "convoLV2: using IR-file channel %d\n", clv->ir_chan[c]);
VERBOSE_printf("convoLV2: using IR-file channel %d\n", clv->ir_chan[c]);
#endif
}
if (clv->ir_delay[c] < 0) {
Expand All @@ -415,7 +414,7 @@ int clv_initialize (

for (i=0; i < nfram; ++i) gb[i] = p[i*nchan + clv->ir_chan[c]-1] * clv->ir_gain[c];

fprintf(stderr, "convoLV2: SET in %d -> out %d [IR chn:%d gain:%+.3f dly:%d]\n",
VERBOSE_printf("convoLV2: SET in %d -> out %d [IR chn:%d gain:%+.3f dly:%d]\n",
((clv->chn_inp[c]-1)%in_channel_cnt) +1,
((clv->chn_out[c]-1)%out_channel_cnt) +1,
clv->ir_chan[c],
Expand All @@ -432,7 +431,6 @@ int clv_initialize (
free(p);

#if 1 // INFO
fprintf(stderr, "\n");
clv->convproc->print (stderr);
#endif

Expand Down
3 changes: 3 additions & 0 deletions convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#ifndef CONVOLUTION_H
#define CONVOLUTION_H

#define DEBUG_printf(FMT, ...) fprintf(stderr, FMT, ##__VA_ARGS__)
#define VERBOSE_printf(FMT, ...) fprintf(stderr, FMT, ##__VA_ARGS__)


#define MAX_CHANNEL_MAPS (4)

Expand Down
14 changes: 7 additions & 7 deletions lv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ work(LV2_Handle instance,

/* prepare new engine instance */
if (!self->clv_offline) {
fprintf(stderr, "allocate offline instance\n"); // SAFE DEBUG
DEBUG_printf("allocate offline instance\n");
self->clv_offline = clv_alloc();

if (!self->clv_offline) {
Expand All @@ -153,11 +153,11 @@ work(LV2_Handle instance,
if (size == sizeof(int)) {
switch(*((int*)data)) {
case CMD_APPLY:
fprintf(stderr, "apply offline instance\n"); // SAFE DEBUG
DEBUG_printf("apply offline instance\n");
apply = 1;
break;
case CMD_FREE:
fprintf(stderr, "free offline instance\n"); // SAFE DEBUG
DEBUG_printf("free offline instance\n");
clv_free(self->clv_offline);
self->clv_offline=NULL;
break;
Expand All @@ -171,7 +171,7 @@ work(LV2_Handle instance,
const LV2_Atom* file_path = read_set_file(uris, obj);
if (file_path) {
const char *fn = (char*)(file_path+1);
fprintf(stderr, "load IR %s\n", fn); // SAFE DEBUG
DEBUG_printf("load IR %s\n", fn);
clv_configure(self->clv_offline, "convolution.ir.file", fn);
apply = 1;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ restore(LV2_Handle instance,

/* prepare new engine instance */
if (!self->clv_offline) {
fprintf(stderr, "allocate offline instance\n"); // SAFE DEBUG
DEBUG_printf("allocate offline instance\n");
self->clv_offline = clv_alloc();

if (!self->clv_offline) {
Expand All @@ -401,7 +401,7 @@ restore(LV2_Handle instance,
char kv[1024];
memcpy(kv, ts, te-ts);
kv[te-ts]=0;
fprintf(stderr, "CFG: %s\n", kv); // SAFE DEBUG
DEBUG_printf("CFG: %s\n", kv);
if((val=strchr(kv,'='))) {
*val=0;
clv_configure(self->clv_offline, kv, val+1);
Expand All @@ -414,7 +414,7 @@ restore(LV2_Handle instance,

if (value) {
const char* path = (const char*)value;
fprintf(stderr, "PTH: convolution.ir.file=%s\n", path); // SAFE DEBUG
DEBUG_printf("PTH: convolution.ir.file=%s\n", path);
clv_configure(self->clv_offline, "convolution.ir.file", path);
}

Expand Down

0 comments on commit d729886

Please sign in to comment.