revert bit shift to match previous behavior (#7109)

This commit is contained in:
Kevin Ahrendt 2024-07-19 15:15:11 -04:00 committed by Jesse Hills
parent d187340fc4
commit 74aee1d453
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -174,7 +174,8 @@ size_t I2SAudioMicrophone::read(int16_t *buf, size_t len) {
size_t samples_read = bytes_read / sizeof(int32_t); size_t samples_read = bytes_read / sizeof(int32_t);
samples.resize(samples_read); samples.resize(samples_read);
for (size_t i = 0; i < samples_read; i++) { for (size_t i = 0; i < samples_read; i++) {
samples[i] = reinterpret_cast<int32_t *>(buf)[i] >> 16; int32_t temp = reinterpret_cast<int32_t *>(buf)[i] >> 14;
samples[i] = clamp<int16_t>(temp, INT16_MIN, INT16_MAX);
} }
memcpy(buf, samples.data(), samples_read * sizeof(int16_t)); memcpy(buf, samples.data(), samples_read * sizeof(int16_t));
return samples_read * sizeof(int16_t); return samples_read * sizeof(int16_t);