mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 17:54:13 +01:00
revert bit shift to match previous behavior (#7109)
This commit is contained in:
parent
d187340fc4
commit
74aee1d453
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue