diff options
author | waker <wakeroid@gmail.com> | 2010-12-14 21:36:52 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-12-14 21:36:52 +0100 |
commit | 4144d40b1a6fb5223e076b33b4cea82788bc3b89 (patch) | |
tree | 3be79b793af8b4455fad1eae471907a02043bd55 /plugins | |
parent | f3c8e6b96c752dcb921dba1f5ea847da97684a30 (diff) |
changed dsp plugin api to allow modification of any aspect of wave format
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dsp_libsrc/src.c | 18 | ||||
-rw-r--r-- | plugins/supereq/supereq.c | 14 |
2 files changed, 16 insertions, 16 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) { diff --git a/plugins/supereq/supereq.c b/plugins/supereq/supereq.c index d3d83389..afa06359 100644 --- a/plugins/supereq/supereq.c +++ b/plugins/supereq/supereq.c @@ -75,27 +75,27 @@ supereq_plugin_stop (void) { } int -supereq_process (ddb_dsp_context_t *ctx, float *samples, int frames, int *samplerate, int *channels) { +supereq_process (ddb_dsp_context_t *ctx, float *samples, int frames, ddb_waveformat_t *fmt) { ddb_supereq_ctx_t *supereq = (ddb_supereq_ctx_t *)ctx; if (supereq->params_changed) { recalc_table (supereq); supereq->params_changed = 0; } - if (supereq->last_srate != *samplerate) { + if (supereq->last_srate != fmt->samplerate) { deadbeef->mutex_lock (supereq->mutex); - supereq->last_srate = *samplerate; - supereq->last_nch = *channels; + supereq->last_srate = fmt->samplerate; + supereq->last_nch = fmt->channels; recalc_table (supereq); deadbeef->mutex_unlock (supereq->mutex); equ_clearbuf(&supereq->state); } - else if (supereq->last_nch != *channels) { + else if (supereq->last_nch != fmt->channels) { deadbeef->mutex_lock (supereq->mutex); - supereq->last_nch = *channels; + supereq->last_nch = fmt->channels; deadbeef->mutex_unlock (supereq->mutex); equ_clearbuf(&supereq->state); } - equ_modifySamples_float(&supereq->state, (char *)samples,frames,*channels); + equ_modifySamples_float(&supereq->state, (char *)samples,frames,fmt->channels); return frames; } |