From 4eec8450d3e95535349ec592609a89d8c2d0bb00 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 2 Apr 2019 13:25:51 +0200 Subject: [PATCH] audio: rename format enum entries to avoid collisions. --- src/audio/audio.cpp | 26 +++++++++++++------------- src/lol/audio/audio.h | 9 ++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index f9d9cbf3..68bab5be 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -68,13 +68,13 @@ static audio::format sdl2lol_format(Uint16 sdl_format) switch (sdl_format) { case AUDIO_U8: return audio::format::uint8; - case AUDIO_S8: return audio::format::int8; + case AUDIO_S8: return audio::format::sint8; case AUDIO_U16LSB: return audio::format::uint16le; case AUDIO_U16MSB: return audio::format::uint16be; - case AUDIO_S16LSB: return audio::format::int16le; - case AUDIO_S16MSB: return audio::format::int16be; - case AUDIO_S32LSB: return audio::format::int32le; - case AUDIO_S32MSB: return audio::format::int32be; + case AUDIO_S16LSB: return audio::format::sint16le; + case AUDIO_S16MSB: return audio::format::sint16be; + case AUDIO_S32LSB: return audio::format::sint32le; + case AUDIO_S32MSB: return audio::format::sint32be; case AUDIO_F32LSB: return audio::format::float32le; case AUDIO_F32MSB: return audio::format::float32be; default: return audio::format::unknown; @@ -86,13 +86,13 @@ static int lol2sdl_format(audio::format format) switch (format) { case audio::format::uint8: return AUDIO_U8; - case audio::format::int8: return AUDIO_S8; - case audio::format::uint16le: return AUDIO_U16LSB; - case audio::format::uint16be: return AUDIO_U16MSB; - case audio::format::int16le: return AUDIO_S16LSB; - case audio::format::int16be: return AUDIO_S16MSB; - case audio::format::int32le: return AUDIO_S32LSB; - case audio::format::int32be: return AUDIO_S32MSB; + case audio::format::sint8: return AUDIO_S8; + case audio::format::uint16le: return AUDIO_U16LSB; + case audio::format::uint16be: return AUDIO_U16MSB; + case audio::format::sint16le: return AUDIO_S16LSB; + case audio::format::sint16be: return AUDIO_S16MSB; + case audio::format::sint32le: return AUDIO_S32LSB; + case audio::format::sint32be: return AUDIO_S32MSB; case audio::format::float32le: return AUDIO_F32LSB; case audio::format::float32be: return AUDIO_F32MSB; default: return 0; @@ -153,7 +153,7 @@ void audio::unmute_all() } int audio::start_streaming(std::function const &f, - enum audio::format format /* = audio::format::uint16le */, + enum audio::format format /* = audio::format::sint16le */, int frequency /* = 22050 */, int channels /* = 2 */) { diff --git a/src/lol/audio/audio.h b/src/lol/audio/audio.h index a82e3a9b..ec4cac5c 100644 --- a/src/lol/audio/audio.h +++ b/src/lol/audio/audio.h @@ -30,11 +30,10 @@ public: enum class format : uint8_t { unknown = 0, - uint8, - int8, + uint8, sint8, uint16le, uint16be, - int16le, int16be, - int32le, int32be, + sint16le, sint16be, + sint32le, sint32be, float32le, float32be, }; @@ -48,7 +47,7 @@ public: static void unmute_all(); static int start_streaming(std::function const &f, - format format = audio::format::uint16le, + format format = audio::format::sint16le, int frequency = 22050, int channels = 2);