diff options
author | waker <wakeroid@gmail.com> | 2011-05-21 21:36:11 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-05-21 21:36:11 +0200 |
commit | 3bcd23fb79f2db7cd6483145f7a7277097d1960a (patch) | |
tree | dafdcbf4c3a2682cef6febd3fb9375289a4abd5b /streamer.c | |
parent | 2c26434e62b0018d87c6f75c9f25a2859216627a (diff) |
added new DSP API pass_through, which allows to skip DSP stage if it doesn't do anything;
bumped API version to 1.1
Diffstat (limited to 'streamer.c')
-rw-r--r-- | streamer.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -1691,7 +1691,28 @@ streamer_read_async (char *bytes, int size) { int outputsamplesize = output->fmt.channels * output->fmt.bps / 8; int inputsamplesize = fileinfo->fmt.channels * fileinfo->fmt.bps / 8; - if (!memcmp (&fileinfo->fmt, &output->fmt, sizeof (ddb_waveformat_t)) && !dsp_on) { + ddb_waveformat_t dspfmt; + memcpy (&dspfmt, &fileinfo->fmt, sizeof (ddb_waveformat_t)); + dspfmt.bps = 32; + dspfmt.is_float = 1; + int can_pass_through = 0; + if (dsp_on) { + // check if DSP can be passed through + ddb_dsp_context_t *dsp = dsp_chain; + while (dsp) { + if (dsp->enabled && dsp->plugin->plugin.api_vminor >= 1) { + if (dsp->plugin->pass_through && !dsp->plugin->pass_through (dsp, &dspfmt)) { + break; + } + } + dsp = dsp->next; + } + if (!dsp) { + can_pass_through = 1; + } + } + + if (!memcmp (&fileinfo->fmt, &output->fmt, sizeof (ddb_waveformat_t)) && (!dsp_on || can_pass_through)) { // pass through from input to output bytesread = fileinfo->plugin->read (fileinfo, bytes, size); @@ -1706,11 +1727,6 @@ streamer_read_async (char *bytes, int size) { char outbuf[dsp_num_frames * dspsamplesize]; - ddb_waveformat_t dspfmt; - memcpy (&dspfmt, &fileinfo->fmt, sizeof (ddb_waveformat_t)); - dspfmt.bps = 32; - dspfmt.is_float = 1; - int inputsize = dsp_num_frames * inputsamplesize; char input[inputsize]; |