ref: a028a04e256423e6fc6a3b4202110845e505f4ba
parent: 22e991bc47628c455d07c37b9bb6534ba1362b18
author: Paul Brossier <piem@piem.org>
date: Wed Nov 30 14:10:10 EST 2016
src/io/sink_{sndfile,wavwrite}.c: use AUBIO_MAX_CHANNELS, fix error message
--- 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 @@
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);
--- a/src/io/sink_wavwrite.c
+++ b/src/io/sink_wavwrite.c
@@ -31,7 +31,6 @@
#include <errno.h>
-#define MAX_CHANNELS 6
#define MAX_SIZE 4096
#define FLOAT_TO_SHORT(x) (short)(x * 32768)
@@ -220,9 +219,9 @@
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);