diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-05-26 10:59:01 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-05-26 10:59:01 +0100 |
| commit | 8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8 (patch) | |
| tree | 01e4f31b2333d27d969322eb4cf9381733d817cc /audio/mixeng.c | |
| parent | fea8f3ed739536fca027cf56af7f5576f37ef9cd (diff) | |
| parent | b3b8a1fea6ed5004bbad2f70833caee70402bf02 (diff) | |
| download | focaccia-qemu-8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8.tar.gz focaccia-qemu-8f72c75cfc9b3c84a9b5e7a58ee5e471cb2f19c8.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20200526-pull-request' into staging
audio: add JACK client audiodev. audio: bugfixes and cleanups. # gpg: Signature made Tue 26 May 2020 08:56:21 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20200526-pull-request: hw/mips/mips_fulong2e: Remove unused 'audio/audio.h' include audio: Let capture_callback handler use const buffer argument audio: Let audio_sample_to_uint64() use const samples argument audio: fix wavcapture segfault audio/mixeng: fix clang 10+ warning audio/jack: add JACK client audiodev hw/audio/gus: Use AUDIO_HOST_ENDIANNESS definition from 'audio/audio.h' es1370: check total frame count against current frame Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'audio/mixeng.c')
| -rw-r--r-- | audio/mixeng.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/audio/mixeng.c b/audio/mixeng.c index 739a500449..f27deb165b 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -271,11 +271,12 @@ 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 / 2.f; +/* macros to map [-1.f, 1.f] <-> [INT32_MIN, INT32_MAX + 1] */ +static const float float_scale = (int64_t)INT32_MAX + 1; #define CONV_NATURAL_FLOAT(x) ((x) * float_scale) #ifdef RECIPROCAL -static const float float_scale_reciprocal = 2.f / UINT_MAX; +static const float float_scale_reciprocal = 1.f / ((int64_t)INT32_MAX + 1); #define CLIP_NATURAL_FLOAT(x) ((x) * float_scale_reciprocal) #else #define CLIP_NATURAL_FLOAT(x) ((x) / float_scale) @@ -338,10 +339,10 @@ f_sample *mixeng_clip_float[2] = { clip_natural_float_from_stereo, }; -void audio_sample_to_uint64(void *samples, int pos, +void audio_sample_to_uint64(const void *samples, int pos, uint64_t *left, uint64_t *right) { - struct st_sample *sample = samples; + const struct st_sample *sample = samples; sample += pos; #ifdef FLOAT_MIXENG error_report( |