mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
33a93baeae
commit
4218fdd77f
2 changed files with 10 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue