aboutsummaryrefslogtreecommitdiffstats
path: root/al/buffer.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-02-26 00:43:25 -0800
committerChris Robinson <[email protected]>2023-02-26 01:38:46 -0800
commit0b700286bd33abca9526d30496745d7a52cbeb1a (patch)
tree070bc3dc215021c42b40c88e8ff9f22a90e30adc /al/buffer.cpp
parent097fac398470d15e9761a6441df5d47fa9a1ddfb (diff)
Add formats for UHJ with muLaw, and ADPCM for 2-channel UHJ
ADPCM doesn't seem to be well defined for more than two channels, even though there doesn't seem to be any issue with simply increasing the channel step over interleaved data (ffmpeg refuses to create IMA4 or MSADPCM files with more than two channels, and its decoder behaves oddly different when channels > 2). So IMA4 and MSADPCM can only safely handle 2-channel UHJ. There's no problem with muLaw supporting 2-, 3-, or 4-channel UHJ though.
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r--al/buffer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 2313a067..25f0b9e0 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -537,7 +537,7 @@ al::optional<DecompResult> DecomposeUserFormat(ALenum format)
UserFmtChannels channels;
UserFmtType type;
};
- static const std::array<FormatMap,55> UserFmtList{{
+ static const std::array<FormatMap,60> UserFmtList{{
{ AL_FORMAT_MONO8, UserFmtMono, UserFmtUByte },
{ AL_FORMAT_MONO16, UserFmtMono, UserFmtShort },
{ AL_FORMAT_MONO_FLOAT32, UserFmtMono, UserFmtFloat },
@@ -594,17 +594,22 @@ al::optional<DecompResult> DecomposeUserFormat(ALenum format)
{ AL_FORMAT_BFORMAT3D_FLOAT32, UserFmtBFormat3D, UserFmtFloat },
{ AL_FORMAT_BFORMAT3D_MULAW, UserFmtBFormat3D, UserFmtMulaw },
- { AL_FORMAT_UHJ2CHN8_SOFT, UserFmtUHJ2, UserFmtUByte },
- { AL_FORMAT_UHJ2CHN16_SOFT, UserFmtUHJ2, UserFmtShort },
- { AL_FORMAT_UHJ2CHN_FLOAT32_SOFT, UserFmtUHJ2, UserFmtFloat },
+ { AL_FORMAT_UHJ2CHN8_SOFT, UserFmtUHJ2, UserFmtUByte },
+ { AL_FORMAT_UHJ2CHN16_SOFT, UserFmtUHJ2, UserFmtShort },
+ { AL_FORMAT_UHJ2CHN_FLOAT32_SOFT, UserFmtUHJ2, UserFmtFloat },
+ { AL_FORMAT_UHJ2CHN_MULAW_SOFT, UserFmtUHJ2, UserFmtMulaw },
+ { AL_FORMAT_UHJ2CHN_IMA4_SOFT, UserFmtUHJ2, UserFmtIMA4 },
+ { AL_FORMAT_UHJ2CHN_MSADPCM_SOFT, UserFmtUHJ2, UserFmtMSADPCM },
{ AL_FORMAT_UHJ3CHN8_SOFT, UserFmtUHJ3, UserFmtUByte },
{ AL_FORMAT_UHJ3CHN16_SOFT, UserFmtUHJ3, UserFmtShort },
{ AL_FORMAT_UHJ3CHN_FLOAT32_SOFT, UserFmtUHJ3, UserFmtFloat },
+ { AL_FORMAT_UHJ3CHN_MULAW_SOFT, UserFmtUHJ3, UserFmtMulaw },
{ AL_FORMAT_UHJ4CHN8_SOFT, UserFmtUHJ4, UserFmtUByte },
{ AL_FORMAT_UHJ4CHN16_SOFT, UserFmtUHJ4, UserFmtShort },
{ AL_FORMAT_UHJ4CHN_FLOAT32_SOFT, UserFmtUHJ4, UserFmtFloat },
+ { AL_FORMAT_UHJ4CHN_MULAW_SOFT, UserFmtUHJ4, UserFmtMulaw },
}};
for(const auto &fmt : UserFmtList)