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 GitHub
parent c5b77f4590
commit 32b927de7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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);
samples.resize(samples_read);
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));
return samples_read * sizeof(int16_t);