summaryrefslogtreecommitdiff
path: root/plugins/dsp_libsrc
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-14 21:36:52 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-14 21:36:52 +0100
commit4144d40b1a6fb5223e076b33b4cea82788bc3b89 (patch)
tree3be79b793af8b4455fad1eae471907a02043bd55 /plugins/dsp_libsrc
parentf3c8e6b96c752dcb921dba1f5ea847da97684a30 (diff)
changed dsp plugin api to allow modification of any aspect of wave format
Diffstat (limited to 'plugins/dsp_libsrc')
-rw-r--r--plugins/dsp_libsrc/src.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/dsp_libsrc/src.c b/plugins/dsp_libsrc/src.c
index 3f972d64..432bf871 100644
--- a/plugins/dsp_libsrc/src.c
+++ b/plugins/dsp_libsrc/src.c
@@ -87,38 +87,38 @@ ddb_src_set_ratio (ddb_dsp_context_t *_src, float ratio) {
}
int
-ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, int *samplerate, int *nchannels) {
+ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, ddb_waveformat_t *fmt) {
ddb_src_libsamplerate_t *src = (ddb_src_libsamplerate_t*)_src;
- if (*samplerate == src->samplerate) {
+ if (fmt->samplerate == src->samplerate) {
return nframes;
}
- if (src->need_reset || src->channels != *nchannels || src->quality_changed || !src->src) {
+ if (src->need_reset || src->channels != fmt->channels || src->quality_changed || !src->src) {
src->quality_changed = 0;
src->remaining = 0;
if (src->src) {
src_delete (src->src);
src->src = NULL;
}
- src->channels = *nchannels;
+ src->channels = fmt->channels;
src->src = src_new (src->quality, src->channels, NULL);
src->need_reset = 0;
}
- float ratio = src->samplerate / *samplerate;
+ float ratio = src->samplerate / fmt->samplerate;
ddb_src_set_ratio (_src, ratio);
- *samplerate = src->samplerate;
+ fmt->samplerate = src->samplerate;
int numoutframes = nframes * src->srcdata.src_ratio;
- float outbuf[numoutframes*(*nchannels)];
+ float outbuf[numoutframes*fmt->channels];
memset (outbuf, 0, sizeof (outbuf));
int buffersize = sizeof (outbuf);
char *output = (char *)outbuf;
float *input = samples;
int inputsize = numoutframes;
- int samplesize = *nchannels * sizeof (float);
+ int samplesize = fmt->channels * sizeof (float);
do {
// add more frames to input SRC buffer
@@ -131,7 +131,7 @@ ddb_src_process (ddb_dsp_context_t *_src, float *samples, int nframes, int *samp
memcpy (&src->in_fbuffer[src->remaining*samplesize], samples, n * samplesize);
src->remaining += n;
- samples += n * (*nchannels);
+ samples += n * fmt->channels;
nframes -= n;
}
if (!src->remaining) {