diff options
author | Kővágó, Zoltán <dirty.ice.hu@gmail.com> | 2020-02-02 20:38:07 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-02-06 14:35:57 +0100 |
commit | ed2a4a794184df3dbd5ee4cc06e86fe220663faf (patch) | |
tree | ed340e8120188691fd89b764ef45ad509005c9a6 /audio/sdlaudio.c | |
parent | 180b044ffde2cdd4a7209c727b5a8ce93d36741f (diff) |
audio: proper support for float samples in mixeng
This adds proper support for float samples in mixeng by adding a new
audio format for it.
Limitations: only native endianness is supported. None of the virtual
sound cards support float samples (it looks like most of them only
support 8 and 16 bit, only hda supports 32 bit), it is only used for the
audio backends (i.e. host side).
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 8a8b0b5698401b78d3c4c8ec90aef83b95babb06.1580672076.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/sdlaudio.c')
-rw-r--r-- | audio/sdlaudio.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index c00e7d7845..21b7a0484b 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -77,6 +77,14 @@ static int aud_to_sdlfmt (AudioFormat fmt) case AUDIO_FORMAT_U16: return AUDIO_U16LSB; + case AUDIO_FORMAT_S32: + return AUDIO_S32LSB; + + /* no unsigned 32-bit support in SDL */ + + case AUDIO_FORMAT_F32: + return AUDIO_F32LSB; + default: dolog ("Internal logic error: Bad audio format %d\n", fmt); #ifdef DEBUG_AUDIO @@ -119,6 +127,26 @@ static int sdl_to_audfmt(int sdlfmt, AudioFormat *fmt, int *endianness) *fmt = AUDIO_FORMAT_U16; break; + case AUDIO_S32LSB: + *endianness = 0; + *fmt = AUDIO_FORMAT_S32; + break; + + case AUDIO_S32MSB: + *endianness = 1; + *fmt = AUDIO_FORMAT_S32; + break; + + case AUDIO_F32LSB: + *endianness = 0; + *fmt = AUDIO_FORMAT_F32; + break; + + case AUDIO_F32MSB: + *endianness = 1; + *fmt = AUDIO_FORMAT_F32; + break; + default: dolog ("Unrecognized SDL audio format %d\n", sdlfmt); return -1; |