Skip to content

Commit

Permalink
Fix audio scaling bug introduced in 45af1a7
Browse files Browse the repository at this point in the history
Fixes #737
  • Loading branch information
arkq committed Nov 10, 2024
1 parent b9db5b6 commit 59c953a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void audio_scale_s16_2le(int16_t * restrict buffer,
const double * restrict scale, unsigned int channels, size_t frames) {
for (size_t i = 0; frames; frames--)
for (size_t c = 0; c < channels; c++, i++)
buffer[i] = htole16(((int16_t)le16toh(buffer[i]) * scale[c]));
buffer[i] = htole16((int16_t)((int16_t)le16toh(buffer[i]) * scale[c]));
}

/**
Expand All @@ -93,5 +93,5 @@ void audio_scale_s32_4le(int32_t * restrict buffer,
const double * restrict scale, unsigned int channels, size_t frames) {
for (size_t i = 0; frames; frames--)
for (size_t c = 0; c < channels; c++, i++)
buffer[i] = htole32((int32_t)le32toh(buffer[i]) * scale[c]);
buffer[i] = htole32((int32_t)((int32_t)le32toh(buffer[i]) * scale[c]));
}

0 comments on commit 59c953a

Please sign in to comment.