diff options
author | Volker RĂ¼melin <vr_qemu@t-online.de> | 2020-03-08 20:33:19 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-03-16 10:18:07 +0100 |
commit | 4218fdd77f1c8ab4dab5ced30c3a0db946a6f04c (patch) | |
tree | 745497ef3f568102766610a444c73773f440532b /audio/mixeng.c | |
parent | 33a93baeae4ca8f03a84b194c55f6e5ee09c33f8 (diff) |
audio: change mixing engine float range to [-1.f, 1.f]
Currently the internal float range of the mixing engine is
[-.5f, .5f]. PulseAudio, SDL2 and libasound use a [-1.f, 1.f]
range. This means with float samples the audio playback volume
is 6dB too low and audio recording signals will be clipped in
most cases.
To avoid another scaling factor in the conv_natural_float_* and
clip_natural_float_* functions with FLOAT_MIXENG defined this
patch changes the mixing engine float range to [-1.f, 1.f].
Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de>
Message-id: 20200308193321.20668-4-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/mixeng.c')
-rw-r--r-- | audio/mixeng.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/mixeng.c b/audio/mixeng.c index 725b529be7..739a500449 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -271,11 +271,11 @@ f_sample *mixeng_clip[2][2][2][3] = { #define CONV_NATURAL_FLOAT(x) (x) #define CLIP_NATURAL_FLOAT(x) (x) #else -static const float float_scale = UINT_MAX; +static const float float_scale = UINT_MAX / 2.f; #define CONV_NATURAL_FLOAT(x) ((x) * float_scale) #ifdef RECIPROCAL -static const float float_scale_reciprocal = 1.f / UINT_MAX; +static const float float_scale_reciprocal = 2.f / UINT_MAX; #define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal) #else #define CLIP_NATURAL_FLOAT(x) ((x) / float_scale) |