diff options
author | waker <wakeroid@gmail.com> | 2010-11-22 21:38:06 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-11-22 21:38:06 +0100 |
commit | 19a188df769b29df82c12e9b684f13000544fd5e (patch) | |
tree | 8f38cf4dbd227d8e287e2266bcb072a1c53de428 /premix.c | |
parent | a839ce76b389e7bfa71e7eb17c6ce2a3e0243aab (diff) |
added float clamp(-1,1) in premix
added plugin pointer to dsp instances
code cleanup
Diffstat (limited to 'premix.c')
-rw-r--r-- | premix.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -211,7 +211,14 @@ pcm_write_samples_float_to_16 (const ddb_waveformat_t * restrict inputfmt, const if (channelmap[c] != -1) { int16_t *out = (int16_t*)(output + (outputfmt->bps >> 3) * channelmap[c]); float sample = *((float*)input); - *out = (int16_t)ftoi (sample*0x7ff0); + // FIXME: sse optimize + if (sample > 1) { + sample = 1; + } + if (sample < -1) { + sample = -1; + } + *out = (int16_t)ftoi (sample*0x7fff); } input += 4; } @@ -229,7 +236,14 @@ pcm_write_samples_float_to_8 (const ddb_waveformat_t * restrict inputfmt, const if (channelmap[c] != -1) { int8_t *out = (int8_t*)(output + (outputfmt->bps >> 3) * channelmap[c]); float sample = *((float*)input); - *out = (int8_t)ftoi (sample*0x7e); + // FIXME: sse optimize + if (sample > 1) { + sample = 1; + } + if (sample < -1) { + sample = -1; + } + *out = (int8_t)ftoi (sample*0x7f); } input += 4; } |