summaryrefslogtreecommitdiff
path: root/plugins/dsp_libsrc/src.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-01-02 18:27:54 +0100
committerGravatar waker <wakeroid@gmail.com>2011-01-02 18:27:54 +0100
commit915c9c218574207a7954e53b9747045a6ae34282 (patch)
treee7f4e81d5b23a13d9ca581f2713d11f0f62435bb /plugins/dsp_libsrc/src.c
parentd5a14f3678d81f609278c2b5019ff1c3c3a9ce53 (diff)
added bounds checking and output ratio to dsp plugin API;
fixed all existing dsp plugins for the new API; dsp_soundtouch can now be used as a resampler
Diffstat (limited to 'plugins/dsp_libsrc/src.c')
-rw-r--r--plugins/dsp_libsrc/src.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/dsp_libsrc/src.c b/plugins/dsp_libsrc/src.c
index 09e5897f..9c5e6fdc 100644
--- a/plugins/dsp_libsrc/src.c
+++ b/plugins/dsp_libsrc/src.c
@@ -87,7 +87,7 @@ ddb_src_set_ratio (ddb_dsp_context_t *_src, float ratio) {
}
int
-ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, ddb_waveformat_t *fmt) {
+ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, int maxframes, ddb_waveformat_t *fmt, float *r) {
ddb_src_libsamplerate_t *src = (ddb_src_libsamplerate_t*)_src;
if (fmt->samplerate == src->samplerate) {
@@ -111,6 +111,9 @@ ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, ddb_wavef
fmt->samplerate = src->samplerate;
int numoutframes = nframes * src->srcdata.src_ratio;
+ if (numoutframes > maxframes) {
+ numoutframes = maxframes;
+ }
float outbuf[numoutframes*fmt->channels];
memset (outbuf, 0, sizeof (outbuf));
int buffersize = sizeof (outbuf);