aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-11-18 05:33:30 -0800
committerChris Robinson <[email protected]>2023-11-18 06:04:38 -0800
commit6e224443096a85f5eefa8d815d6905824f230604 (patch)
tree7e928b75692ca1bba0386ce27b21735e20353d73 /al
parentfe5b3f4fed727b6cf0e98a3454070a53ffcb2ee6 (diff)
Start a 32-bit sample format extension
This ultimately is to properly distinguish and clarify formats being 32-bit integer and 32-bit float.
Diffstat (limited to 'al')
-rw-r--r--al/buffer.cpp169
1 files changed, 92 insertions, 77 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 82068b62..7d043036 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -550,83 +550,98 @@ std::optional<DecompResult> DecomposeUserFormat(ALenum format)
FmtChannels channels;
FmtType type;
};
- static const std::array<FormatMap,63> UserFmtList{{
- { AL_FORMAT_MONO8, FmtMono, FmtUByte },
- { AL_FORMAT_MONO16, FmtMono, FmtShort },
- { AL_FORMAT_MONO_FLOAT32, FmtMono, FmtFloat },
- { AL_FORMAT_MONO_DOUBLE_EXT, FmtMono, FmtDouble },
- { AL_FORMAT_MONO_IMA4, FmtMono, FmtIMA4 },
- { AL_FORMAT_MONO_MSADPCM_SOFT, FmtMono, FmtMSADPCM },
- { AL_FORMAT_MONO_MULAW, FmtMono, FmtMulaw },
- { AL_FORMAT_MONO_ALAW_EXT, FmtMono, FmtAlaw },
-
- { AL_FORMAT_STEREO8, FmtStereo, FmtUByte },
- { AL_FORMAT_STEREO16, FmtStereo, FmtShort },
- { AL_FORMAT_STEREO_FLOAT32, FmtStereo, FmtFloat },
- { AL_FORMAT_STEREO_DOUBLE_EXT, FmtStereo, FmtDouble },
- { AL_FORMAT_STEREO_IMA4, FmtStereo, FmtIMA4 },
- { AL_FORMAT_STEREO_MSADPCM_SOFT, FmtStereo, FmtMSADPCM },
- { AL_FORMAT_STEREO_MULAW, FmtStereo, FmtMulaw },
- { AL_FORMAT_STEREO_ALAW_EXT, FmtStereo, FmtAlaw },
-
- { AL_FORMAT_REAR8, FmtRear, FmtUByte },
- { AL_FORMAT_REAR16, FmtRear, FmtShort },
- { AL_FORMAT_REAR32, FmtRear, FmtFloat },
- { AL_FORMAT_REAR_MULAW, FmtRear, FmtMulaw },
-
- { AL_FORMAT_QUAD8_LOKI, FmtQuad, FmtUByte },
- { AL_FORMAT_QUAD16_LOKI, FmtQuad, FmtShort },
-
- { AL_FORMAT_QUAD8, FmtQuad, FmtUByte },
- { AL_FORMAT_QUAD16, FmtQuad, FmtShort },
- { AL_FORMAT_QUAD32, FmtQuad, FmtFloat },
- { AL_FORMAT_QUAD_MULAW, FmtQuad, FmtMulaw },
-
- { AL_FORMAT_51CHN8, FmtX51, FmtUByte },
- { AL_FORMAT_51CHN16, FmtX51, FmtShort },
- { AL_FORMAT_51CHN32, FmtX51, FmtFloat },
- { AL_FORMAT_51CHN_MULAW, FmtX51, FmtMulaw },
-
- { AL_FORMAT_61CHN8, FmtX61, FmtUByte },
- { AL_FORMAT_61CHN16, FmtX61, FmtShort },
- { AL_FORMAT_61CHN32, FmtX61, FmtFloat },
- { AL_FORMAT_61CHN_MULAW, FmtX61, FmtMulaw },
-
- { AL_FORMAT_71CHN8, FmtX71, FmtUByte },
- { AL_FORMAT_71CHN16, FmtX71, FmtShort },
- { AL_FORMAT_71CHN32, FmtX71, FmtFloat },
- { AL_FORMAT_71CHN_MULAW, FmtX71, FmtMulaw },
-
- { AL_FORMAT_BFORMAT2D_8, FmtBFormat2D, FmtUByte },
- { AL_FORMAT_BFORMAT2D_16, FmtBFormat2D, FmtShort },
- { AL_FORMAT_BFORMAT2D_FLOAT32, FmtBFormat2D, FmtFloat },
- { AL_FORMAT_BFORMAT2D_MULAW, FmtBFormat2D, FmtMulaw },
-
- { AL_FORMAT_BFORMAT3D_8, FmtBFormat3D, FmtUByte },
- { AL_FORMAT_BFORMAT3D_16, FmtBFormat3D, FmtShort },
- { AL_FORMAT_BFORMAT3D_FLOAT32, FmtBFormat3D, FmtFloat },
- { AL_FORMAT_BFORMAT3D_MULAW, FmtBFormat3D, FmtMulaw },
-
- { AL_FORMAT_UHJ2CHN8_SOFT, FmtUHJ2, FmtUByte },
- { AL_FORMAT_UHJ2CHN16_SOFT, FmtUHJ2, FmtShort },
- { AL_FORMAT_UHJ2CHN_FLOAT32_SOFT, FmtUHJ2, FmtFloat },
- { AL_FORMAT_UHJ2CHN_MULAW_SOFT, FmtUHJ2, FmtMulaw },
- { AL_FORMAT_UHJ2CHN_ALAW_SOFT, FmtUHJ2, FmtAlaw },
- { AL_FORMAT_UHJ2CHN_IMA4_SOFT, FmtUHJ2, FmtIMA4 },
- { AL_FORMAT_UHJ2CHN_MSADPCM_SOFT, FmtUHJ2, FmtMSADPCM },
-
- { AL_FORMAT_UHJ3CHN8_SOFT, FmtUHJ3, FmtUByte },
- { AL_FORMAT_UHJ3CHN16_SOFT, FmtUHJ3, FmtShort },
- { AL_FORMAT_UHJ3CHN_FLOAT32_SOFT, FmtUHJ3, FmtFloat },
- { AL_FORMAT_UHJ3CHN_MULAW_SOFT, FmtUHJ3, FmtMulaw },
- { AL_FORMAT_UHJ3CHN_ALAW_SOFT, FmtUHJ3, FmtAlaw },
-
- { AL_FORMAT_UHJ4CHN8_SOFT, FmtUHJ4, FmtUByte },
- { AL_FORMAT_UHJ4CHN16_SOFT, FmtUHJ4, FmtShort },
- { AL_FORMAT_UHJ4CHN_FLOAT32_SOFT, FmtUHJ4, FmtFloat },
- { AL_FORMAT_UHJ4CHN_MULAW_SOFT, FmtUHJ4, FmtMulaw },
- { AL_FORMAT_UHJ4CHN_ALAW_SOFT, FmtUHJ4, FmtAlaw },
- }};
+ static constexpr std::array UserFmtList{
+ FormatMap{AL_FORMAT_MONO8, FmtMono, FmtUByte },
+ FormatMap{AL_FORMAT_MONO16, FmtMono, FmtShort },
+ FormatMap{AL_FORMAT_MONO_I32, FmtMono, FmtInt },
+ FormatMap{AL_FORMAT_MONO_FLOAT32, FmtMono, FmtFloat },
+ FormatMap{AL_FORMAT_MONO_DOUBLE_EXT, FmtMono, FmtDouble },
+ FormatMap{AL_FORMAT_MONO_IMA4, FmtMono, FmtIMA4 },
+ FormatMap{AL_FORMAT_MONO_MSADPCM_SOFT, FmtMono, FmtMSADPCM},
+ FormatMap{AL_FORMAT_MONO_MULAW, FmtMono, FmtMulaw },
+ FormatMap{AL_FORMAT_MONO_ALAW_EXT, FmtMono, FmtAlaw },
+
+ FormatMap{AL_FORMAT_STEREO8, FmtStereo, FmtUByte },
+ FormatMap{AL_FORMAT_STEREO16, FmtStereo, FmtShort },
+ FormatMap{AL_FORMAT_STEREO_I32, FmtStereo, FmtInt },
+ FormatMap{AL_FORMAT_STEREO_FLOAT32, FmtStereo, FmtFloat },
+ FormatMap{AL_FORMAT_STEREO_DOUBLE_EXT, FmtStereo, FmtDouble },
+ FormatMap{AL_FORMAT_STEREO_IMA4, FmtStereo, FmtIMA4 },
+ FormatMap{AL_FORMAT_STEREO_MSADPCM_SOFT, FmtStereo, FmtMSADPCM},
+ FormatMap{AL_FORMAT_STEREO_MULAW, FmtStereo, FmtMulaw },
+ FormatMap{AL_FORMAT_STEREO_ALAW_EXT, FmtStereo, FmtAlaw },
+
+ FormatMap{AL_FORMAT_REAR8, FmtRear, FmtUByte},
+ FormatMap{AL_FORMAT_REAR16, FmtRear, FmtShort},
+ FormatMap{AL_FORMAT_REAR32, FmtRear, FmtFloat},
+ FormatMap{AL_FORMAT_REAR_I32, FmtRear, FmtInt },
+ FormatMap{AL_FORMAT_REAR_FLOAT32, FmtRear, FmtFloat},
+ FormatMap{AL_FORMAT_REAR_MULAW, FmtRear, FmtMulaw},
+
+ FormatMap{AL_FORMAT_QUAD8_LOKI, FmtQuad, FmtUByte},
+ FormatMap{AL_FORMAT_QUAD16_LOKI, FmtQuad, FmtShort},
+
+ FormatMap{AL_FORMAT_QUAD8, FmtQuad, FmtUByte},
+ FormatMap{AL_FORMAT_QUAD16, FmtQuad, FmtShort},
+ FormatMap{AL_FORMAT_QUAD32, FmtQuad, FmtFloat},
+ FormatMap{AL_FORMAT_QUAD_I32, FmtQuad, FmtInt },
+ FormatMap{AL_FORMAT_QUAD_FLOAT32, FmtQuad, FmtFloat},
+ FormatMap{AL_FORMAT_QUAD_MULAW, FmtQuad, FmtMulaw},
+
+ FormatMap{AL_FORMAT_51CHN8, FmtX51, FmtUByte},
+ FormatMap{AL_FORMAT_51CHN16, FmtX51, FmtShort},
+ FormatMap{AL_FORMAT_51CHN32, FmtX51, FmtFloat},
+ FormatMap{AL_FORMAT_51CHN_I32, FmtX51, FmtInt },
+ FormatMap{AL_FORMAT_51CHN_FLOAT32, FmtX51, FmtFloat},
+ FormatMap{AL_FORMAT_51CHN_MULAW, FmtX51, FmtMulaw},
+
+ FormatMap{AL_FORMAT_61CHN8, FmtX61, FmtUByte},
+ FormatMap{AL_FORMAT_61CHN16, FmtX61, FmtShort},
+ FormatMap{AL_FORMAT_61CHN32, FmtX61, FmtFloat},
+ FormatMap{AL_FORMAT_61CHN_I32, FmtX61, FmtInt },
+ FormatMap{AL_FORMAT_61CHN_FLOAT32, FmtX61, FmtFloat},
+ FormatMap{AL_FORMAT_61CHN_MULAW, FmtX61, FmtMulaw},
+
+ FormatMap{AL_FORMAT_71CHN8, FmtX71, FmtUByte},
+ FormatMap{AL_FORMAT_71CHN16, FmtX71, FmtShort},
+ FormatMap{AL_FORMAT_71CHN32, FmtX71, FmtFloat},
+ FormatMap{AL_FORMAT_71CHN_I32, FmtX71, FmtInt },
+ FormatMap{AL_FORMAT_71CHN_FLOAT32, FmtX71, FmtFloat},
+ FormatMap{AL_FORMAT_71CHN_MULAW, FmtX71, FmtMulaw},
+
+ FormatMap{AL_FORMAT_BFORMAT2D_8, FmtBFormat2D, FmtUByte},
+ FormatMap{AL_FORMAT_BFORMAT2D_16, FmtBFormat2D, FmtShort},
+ FormatMap{AL_FORMAT_BFORMAT2D_FLOAT32, FmtBFormat2D, FmtFloat},
+ FormatMap{AL_FORMAT_BFORMAT2D_MULAW, FmtBFormat2D, FmtMulaw},
+
+ FormatMap{AL_FORMAT_BFORMAT3D_8, FmtBFormat3D, FmtUByte},
+ FormatMap{AL_FORMAT_BFORMAT3D_16, FmtBFormat3D, FmtShort},
+ FormatMap{AL_FORMAT_BFORMAT3D_FLOAT32, FmtBFormat3D, FmtFloat},
+ FormatMap{AL_FORMAT_BFORMAT3D_MULAW, FmtBFormat3D, FmtMulaw},
+
+ FormatMap{AL_FORMAT_UHJ2CHN8_SOFT, FmtUHJ2, FmtUByte },
+ FormatMap{AL_FORMAT_UHJ2CHN16_SOFT, FmtUHJ2, FmtShort },
+ FormatMap{AL_FORMAT_UHJ2CHN_I32, FmtUHJ2, FmtInt },
+ FormatMap{AL_FORMAT_UHJ2CHN_FLOAT32_SOFT, FmtUHJ2, FmtFloat },
+ FormatMap{AL_FORMAT_UHJ2CHN_MULAW_SOFT, FmtUHJ2, FmtMulaw },
+ FormatMap{AL_FORMAT_UHJ2CHN_ALAW_SOFT, FmtUHJ2, FmtAlaw },
+ FormatMap{AL_FORMAT_UHJ2CHN_IMA4_SOFT, FmtUHJ2, FmtIMA4 },
+ FormatMap{AL_FORMAT_UHJ2CHN_MSADPCM_SOFT, FmtUHJ2, FmtMSADPCM},
+
+ FormatMap{AL_FORMAT_UHJ3CHN8_SOFT, FmtUHJ3, FmtUByte},
+ FormatMap{AL_FORMAT_UHJ3CHN16_SOFT, FmtUHJ3, FmtShort},
+ FormatMap{AL_FORMAT_UHJ3CHN_I32, FmtUHJ3, FmtInt },
+ FormatMap{AL_FORMAT_UHJ3CHN_FLOAT32_SOFT, FmtUHJ3, FmtFloat},
+ FormatMap{AL_FORMAT_UHJ3CHN_MULAW_SOFT, FmtUHJ3, FmtMulaw},
+ FormatMap{AL_FORMAT_UHJ3CHN_ALAW_SOFT, FmtUHJ3, FmtAlaw },
+
+ FormatMap{AL_FORMAT_UHJ4CHN8_SOFT, FmtUHJ4, FmtUByte},
+ FormatMap{AL_FORMAT_UHJ4CHN16_SOFT, FmtUHJ4, FmtShort},
+ FormatMap{AL_FORMAT_UHJ4CHN_I32, FmtUHJ4, FmtInt },
+ FormatMap{AL_FORMAT_UHJ4CHN_FLOAT32_SOFT, FmtUHJ4, FmtFloat},
+ FormatMap{AL_FORMAT_UHJ4CHN_MULAW_SOFT, FmtUHJ4, FmtMulaw},
+ FormatMap{AL_FORMAT_UHJ4CHN_ALAW_SOFT, FmtUHJ4, FmtAlaw },
+ };
for(const auto &fmt : UserFmtList)
{