diff options
author | Dana Conrad <dconrad@fastmail.com> | 2021-07-31 10:15:12 -0500 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-07 14:21:47 +0000 |
commit | 16b009825608164b17dabd877c78123a667b4981 (patch) | |
tree | e7c88e07ddadff4b62802f561e8c9a83c90ae925 /firmware/pcm_sw_volume.c | |
parent | 57293f1fd9d091145059293d88bb15c8749bb596 (diff) | |
download | rockbox-16b009825608164b17dabd877c78123a667b4981.tar.gz rockbox-16b009825608164b17dabd877c78123a667b4981.zip |
ErosQ Native: Add DC Offset to PCM data
A small negative offset seems to silence all
play/pause clicking on the PCM5102A.
Also adding PCM soft muting, and muting the headphone amp
when the headphones are detected as removed. This has been
tested to not cause any unintended side effects on the
line out.
Also confirmed the numerical dB values are (approx.) correct.
Change-Id: I689d68887c86add9cc5e0ccb0c7de01aaa69b4d9
Diffstat (limited to 'firmware/pcm_sw_volume.c')
-rw-r--r-- | firmware/pcm_sw_volume.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/firmware/pcm_sw_volume.c b/firmware/pcm_sw_volume.c index 7322269f44..3593c684af 100644 --- a/firmware/pcm_sw_volume.c +++ b/firmware/pcm_sw_volume.c | |||
@@ -54,7 +54,11 @@ static typeof (memcpy) *pcm_scaling_fn = NULL; | |||
54 | /* Scale sample by PCM factor */ | 54 | /* Scale sample by PCM factor */ |
55 | static inline int32_t pcm_scale_sample(PCM_F_T f, int32_t s) | 55 | static inline int32_t pcm_scale_sample(PCM_F_T f, int32_t s) |
56 | { | 56 | { |
57 | #if defined(PCM_DC_OFFSET_VALUE) | ||
58 | return (f * s + PCM_DC_OFFSET_VALUE) >> PCM_SW_VOLUME_FRACBITS; | ||
59 | #else | ||
57 | return (f * s) >> PCM_SW_VOLUME_FRACBITS; | 60 | return (f * s) >> PCM_SW_VOLUME_FRACBITS; |
61 | #endif | ||
58 | } | 62 | } |
59 | 63 | ||
60 | /* Both UNITY, use direct copy */ | 64 | /* Both UNITY, use direct copy */ |