diff options
author | waker <wakeroid@gmail.com> | 2010-11-13 23:50:39 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-11-13 23:50:39 +0100 |
commit | 94ba195c261f10d3d3809b429eb341313279db66 (patch) | |
tree | 798f7673516507db76eb1bccd2798ceb56fef5a0 /premix.c | |
parent | 8eada3d6211baeac22c9d0f1977bc90f428247d5 (diff) |
ported wavpack to new API
Diffstat (limited to 'premix.c')
-rw-r--r-- | premix.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -127,6 +127,19 @@ pcm_write_samples_16_to_float (const ddb_waveformat_t * restrict inputfmt, const } static inline void +pcm_write_samples_32_to_32 (const ddb_waveformat_t * restrict inputfmt, const char * restrict input, const ddb_waveformat_t * restrict outputfmt, char * restrict output, int nsamples, int * restrict channelmap, int outputsamplesize) { + for (int s = 0; s < nsamples; s++) { + for (int c = 0; c < inputfmt->channels; c++) { + if (channelmap[c] != -1) { + *((int32_t*)(output + (outputfmt->bps >> 3) * channelmap[c])) = *((int32_t*)input); + } + input += 4; + } + output += outputsamplesize; + } +} + +static inline void pcm_write_samples_24_to_24 (const ddb_waveformat_t * restrict inputfmt, const char * restrict input, const ddb_waveformat_t * restrict outputfmt, char * restrict output, int nsamples, int * restrict channelmap, int outputsamplesize) { for (int s = 0; s < nsamples; s++) { for (int c = 0; c < inputfmt->channels; c++) { @@ -188,6 +201,7 @@ pcm_convert (const ddb_waveformat_t * restrict inputfmt, const char * restrict i } // FIXME: access through function pointer table + //trace ("converting from %d to %d\n", inputfmt->bps, outputfmt->bps); if (inputfmt->bps == 8 && outputfmt->bps == 8) { pcm_write_samples_8_to_8 (inputfmt, input, outputfmt, output, nsamples, channelmap, outputsamplesize); } @@ -212,6 +226,12 @@ pcm_convert (const ddb_waveformat_t * restrict inputfmt, const char * restrict i else if (inputfmt->bps == 24 && outputfmt->bps == 24) { pcm_write_samples_24_to_24 (inputfmt, input, outputfmt, output, nsamples, channelmap, outputsamplesize); } + else if (inputfmt->bps == 32 && outputfmt->bps == 32) { + pcm_write_samples_32_to_32 (inputfmt, input, outputfmt, output, nsamples, channelmap, outputsamplesize); + } + else { + trace ("no converter from %d to %d\n", inputfmt->bps, outputfmt->bps); + } } return nsamples * outputsamplesize; } |