From 339be52f426eef2731def8b115520c1f9d912f35 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Fri, 27 May 2016 10:52:04 +0200 Subject: [PATCH] Remove support for stereo sounds --- simgear/sound/sample_openal.cxx | 24 +++++++++++------------- simgear/sound/sample_openal.hxx | 16 +++++++--------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/simgear/sound/sample_openal.cxx b/simgear/sound/sample_openal.cxx index 35696063..4abd27e0 100644 --- a/simgear/sound/sample_openal.cxx +++ b/simgear/sound/sample_openal.cxx @@ -92,18 +92,14 @@ void SGSoundSample::set_format_AL( int fmt ) case AL_FORMAT_MONO16: _tracks = 1; _bits = 16; _compressed = false; break; - case AL_FORMAT_STEREO8: - _tracks = 2; _bits = 8; _compressed = false; - break; - case AL_FORMAT_STEREO16: - _tracks = 2; _bits = 16; _compressed = false; - break; #ifdef AL_EXT_MULAW_MCFORMATS case AL_FORMAT_MONO_MULAW: - _tracks = 1; _bits = 16; _compressed = true; + _tracks = 1; _bits = 8; _compressed = true; break; - case AL_FORMAT_STEREO_MULAW: - _tracks = 2; _bits = 16; _compressed = true; +#endif +#ifdef AL_EXT_IMA4 + case AL_EXT_IMA4: + _tracks = 1; _bits = 4; _compressed = true; break; #endif default: @@ -116,11 +112,13 @@ unsigned int SGSoundSampleInfo::get_format_AL() unsigned int rv = AL_FORMAT_MONO16; if (_tracks == 1 && _bits == 8) rv = AL_FORMAT_MONO8; - else if (_tracks == 2 && _bits == 8) rv = AL_FORMAT_STEREO8; - else if (_tracks == 2 && _bits == 16) rv = AL_FORMAT_STEREO16; #ifdef AL_EXT_MULAW_MCFORMATS - else if (_tracks == 1 && _bits == 16 && _compressed) rv = AL_FORMAT_MONO_MULAW; - else if (_tracks == 2 && _bits == 16 && _compressed) rv = AL_FORMAT_STEREO_MULAW; + else if (_tracks == 1 && _bits == 8 && _compressed) + rv = AL_FORMAT_MONO_MULAW; +#endif +#ifdef AL_EXT_IMA4 + else if (_tracks == 1 && _bits == 4 && _compressed) + rv = AL_EXT_IMA4; #endif return rv; diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index 8dc71b0b..34a54064 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -40,14 +40,13 @@ enum { SG_SAMPLE_8BITS = 8, SG_SAMPLE_16BITS = 16, + SG_SAMPLE_UNCOMPRESSED = 0, SG_SAMPLE_COMPRESSED = 256, - SG_SAMPLE_MONO8 = (SG_SAMPLE_MONO|SG_SAMPLE_8BITS), - SG_SAMPLE_MONO16 = (SG_SAMPLE_MONO|SG_SAMPLE_16BITS), - SG_SAMPLE_STEREO8 = (SG_SAMPLE_STEREO|SG_SAMPLE_8BITS), - SG_SAMPLE_STEREO16 = (SG_SAMPLE_STEREO|SG_SAMPLE_16BITS), - SG_SAMPLE_MONO_MULAW = (SG_SAMPLE_MONO16|SG_SAMPLE_COMPRESSED), - SG_SAMPLE_STEREO_MULAW = (SG_SAMPLE_STEREO16|SG_SAMPLE_COMPRESSED) + SG_SAMPLE_MONO8 = (SG_SAMPLE_MONO|SG_SAMPLE_8BITS), + SG_SAMPLE_MONO16 = (SG_SAMPLE_MONO|SG_SAMPLE_16BITS), + SG_SAMPLE_MULAW = (SG_SAMPLE_MONO|SG_SAMPLE_8BITS|SG_SAMPLE_COMPRESSED), + SG_SAMPLE_ADPCM = (SG_SAMPLE_MONO|SG_SAMPLE_4BITS|SG_SAMPLE_COMPRESSED) }; @@ -102,9 +101,8 @@ public: * @return Data size */ inline size_t get_size() const { -printf("<-- samples: %i, tracks: %i, bits: %i\n", _samples, _tracks, _bits); -return (_samples * _tracks * _bits)/8; -} + return (_samples * _tracks * _bits)/8; + } /** -- 2.39.5