diff options
author | 2010-11-23 22:58:50 +0100 | |
---|---|---|
committer | 2010-11-23 22:58:50 +0100 | |
commit | 62ec981084285de2e3f04e46b76f0994963c9031 (patch) | |
tree | 8d2404523ee624f391413e5798e814e118e066e6 | |
parent | e11ebd47da160caa023d6e99c40292dec9f5cf86 (diff) |
fixed float<->int24 conversion
-rw-r--r-- | premix.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -196,8 +196,8 @@ pcm_write_samples_24_to_float (const ddb_waveformat_t * restrict inputfmt, const for (int c = 0; c < inputfmt->channels; c++) { if (channelmap[c] != -1) { float *out = (float *)(output + 4 * channelmap[c]); - int32_t sample = ((int32_t)input[0]<<24) | ((int32_t)input[1]<<16) | (input[2]<<8); - *out = sample / (float)0x7fffffff; + int32_t sample = ((unsigned char)input[0]) | ((unsigned char)input[1]<<8) | (input[2]<<16); + *out = sample / (float)0x7fffff; } input += 3; } @@ -284,10 +284,10 @@ pcm_write_samples_float_to_24 (const ddb_waveformat_t * restrict inputfmt, const if (sample < -1) { sample = -1; } - int32_t outsample = (int32_t)ftoi (sample * 0x7fffffff); - out[0] = (outsample&0xff000000)>>24; - out[1] = (outsample&0x00ff0000)>>16; - out[2] = (outsample&0x0000ff00)>>8; + int32_t outsample = (int32_t)ftoi (sample * 0x7fffff); + out[0] = (outsample&0x0000ff); + out[1] = (outsample&0x00ff00)>>8; + out[2] = (outsample&0xff0000)>>16; } input += 4; } |