From: Paul Brossier Date: Wed, 30 Nov 2016 18:10:10 +0000 (+0100) Subject: src/io/sink_{sndfile,wavwrite}.c: use AUBIO_MAX_CHANNELS, fix error message X-Git-Tag: 0.4.4~115 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=a028a04e256423e6fc6a3b4202110845e505f4ba;p=aubio.git src/io/sink_{sndfile,wavwrite}.c: use AUBIO_MAX_CHANNELS, fix error message --- diff --git a/src/io/sink_sndfile.c b/src/io/sink_sndfile.c index 4256a49e..562b3275 100644 --- a/src/io/sink_sndfile.c +++ b/src/io/sink_sndfile.c @@ -31,7 +31,6 @@ #include "io/sink_sndfile.h" #include "io/ioutils.h" -#define MAX_CHANNELS 6 #define MAX_SIZE 4096 #if !HAVE_AUBIO_DOUBLE @@ -148,9 +147,10 @@ uint_t aubio_sink_sndfile_open(aubio_sink_sndfile_t *s) { s->scratch_size = s->max_size*s->channels; /* allocate data for de/interleaving reallocated when needed. */ - if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) { + if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) { + abort(); AUBIO_ERR("sink_sndfile: %d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n", - s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS); + s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS); return AUBIO_FAIL; } s->scratch_data = AUBIO_ARRAY(smpl_t,s->scratch_size); diff --git a/src/io/sink_wavwrite.c b/src/io/sink_wavwrite.c index 79ae402b..a108a2f9 100644 --- a/src/io/sink_wavwrite.c +++ b/src/io/sink_wavwrite.c @@ -31,7 +31,6 @@ #include -#define MAX_CHANNELS 6 #define MAX_SIZE 4096 #define FLOAT_TO_SHORT(x) (short)(x * 32768) @@ -220,9 +219,9 @@ uint_t aubio_sink_wavwrite_open(aubio_sink_wavwrite_t *s) { s->scratch_size = s->max_size * s->channels; /* allocate data for de/interleaving reallocated when needed. */ - if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) { + if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) { AUBIO_ERR("sink_wavwrite: %d x %d exceeds SIZE maximum buffer size %d\n", - s->max_size, s->channels, MAX_SIZE * MAX_CHANNELS); + s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS); goto beach; } s->scratch_data = AUBIO_ARRAY(unsigned short,s->scratch_size);