diff options
| author | MasterPhi <[email protected]> | 2021-07-01 21:41:19 +0200 |
|---|---|---|
| committer | MasterPhi <[email protected]> | 2021-07-01 21:41:19 +0200 |
| commit | eb02b406d855c83394465946b8a691a2c81248ce (patch) | |
| tree | 5c3c9182d9a74396b4d05ee682b827b156968ab8 /examples | |
| parent | 8571508b3f2692fc9f40102052e81ab3f1c6d08f (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; |
