From 2c82778f93a2104632702b04bf6f1c6a15c53612 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 3 Apr 2023 10:36:06 -0700 Subject: Remove a duplicate function --- al/buffer.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/al/buffer.cpp b/al/buffer.cpp index 3e7f8175..ee506596 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -275,22 +275,6 @@ ALuint SanitizeAlignment(FmtType type, ALuint align) } -const ALchar *NameFromFmtType(FmtType type) -{ - switch(type) - { - case FmtUByte: return "UInt8"; - case FmtShort: return "Int16"; - case FmtFloat: return "Float32"; - case FmtDouble: return "Float64"; - case FmtMulaw: return "muLaw"; - case FmtAlaw: return "aLaw"; - case FmtIMA4: return "IMA4 ADPCM"; - case FmtMSADPCM: return "MSADPCM"; - } - return ""; -} - /** Loads the specified data into the buffer, using the specified format. */ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, const FmtChannels DstChannels, const FmtType DstType, const al::byte *SrcData, @@ -304,7 +288,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, const ALuint align{SanitizeAlignment(DstType, unpackalign)}; if(align < 1) UNLIKELY return context->setError(AL_INVALID_VALUE, "Invalid unpack alignment %u for %s samples", - unpackalign, NameFromFmtType(DstType)); + unpackalign, NameFromFormat(DstType)); const ALuint ambiorder{IsBFormat(DstChannels) ? ALBuf->UnpackAmbiOrder : (IsUHJ(DstChannels) ? 1 : 0)}; @@ -463,7 +447,7 @@ void PrepareUserPtr(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, const ALuint align{SanitizeAlignment(DstType, unpackalign)}; if(align < 1) UNLIKELY return context->setError(AL_INVALID_VALUE, "Invalid unpack alignment %u for %s samples", - unpackalign, NameFromFmtType(DstType)); + unpackalign, NameFromFormat(DstType)); auto get_type_alignment = [](const FmtType type) noexcept -> ALuint { @@ -486,7 +470,7 @@ void PrepareUserPtr(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, const auto typealign = get_type_alignment(DstType); if((reinterpret_cast(sdata) & (typealign-1)) != 0) return context->setError(AL_INVALID_VALUE, "Pointer %p is misaligned for %s samples (%u)", - static_cast(sdata), NameFromFmtType(DstType), typealign); + static_cast(sdata), NameFromFormat(DstType), typealign); const ALuint ambiorder{IsBFormat(DstChannels) ? ALBuf->UnpackAmbiOrder : (IsUHJ(DstChannels) ? 1 : 0)}; -- cgit v1.2.3