diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-18 10:53:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-18 10:53:24 +0100 |
commit | 4340580e749b390b870f325a255435a1595ac016 (patch) | |
tree | 51f5015815a25a4ac49f4777053fde2a88dc5bec | |
parent | adc0752da7ffa557d1871eb125c54d301d32c4a9 (diff) | |
parent | dbf7cad04f2cc63f31f28246bf6ff3b0bf048613 (diff) |
Merge pull request #23787 from marcelofg55/pulse_uneven_fix
Fix distorted sound with PulseAudio and uneven channels
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index d78316945f..010f7bdb0a 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -346,9 +346,9 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) { for (int j = 0; j < ad->pa_map.channels - 1; j++) { ad->samples_out.write[out_idx++] = ad->samples_in[in_idx++] >> 16; } - uint32_t l = ad->samples_in[in_idx++]; - uint32_t r = ad->samples_in[in_idx++]; - ad->samples_out.write[out_idx++] = ((l >> 1) + (r >> 1)) >> 16; + uint32_t l = ad->samples_in[in_idx++] >> 16; + uint32_t r = ad->samples_in[in_idx++] >> 16; + ad->samples_out.write[out_idx++] = (l + r) / 2; } } } |