mirror of
https://github.com/esphome/esphome.git
synced 2025-10-08 04:43:46 +01:00
[audio, i2s_audio] Fix clang-tidy sign comparison errors (#11044)
This commit is contained in:
@@ -57,7 +57,7 @@ const char *audio_file_type_to_string(AudioFileType file_type) {
|
||||
void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor,
|
||||
size_t samples_to_scale) {
|
||||
// Note the assembly dsps_mulc function has audio glitches if the input and output buffers are the same.
|
||||
for (int i = 0; i < samples_to_scale; i++) {
|
||||
for (size_t i = 0; i < samples_to_scale; i++) {
|
||||
int32_t acc = (int32_t) audio_samples[i] * (int32_t) scale_factor;
|
||||
output_buffer[i] = (int16_t) (acc >> 15);
|
||||
}
|
||||
|
@@ -377,7 +377,7 @@ void I2SAudioSpeaker::speaker_task(void *params) {
|
||||
this_speaker->current_stream_info_.get_bits_per_sample() <= 16) {
|
||||
size_t len = bytes_read / sizeof(int16_t);
|
||||
int16_t *tmp_buf = (int16_t *) new_data;
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
for (size_t i = 0; i < len; i += 2) {
|
||||
int16_t tmp = tmp_buf[i];
|
||||
tmp_buf[i] = tmp_buf[i + 1];
|
||||
tmp_buf[i + 1] = tmp;
|
||||
|
Reference in New Issue
Block a user