diff options
| author | MasterPhi <[email protected]> | 2021-07-01 21:41:19 +0200 |
|---|---|---|
| committer | MasterPhi <[email protected]> | 2021-07-04 15:46:12 +0200 |
| commit | 8a42cb36613fdee4427aa6d4f61451310a821bf6 (patch) | |
| tree | c25eafc46e5301f176f6b3e46e4f43cf24978bd4 /examples | |
| parent | 3cc222781011f4ee1de1fdde7db8f9d010a17af6 (diff) | |
Prevent overflow noise
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/uac2_headset/src/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/device/uac2_headset/src/main.c b/examples/device/uac2_headset/src/main.c index f7d20a607..b459bc2a8 100644 --- a/examples/device/uac2_headset/src/main.c +++ b/examples/device/uac2_headset/src/main.c @@ -423,7 +423,7 @@ void audio_task(void) // Combine two channels into one int32_t left = *src++; int32_t right = *src++; - *dst++ = (int16_t)((left + right) / 2); + *dst++ = (left >> 1) + (right >> 1); } tud_audio_write((uint8_t *)mic_buf, spk_data_size / 2); spk_data_size = 0; @@ -438,7 +438,7 @@ void audio_task(void) // Combine two channels into one int32_t left = *src++; int32_t right = *src++; - *dst++ = (int32_t)((left + right) / 2) & 0xffffff00; + *dst++ = ((left >> 1) + (right >> 1)) & 0xffffff00; } tud_audio_write((uint8_t *)mic_buf, spk_data_size / 2); spk_data_size = 0; |
