From 000c3020bd3e618e1c0d3e83bb4223f8f1642a4b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 8 Dec 2024 08:56:58 -0800 Subject: [PATCH] Fix printing some more hex values --- al/auxeffectslot.cpp | 30 +++++++++++++++++------------- al/debug.cpp | 29 ++++++++++++++++++----------- al/effect.cpp | 4 ++-- al/effects/autowah.cpp | 16 +++++++++------- al/effects/chorus.cpp | 31 +++++++++++++++++++++---------- al/effects/compressor.cpp | 15 +++++++++------ al/effects/convolution.cpp | 8 ++++---- al/effects/dedicated.cpp | 29 +++++++++++++++++------------ al/effects/distortion.cpp | 16 +++++++++------- al/effects/echo.cpp | 15 +++++++++------ al/effects/equalizer.cpp | 16 +++++++++------- al/effects/fshifter.cpp | 21 +++++++++++---------- al/effects/modulator.cpp | 16 +++++++++++----- al/effects/null.cpp | 13 +++++++++---- al/effects/pshifter.cpp | 13 +++++++------ al/effects/reverb.cpp | 24 ++++++++++++++++-------- al/effects/vmorpher.cpp | 23 +++++++++++++---------- al/error.cpp | 6 +++--- al/event.cpp | 3 ++- alc/backends/jack.cpp | 7 ++++--- alc/backends/pulseaudio.cpp | 5 +++-- alc/backends/sdl2.cpp | 4 ++-- alc/backends/sdl3.cpp | 2 +- alc/backends/sndio.cpp | 6 +++--- alc/backends/solaris.cpp | 2 +- alc/backends/winmm.cpp | 3 ++- alc/events.cpp | 3 ++- alc/panning.cpp | 2 +- core/ambdec.cpp | 2 +- examples/aldebug.cpp | 3 ++- examples/alffplay.cpp | 8 ++++---- examples/alstreamcb.cpp | 4 +++- 32 files changed, 225 insertions(+), 154 deletions(-) diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 6be35b076c..e9ccafdda6 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -243,7 +243,7 @@ constexpr auto EffectSlotTypeFromEnum(ALenum type) noexcept -> EffectSlotType case AL_EFFECT_DEDICATED_DIALOGUE: return EffectSlotType::Dedicated; case AL_EFFECT_CONVOLUTION_SOFT: return EffectSlotType::Convolution; } - ERR("Unhandled effect enum: 0x{:04x}", type); + ERR("Unhandled effect enum: {:#04x}", as_unsigned(type)); return EffectSlotType::None; } @@ -641,7 +641,8 @@ try { context->throw_error(AL_INVALID_OPERATION, "AL_EFFECTSLOT_STATE_SOFT is read-only"); } - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -669,8 +670,8 @@ try { if(!slot) context->throw_error(AL_INVALID_NAME, "Invalid effect slot ID {}", effectslot); - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer-vector property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -702,7 +703,8 @@ try { return; } - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -726,8 +728,8 @@ try { if(!slot) context->throw_error(AL_INVALID_NAME, "Invalid effect slot ID {}", effectslot); - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float-vector property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -774,7 +776,8 @@ try { return; } - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -802,8 +805,8 @@ try { if(!slot) context->throw_error(AL_INVALID_NAME, "Invalid effect slot ID {}", effectslot); - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot integer-vector property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -825,7 +828,8 @@ try { case AL_EFFECTSLOT_GAIN: *value = slot->Gain; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } @@ -849,8 +853,8 @@ try { if(!slot) context->throw_error(AL_INVALID_NAME, "Invalid effect slot ID {}", effectslot); - context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid effect slot float-vector property {:#04x}", + as_unsigned(param)); } catch(al::base_exception&) { } diff --git a/al/debug.cpp b/al/debug.cpp index f5f7514441..bb742e7469 100644 --- a/al/debug.cpp +++ b/al/debug.cpp @@ -274,17 +274,19 @@ try { auto dsource = GetDebugSource(source); if(!dsource) - context->throw_error(AL_INVALID_ENUM, "Invalid debug source 0x{:04x}", source); + context->throw_error(AL_INVALID_ENUM, "Invalid debug source {:#04x}", as_unsigned(source)); if(*dsource != DebugSource::ThirdParty && *dsource != DebugSource::Application) - context->throw_error(AL_INVALID_ENUM, "Debug source 0x{:04x} not allowed", source); + context->throw_error(AL_INVALID_ENUM, "Debug source {:#04x} not allowed", + as_unsigned(source)); auto dtype = GetDebugType(type); if(!dtype) - context->throw_error(AL_INVALID_ENUM, "Invalid debug type 0x{:04x}", type); + context->throw_error(AL_INVALID_ENUM, "Invalid debug type {:#04x}", as_unsigned(type)); auto dseverity = GetDebugSeverity(severity); if(!dseverity) - context->throw_error(AL_INVALID_ENUM, "Invalid debug severity 0x{:04x}", severity); + context->throw_error(AL_INVALID_ENUM, "Invalid debug severity {:#04x}", + as_unsigned(severity)); context->debugMessage(*dsource, *dtype, id, *dseverity, msgview); } @@ -325,7 +327,8 @@ try { { auto dsource = GetDebugSource(source); if(!dsource) - context->throw_error(AL_INVALID_ENUM, "Invalid debug source 0x{:04x}", source); + context->throw_error(AL_INVALID_ENUM, "Invalid debug source {:#04x}", + as_unsigned(source)); srcIndices = srcIndices.subspan(al::to_underlying(*dsource), 1); } @@ -334,7 +337,7 @@ try { { auto dtype = GetDebugType(type); if(!dtype) - context->throw_error(AL_INVALID_ENUM, "Invalid debug type 0x{:04x}", type); + context->throw_error(AL_INVALID_ENUM, "Invalid debug type {:#04x}", as_unsigned(type)); typeIndices = typeIndices.subspan(al::to_underlying(*dtype), 1); } @@ -343,7 +346,8 @@ try { { auto dseverity = GetDebugSeverity(severity); if(!dseverity) - context->throw_error(AL_INVALID_ENUM, "Invalid debug severity 0x{:04x}", severity); + context->throw_error(AL_INVALID_ENUM, "Invalid debug severity {:#04x}", + as_unsigned(severity)); svrIndices = svrIndices.subspan(al::to_underlying(*dseverity), 1); } @@ -414,9 +418,10 @@ try { auto dsource = GetDebugSource(source); if(!dsource) - context->throw_error(AL_INVALID_ENUM, "Invalid debug source 0x{:04x}", source); + context->throw_error(AL_INVALID_ENUM, "Invalid debug source {:#04x}", as_unsigned(source)); if(*dsource != DebugSource::ThirdParty && *dsource != DebugSource::Application) - context->throw_error(AL_INVALID_ENUM, "Debug source 0x{:04x} not allowed", source); + context->throw_error(AL_INVALID_ENUM, "Debug source {:#04x} not allowed", + as_unsigned(source)); std::unique_lock debuglock{context->mDebugCbLock}; if(context->mDebugGroups.size() >= MaxDebugGroupDepth) @@ -548,7 +553,8 @@ try { case AL_AUXILIARY_EFFECT_SLOT_EXT: ALeffectslot::SetName(context, name, objname); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid name identifier 0x{:04x}", identifier); + context->throw_error(AL_INVALID_ENUM, "Invalid name identifier {:#04x}", + as_unsigned(identifier)); } catch(al::base_exception&) { } @@ -618,7 +624,8 @@ try { copy_name(context->mEffectSlotNames); } else - context->throw_error(AL_INVALID_ENUM, "Invalid name identifier 0x{:04x}", identifier); + context->throw_error(AL_INVALID_ENUM, "Invalid name identifier {:#04x}", + as_unsigned(identifier)); } catch(al::base_exception&) { } diff --git a/al/effect.cpp b/al/effect.cpp index 7f2911d885..0c549d8ab5 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -299,8 +299,8 @@ try { auto check_effect = [value](const EffectList &item) -> bool { return value == item.val && !DisabledEffects.test(item.type); }; if(!std::any_of(gEffectList.cbegin(), gEffectList.cend(), check_effect)) - context->throw_error(AL_INVALID_VALUE, "Effect type 0x{:04x} not supported", - value); + context->throw_error(AL_INVALID_VALUE, "Effect type {:#04x} not supported", + as_unsigned(value)); } InitEffectParams(aleffect, value); diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp index 1709eef87d..7519d31bd1 100644 --- a/al/effects/autowah.cpp +++ b/al/effects/autowah.cpp @@ -7,10 +7,10 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX -#include "alnumeric.h" #include "al/eax/effect.h" #include "al/eax/exception.h" #include "al/eax/utils.h" @@ -34,9 +34,9 @@ constexpr EffectProps genDefaultProps() noexcept const EffectProps AutowahEffectProps{genDefaultProps()}; void AutowahEffectHandler::SetParami(ALCcontext *context, AutowahProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property {:#04x}", as_unsigned(param)); } void AutowahEffectHandler::SetParamiv(ALCcontext *context, AutowahProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property {:#04x}", as_unsigned(param)); } void AutowahEffectHandler::SetParamf(ALCcontext *context, AutowahProps &props, ALenum param, float val) { @@ -67,15 +67,16 @@ void AutowahEffectHandler::SetParamf(ALCcontext *context, AutowahProps &props, A return; } - context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property {:#04x}", + as_unsigned(param)); } void AutowahEffectHandler::SetParamfv(ALCcontext *context, AutowahProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void AutowahEffectHandler::GetParami(ALCcontext *context, const AutowahProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property {:#04x}", as_unsigned(param)); } void AutowahEffectHandler::GetParamiv(ALCcontext *context, const AutowahProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property {:#04x}", as_unsigned(param)); } void AutowahEffectHandler::GetParamf(ALCcontext *context, const AutowahProps &props, ALenum param, float *val) { @@ -87,7 +88,8 @@ void AutowahEffectHandler::GetParamf(ALCcontext *context, const AutowahProps &pr case AL_AUTOWAH_PEAK_GAIN: *val = props.PeakGain; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property {:#04x}", + as_unsigned(param)); } void AutowahEffectHandler::GetParamfv(ALCcontext *context, const AutowahProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index a9e25ea2a7..c10b9d434b 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -8,6 +8,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -82,7 +83,8 @@ void ChorusEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, ALe if(auto formopt = WaveformFromEnum(val)) props.Waveform = *formopt; else - context->throw_error(AL_INVALID_VALUE, "Invalid chorus waveform: 0x{:04x}", val); + context->throw_error(AL_INVALID_VALUE, "Invalid chorus waveform: {:#04x}", + as_unsigned(val)); return; case AL_CHORUS_PHASE: @@ -92,7 +94,8 @@ void ChorusEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, ALe return; } - context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property {:#04x}", + as_unsigned(param)); } void ChorusEffectHandler::SetParamiv(ALCcontext *context, ChorusProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -125,7 +128,8 @@ void ChorusEffectHandler::SetParamf(ALCcontext *context, ChorusProps &props, ALe return; } - context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property {:#04x}", + as_unsigned(param)); } void ChorusEffectHandler::SetParamfv(ALCcontext *context, ChorusProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -138,7 +142,8 @@ void ChorusEffectHandler::GetParami(ALCcontext *context, const ChorusProps &prop case AL_CHORUS_PHASE: *val = props.Phase; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property {:#04x}", + as_unsigned(param)); } void ChorusEffectHandler::GetParamiv(ALCcontext *context, const ChorusProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -152,7 +157,8 @@ void ChorusEffectHandler::GetParamf(ALCcontext *context, const ChorusProps &prop case AL_CHORUS_DELAY: *val = props.Delay; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property {:#04x}", + as_unsigned(param)); } void ChorusEffectHandler::GetParamfv(ALCcontext *context, const ChorusProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } @@ -168,7 +174,8 @@ void FlangerEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, AL if(auto formopt = WaveformFromEnum(val)) props.Waveform = *formopt; else - context->throw_error(AL_INVALID_VALUE, "Invalid flanger waveform: 0x{:04x}", val); + context->throw_error(AL_INVALID_VALUE, "Invalid flanger waveform: {:#04x}", + as_unsigned(val)); return; case AL_FLANGER_PHASE: @@ -178,7 +185,8 @@ void FlangerEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, AL return; } - context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property {:#04x}", + as_unsigned(param)); } void FlangerEffectHandler::SetParamiv(ALCcontext *context, ChorusProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -211,7 +219,8 @@ void FlangerEffectHandler::SetParamf(ALCcontext *context, ChorusProps &props, AL return; } - context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property {:#04x}", + as_unsigned(param)); } void FlangerEffectHandler::SetParamfv(ALCcontext *context, ChorusProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -224,7 +233,8 @@ void FlangerEffectHandler::GetParami(ALCcontext *context, const ChorusProps &pro case AL_FLANGER_PHASE: *val = props.Phase; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property {:#04x}", + as_unsigned(param)); } void FlangerEffectHandler::GetParamiv(ALCcontext *context, const ChorusProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -238,7 +248,8 @@ void FlangerEffectHandler::GetParamf(ALCcontext *context, const ChorusProps &pro case AL_FLANGER_DELAY: *val = props.Delay; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property {:#04x}", + as_unsigned(param)); } void FlangerEffectHandler::GetParamfv(ALCcontext *context, const ChorusProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp index eb82ff77e9..f5c6786af1 100644 --- a/al/effects/compressor.cpp +++ b/al/effects/compressor.cpp @@ -5,6 +5,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -38,14 +39,15 @@ void CompressorEffectHandler::SetParami(ALCcontext *context, CompressorProps &pr return; } - context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property {:#04x}", + as_unsigned(param)); } void CompressorEffectHandler::SetParamiv(ALCcontext *context, CompressorProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } void CompressorEffectHandler::SetParamf(ALCcontext *context, CompressorProps&, ALenum param, float) -{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property {:#04x}", as_unsigned(param)); } void CompressorEffectHandler::SetParamfv(ALCcontext *context, CompressorProps&, ALenum param, const float*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property {:#04x}", as_unsigned(param)); } void CompressorEffectHandler::GetParami(ALCcontext *context, const CompressorProps &props, ALenum param, int *val) { @@ -54,14 +56,15 @@ void CompressorEffectHandler::GetParami(ALCcontext *context, const CompressorPro case AL_COMPRESSOR_ONOFF: *val = props.OnOff; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property {:#04x}", + as_unsigned(param)); } void CompressorEffectHandler::GetParamiv(ALCcontext *context, const CompressorProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } void CompressorEffectHandler::GetParamf(ALCcontext *context, const CompressorProps&, ALenum param, float*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property {:#04x}", as_unsigned(param)); } void CompressorEffectHandler::GetParamfv(ALCcontext *context, const CompressorProps&, ALenum param, float*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property {:#04x}", as_unsigned(param)); } #if ALSOFT_EAX diff --git a/al/effects/convolution.cpp b/al/effects/convolution.cpp index 4324923be1..84de06c185 100644 --- a/al/effects/convolution.cpp +++ b/al/effects/convolution.cpp @@ -29,12 +29,12 @@ constexpr EffectProps genDefaultProps() noexcept const EffectProps ConvolutionEffectProps{genDefaultProps()}; void ConvolutionEffectHandler::SetParami(ALCcontext *context, ConvolutionProps& /*props*/, ALenum param, int /*val*/) -{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property {:#04x}", as_unsigned(param)); } void ConvolutionEffectHandler::SetParamiv(ALCcontext *context, ConvolutionProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } void ConvolutionEffectHandler::SetParamf(ALCcontext *context, ConvolutionProps& /*props*/, ALenum param, float /*val*/) -{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property {:#04x}", as_unsigned(param)); } void ConvolutionEffectHandler::SetParamfv(ALCcontext *context, ConvolutionProps &props, ALenum param, const float *values) { static constexpr auto finite_checker = [](float val) -> bool { return std::isfinite(val); }; @@ -55,12 +55,12 @@ void ConvolutionEffectHandler::SetParamfv(ALCcontext *context, ConvolutionProps } void ConvolutionEffectHandler::GetParami(ALCcontext *context, const ConvolutionProps& /*props*/, ALenum param, int* /*val*/) -{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property {:#04x}", as_unsigned(param)); } void ConvolutionEffectHandler::GetParamiv(ALCcontext *context, const ConvolutionProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } void ConvolutionEffectHandler::GetParamf(ALCcontext *context, const ConvolutionProps& /*props*/, ALenum param, float* /*val*/) -{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property {:#04x}", as_unsigned(param)); } void ConvolutionEffectHandler::GetParamfv(ALCcontext *context, const ConvolutionProps &props, ALenum param, float *values) { switch(param) diff --git a/al/effects/dedicated.cpp b/al/effects/dedicated.cpp index 111ee7c43e..5776b42be2 100644 --- a/al/effects/dedicated.cpp +++ b/al/effects/dedicated.cpp @@ -7,6 +7,7 @@ #include "AL/alext.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" @@ -33,9 +34,9 @@ constexpr EffectProps genDefaultLfeProps() noexcept const EffectProps DedicatedDialogEffectProps{genDefaultDialogProps()}; void DedicatedDialogEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); } void DedicatedDialogEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); } void DedicatedDialogEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val) { switch(param) @@ -47,15 +48,16 @@ void DedicatedDialogEffectHandler::SetParamf(ALCcontext *context, DedicatedProps return; } - context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}", + as_unsigned(param)); } void DedicatedDialogEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void DedicatedDialogEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); } void DedicatedDialogEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); } void DedicatedDialogEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val) { switch(param) @@ -63,7 +65,8 @@ void DedicatedDialogEffectHandler::GetParamf(ALCcontext *context, const Dedicate case AL_DEDICATED_GAIN: *val = props.Gain; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}", + as_unsigned(param)); } void DedicatedDialogEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } @@ -72,9 +75,9 @@ void DedicatedDialogEffectHandler::GetParamfv(ALCcontext *context, const Dedicat const EffectProps DedicatedLfeEffectProps{genDefaultLfeProps()}; void DedicatedLfeEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); } void DedicatedLfeEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); } void DedicatedLfeEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val) { switch(param) @@ -86,15 +89,16 @@ void DedicatedLfeEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &p return; } - context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}", + as_unsigned(param)); } void DedicatedLfeEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void DedicatedLfeEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); } void DedicatedLfeEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); } void DedicatedLfeEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val) { switch(param) @@ -102,7 +106,8 @@ void DedicatedLfeEffectHandler::GetParamf(ALCcontext *context, const DedicatedPr case AL_DEDICATED_GAIN: *val = props.Gain; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}", + as_unsigned(param)); } void DedicatedLfeEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index a72c319f98..2109e384bc 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -5,10 +5,10 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX -#include "alnumeric.h" #include "al/eax/effect.h" #include "al/eax/exception.h" #include "al/eax/utils.h" @@ -33,9 +33,9 @@ constexpr EffectProps genDefaultProps() noexcept const EffectProps DistortionEffectProps{genDefaultProps()}; void DistortionEffectHandler::SetParami(ALCcontext *context, DistortionProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property {:#04x}", as_unsigned(param)); } void DistortionEffectHandler::SetParamiv(ALCcontext *context, DistortionProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property {:#04x}", as_unsigned(param)); } void DistortionEffectHandler::SetParamf(ALCcontext *context, DistortionProps &props, ALenum param, float val) { @@ -72,15 +72,16 @@ void DistortionEffectHandler::SetParamf(ALCcontext *context, DistortionProps &pr return; } - context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property {:#04x}", + as_unsigned(param)); } void DistortionEffectHandler::SetParamfv(ALCcontext *context, DistortionProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void DistortionEffectHandler::GetParami(ALCcontext *context, const DistortionProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property {:#04x}", as_unsigned(param)); } void DistortionEffectHandler::GetParamiv(ALCcontext *context, const DistortionProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property {:#04x}", as_unsigned(param)); } void DistortionEffectHandler::GetParamf(ALCcontext *context, const DistortionProps &props, ALenum param, float *val) { @@ -93,7 +94,8 @@ void DistortionEffectHandler::GetParamf(ALCcontext *context, const DistortionPro case AL_DISTORTION_EQBANDWIDTH: *val = props.EQBandwidth; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property {:#04x}", + as_unsigned(param)); } void DistortionEffectHandler::GetParamfv(ALCcontext *context, const DistortionProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp index da3bb2e377..2a5faf0d0a 100644 --- a/al/effects/echo.cpp +++ b/al/effects/echo.cpp @@ -5,6 +5,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -35,9 +36,9 @@ constexpr EffectProps genDefaultProps() noexcept const EffectProps EchoEffectProps{genDefaultProps()}; void EchoEffectHandler::SetParami(ALCcontext *context, EchoProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property {:#04x}", as_unsigned(param)); } void EchoEffectHandler::SetParamiv(ALCcontext *context, EchoProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property {:#04x}", as_unsigned(param)); } void EchoEffectHandler::SetParamf(ALCcontext *context, EchoProps &props, ALenum param, float val) { switch(param) @@ -73,15 +74,16 @@ void EchoEffectHandler::SetParamf(ALCcontext *context, EchoProps &props, ALenum return; } - context->throw_error(AL_INVALID_ENUM, "Invalid echo float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid echo float property {:#04x}", + as_unsigned(param)); } void EchoEffectHandler::SetParamfv(ALCcontext *context, EchoProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void EchoEffectHandler::GetParami(ALCcontext *context, const EchoProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property {:#04x}", as_unsigned(param)); } void EchoEffectHandler::GetParamiv(ALCcontext *context, const EchoProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property {:#04x}", as_unsigned(param)); } void EchoEffectHandler::GetParamf(ALCcontext *context, const EchoProps &props, ALenum param, float *val) { switch(param) @@ -93,7 +95,8 @@ void EchoEffectHandler::GetParamf(ALCcontext *context, const EchoProps &props, A case AL_ECHO_SPREAD: *val = props.Spread; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid echo float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid echo float property {:#04x}", + as_unsigned(param)); } void EchoEffectHandler::GetParamfv(ALCcontext *context, const EchoProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index 6d608f613f..360fd5d8f3 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -5,10 +5,10 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX -#include "alnumeric.h" #include "al/eax/effect.h" #include "al/eax/exception.h" #include "al/eax/utils.h" @@ -38,9 +38,9 @@ constexpr EffectProps genDefaultProps() noexcept const EffectProps EqualizerEffectProps{genDefaultProps()}; void EqualizerEffectHandler::SetParami(ALCcontext *context, EqualizerProps&, ALenum param, int) -{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property {:#04x}", as_unsigned(param)); } void EqualizerEffectHandler::SetParamiv(ALCcontext *context, EqualizerProps&, ALenum param, const int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property {:#04x}", as_unsigned(param)); } void EqualizerEffectHandler::SetParamf(ALCcontext *context, EqualizerProps &props, ALenum param, float val) { switch(param) @@ -106,15 +106,16 @@ void EqualizerEffectHandler::SetParamf(ALCcontext *context, EqualizerProps &prop return; } - context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property {:#04x}", + as_unsigned(param)); } void EqualizerEffectHandler::SetParamfv(ALCcontext *context, EqualizerProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } void EqualizerEffectHandler::GetParami(ALCcontext *context, const EqualizerProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property {:#04x}", as_unsigned(param)); } void EqualizerEffectHandler::GetParamiv(ALCcontext *context, const EqualizerProps&, ALenum param, int*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property {:#04x}", as_unsigned(param)); } void EqualizerEffectHandler::GetParamf(ALCcontext *context, const EqualizerProps &props, ALenum param, float *val) { switch(param) @@ -131,7 +132,8 @@ void EqualizerEffectHandler::GetParamf(ALCcontext *context, const EqualizerProps case AL_EQUALIZER_HIGH_CUTOFF: *val = props.HighCutoff; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property {:#04x}", + as_unsigned(param)); } void EqualizerEffectHandler::GetParamfv(ALCcontext *context, const EqualizerProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp index 39d602a34c..d1c93921ff 100644 --- a/al/effects/fshifter.cpp +++ b/al/effects/fshifter.cpp @@ -8,6 +8,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -64,7 +65,7 @@ void FshifterEffectHandler::SetParami(ALCcontext *context, FshifterProps &props, props.LeftDirection = *diropt; else context->throw_error(AL_INVALID_VALUE, - "Unsupported frequency shifter left direction: 0x{:04x}", val); + "Unsupported frequency shifter left direction: {:#04x}", as_unsigned(val)); return; case AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION: @@ -72,12 +73,12 @@ void FshifterEffectHandler::SetParami(ALCcontext *context, FshifterProps &props, props.RightDirection = *diropt; else context->throw_error(AL_INVALID_VALUE, - "Unsupported frequency shifter right direction: 0x{:04x}", val); + "Unsupported frequency shifter right direction: {:#04x}", as_unsigned(val)); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property {:#04x}", + as_unsigned(param)); } void FshifterEffectHandler::SetParamiv(ALCcontext *context, FshifterProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -93,8 +94,8 @@ void FshifterEffectHandler::SetParamf(ALCcontext *context, FshifterProps &props, return; } - context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property {:#04x}", + as_unsigned(param)); } void FshifterEffectHandler::SetParamfv(ALCcontext *context, FshifterProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -111,8 +112,8 @@ void FshifterEffectHandler::GetParami(ALCcontext *context, const FshifterProps & return; } - context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property {:#04x}", + as_unsigned(param)); } void FshifterEffectHandler::GetParamiv(ALCcontext *context, const FshifterProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -124,8 +125,8 @@ void FshifterEffectHandler::GetParamf(ALCcontext *context, const FshifterProps & case AL_FREQUENCY_SHIFTER_FREQUENCY: *val = props.Frequency; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property {:#04x}", + as_unsigned(param)); } void FshifterEffectHandler::GetParamfv(ALCcontext *context, const FshifterProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp index 0cd51b0eca..b3ca22138f 100644 --- a/al/effects/modulator.cpp +++ b/al/effects/modulator.cpp @@ -8,6 +8,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -69,11 +70,13 @@ void ModulatorEffectHandler::SetParami(ALCcontext *context, ModulatorProps &prop if(auto formopt = WaveformFromEmum(val)) props.Waveform = *formopt; else - context->throw_error(AL_INVALID_VALUE, "Invalid modulator waveform: 0x{:04x}", val); + context->throw_error(AL_INVALID_VALUE, "Invalid modulator waveform: {:#04x}", + as_unsigned(val)); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property {:#04x}", + as_unsigned(param)); } void ModulatorEffectHandler::SetParamiv(ALCcontext *context, ModulatorProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -96,7 +99,8 @@ void ModulatorEffectHandler::SetParamf(ALCcontext *context, ModulatorProps &prop return; } - context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property {:#04x}", + as_unsigned(param)); } void ModulatorEffectHandler::SetParamfv(ALCcontext *context, ModulatorProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -110,7 +114,8 @@ void ModulatorEffectHandler::GetParami(ALCcontext *context, const ModulatorProps case AL_RING_MODULATOR_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property {:#04x}", + as_unsigned(param)); } void ModulatorEffectHandler::GetParamiv(ALCcontext *context, const ModulatorProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -122,7 +127,8 @@ void ModulatorEffectHandler::GetParamf(ALCcontext *context, const ModulatorProps case AL_RING_MODULATOR_HIGHPASS_CUTOFF: *val = props.HighPassCutoff; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property {:#04x}", + as_unsigned(param)); } void ModulatorEffectHandler::GetParamfv(ALCcontext *context, const ModulatorProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 9d3352a1fc..ac522313f1 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -5,6 +5,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -26,7 +27,8 @@ const EffectProps NullEffectProps{genDefaultProps()}; void NullEffectHandler::SetParami(ALCcontext *context, std::monostate& /*props*/, ALenum param, int /*val*/) { - context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property {:#04x}", + as_unsigned(param)); } void NullEffectHandler::SetParamiv(ALCcontext *context, std::monostate &props, ALenum param, const int *vals) { @@ -34,7 +36,8 @@ void NullEffectHandler::SetParamiv(ALCcontext *context, std::monostate &props, A } void NullEffectHandler::SetParamf(ALCcontext *context, std::monostate& /*props*/, ALenum param, float /*val*/) { - context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property {:#04x}", + as_unsigned(param)); } void NullEffectHandler::SetParamfv(ALCcontext *context, std::monostate &props, ALenum param, const float *vals) { @@ -43,7 +46,8 @@ void NullEffectHandler::SetParamfv(ALCcontext *context, std::monostate &props, A void NullEffectHandler::GetParami(ALCcontext *context, const std::monostate& /*props*/, ALenum param, int* /*val*/) { - context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property {:#04x}", + as_unsigned(param)); } void NullEffectHandler::GetParamiv(ALCcontext *context, const std::monostate &props, ALenum param, int *vals) { @@ -51,7 +55,8 @@ void NullEffectHandler::GetParamiv(ALCcontext *context, const std::monostate &pr } void NullEffectHandler::GetParamf(ALCcontext *context, const std::monostate& /*props*/, ALenum param, float* /*val*/) { - context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property {:#04x}", + as_unsigned(param)); } void NullEffectHandler::GetParamfv(ALCcontext *context, const std::monostate &props, ALenum param, float *vals) { diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 788f530936..c07ef27532 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -5,6 +5,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -45,14 +46,14 @@ void PshifterEffectHandler::SetParami(ALCcontext *context, PshifterProps &props, return; } - context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property {:#04x}", + as_unsigned(param)); } void PshifterEffectHandler::SetParamiv(ALCcontext *context, PshifterProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } void PshifterEffectHandler::SetParamf(ALCcontext *context, PshifterProps&, ALenum param, float) -{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property {:#04x}", as_unsigned(param)); } void PshifterEffectHandler::SetParamfv(ALCcontext *context, PshifterProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -64,14 +65,14 @@ void PshifterEffectHandler::GetParami(ALCcontext *context, const PshifterProps & case AL_PITCH_SHIFTER_FINE_TUNE: *val = props.FineTune; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property {:#04x}", + as_unsigned(param)); } void PshifterEffectHandler::GetParamiv(ALCcontext *context, const PshifterProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } void PshifterEffectHandler::GetParamf(ALCcontext *context, const PshifterProps&, ALenum param, float*) -{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property 0x{:04x}", param); } +{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property {:#04x}", as_unsigned(param)); } void PshifterEffectHandler::GetParamfv(ALCcontext *context, const PshifterProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp index 6ea42d537a..c51858f292 100644 --- a/al/effects/reverb.cpp +++ b/al/effects/reverb.cpp @@ -102,7 +102,8 @@ void ReverbEffectHandler::SetParami(ALCcontext *context, ReverbProps &props, ALe props.DecayHFLimit = val != AL_FALSE; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}", + as_unsigned(param)); } void ReverbEffectHandler::SetParamiv(ALCcontext *context, ReverbProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -230,7 +231,8 @@ void ReverbEffectHandler::SetParamf(ALCcontext *context, ReverbProps &props, ALe props.RoomRolloffFactor = val; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}", + as_unsigned(param)); } void ReverbEffectHandler::SetParamfv(ALCcontext *context, ReverbProps &props, ALenum param, const float *vals) { @@ -260,7 +262,8 @@ void ReverbEffectHandler::GetParami(ALCcontext *context, const ReverbProps &prop { case AL_EAXREVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}", + as_unsigned(param)); } void ReverbEffectHandler::GetParamiv(ALCcontext *context, const ReverbProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -290,7 +293,8 @@ void ReverbEffectHandler::GetParamf(ALCcontext *context, const ReverbProps &prop case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}", + as_unsigned(param)); } void ReverbEffectHandler::GetParamfv(ALCcontext *context, const ReverbProps &props, ALenum param, float *vals) { @@ -324,7 +328,8 @@ void StdReverbEffectHandler::SetParami(ALCcontext *context, ReverbProps &props, return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}", + as_unsigned(param)); } void StdReverbEffectHandler::SetParamiv(ALCcontext *context, ReverbProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -405,7 +410,8 @@ void StdReverbEffectHandler::SetParamf(ALCcontext *context, ReverbProps &props, return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}", + as_unsigned(param)); } void StdReverbEffectHandler::SetParamfv(ALCcontext *context, ReverbProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -416,7 +422,8 @@ void StdReverbEffectHandler::GetParami(ALCcontext *context, const ReverbProps &p { case AL_REVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}", + as_unsigned(param)); } void StdReverbEffectHandler::GetParamiv(ALCcontext *context, const ReverbProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -438,7 +445,8 @@ void StdReverbEffectHandler::GetParamf(ALCcontext *context, const ReverbProps &p case AL_REVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}", + as_unsigned(param)); } void StdReverbEffectHandler::GetParamfv(ALCcontext *context, const ReverbProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp index d40a26b2b1..982bc7e4a6 100644 --- a/al/effects/vmorpher.cpp +++ b/al/effects/vmorpher.cpp @@ -8,6 +8,7 @@ #include "AL/efx.h" #include "alc/context.h" +#include "alnumeric.h" #include "effects.h" #if ALSOFT_EAX @@ -147,7 +148,7 @@ void VmorpherEffectHandler::SetParami(ALCcontext *context, VmorpherProps &props, props.PhonemeA = *phenomeopt; else context->throw_error(AL_INVALID_VALUE, - "Vocal morpher phoneme-a out of range: 0x{:04x}", val); + "Vocal morpher phoneme-a out of range: {:#04x}", as_unsigned(val)); return; case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING: @@ -162,7 +163,7 @@ void VmorpherEffectHandler::SetParami(ALCcontext *context, VmorpherProps &props, props.PhonemeB = *phenomeopt; else context->throw_error(AL_INVALID_VALUE, - "Vocal morpher phoneme-b out of range: 0x{:04x}", val); + "Vocal morpher phoneme-b out of range: {:#04x}", as_unsigned(val)); return; case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING: @@ -176,13 +177,13 @@ void VmorpherEffectHandler::SetParami(ALCcontext *context, VmorpherProps &props, if(auto formopt = WaveformFromEmum(val)) props.Waveform = *formopt; else - context->throw_error(AL_INVALID_VALUE, "Vocal morpher waveform out of range: 0x{:04x}", - val); + context->throw_error(AL_INVALID_VALUE, "Vocal morpher waveform out of range: {:#04x}", + as_unsigned(val)); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property {:#04x}", + as_unsigned(param)); } void VmorpherEffectHandler::SetParamiv(ALCcontext *context, VmorpherProps &props, ALenum param, const int *vals) { SetParami(context, props, param, *vals); } @@ -197,7 +198,8 @@ void VmorpherEffectHandler::SetParamf(ALCcontext *context, VmorpherProps &props, return; } - context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property {:#04x}", + as_unsigned(param)); } void VmorpherEffectHandler::SetParamfv(ALCcontext *context, VmorpherProps &props, ALenum param, const float *vals) { SetParamf(context, props, param, *vals); } @@ -213,8 +215,8 @@ void VmorpherEffectHandler::GetParami(ALCcontext *context, const VmorpherProps & case AL_VOCAL_MORPHER_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return; } - context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property 0x{:04x}", - param); + context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property {:#04x}", + as_unsigned(param)); } void VmorpherEffectHandler::GetParamiv(ALCcontext *context, const VmorpherProps &props, ALenum param, int *vals) { GetParami(context, props, param, vals); } @@ -225,7 +227,8 @@ void VmorpherEffectHandler::GetParamf(ALCcontext *context, const VmorpherProps & case AL_VOCAL_MORPHER_RATE: *val = props.Rate; return; } - context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property 0x{:04x}", param); + context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property {:#04x}", + as_unsigned(param)); } void VmorpherEffectHandler::GetParamfv(ALCcontext *context, const VmorpherProps &props, ALenum param, float *vals) { GetParamf(context, props, param, vals); } diff --git a/al/error.cpp b/al/error.cpp index b4848eb592..12e262c197 100644 --- a/al/error.cpp +++ b/al/error.cpp @@ -49,8 +49,8 @@ void ALCcontext::setErrorImpl(ALenum errorCode, const std::string &msg) { - WARN("Error generated on context {}, code 0x{:04x}, \"{}\"", - decltype(std::declval()){this}, errorCode, msg); + WARN("Error generated on context {}, code {:#04x}, \"{}\"", + decltype(std::declval()){this}, as_unsigned(errorCode), msg); if(TrapALError) { #ifdef _WIN32 @@ -104,7 +104,7 @@ AL_API auto AL_APIENTRY alGetError() noexcept -> ALenum }; static const ALenum deferror{get_value("__ALSOFT_DEFAULT_ERROR", "default-error")}; - WARN("Querying error state on null context (implicitly 0x{:04x})", deferror); + WARN("Querying error state on null context (implicitly {:#04x})", as_unsigned(deferror)); if(TrapALError) { #ifdef _WIN32 diff --git a/al/event.cpp b/al/event.cpp index 5eb3be3b8f..07266975c7 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -194,7 +194,8 @@ try { { auto etype = GetEventType(evttype); if(!etype) - context->throw_error(AL_INVALID_ENUM, "Invalid event type 0x{:04x}", evttype); + context->throw_error(AL_INVALID_ENUM, "Invalid event type {:#04x}", + as_unsigned(evttype)); flags.set(al::to_underlying(*etype)); } diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 5e93fbc59d..629a64d290 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -477,7 +477,8 @@ void JackPlayback::open(std::string_view name) mClient = jack_client_open(client_name, ClientOptions, &status, nullptr); if(mClient == nullptr) throw al::backend_exception{al::backend_error::DeviceError, - "Failed to open client connection: 0x{:02x}", al::to_underlying(status)}; + "Failed to open client connection: {:#02x}", + as_unsigned(al::to_underlying(status))}; if((status&JackServerStarted)) TRACE("JACK server started"); if((status&JackNameNotUnique)) @@ -696,7 +697,7 @@ bool JackBackendFactory::init() jack_set_error_function(old_error_cb); if(!client) { - WARN("jack_client_open() failed, 0x{:02x}", al::to_underlying(status)); + WARN("jack_client_open() failed, {:#02x}", as_unsigned(al::to_underlying(status))); if((status&JackServerFailed) && !(ClientOptions&JackNoStartServer)) ERR("Unable to connect to JACK server"); return false; @@ -727,7 +728,7 @@ auto JackBackendFactory::enumerate(BackendType type) -> std::vector jack_client_close(client); } else - WARN("jack_client_open() failed, 0x{:02x}", al::to_underlying(status)); + WARN("jack_client_open() failed, {:#02x}", as_unsigned(al::to_underlying(status))); outnames.reserve(PlaybackList.size()); std::for_each(PlaybackList.cbegin(), PlaybackList.cend(), append_name); break; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 2116b43f79..ba0cb66b07 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -43,6 +43,7 @@ #include #include "alc/alconfig.h" +#include "alnumeric.h" #include "alspan.h" #include "base.h" #include "core/devformat.h" @@ -1061,7 +1062,7 @@ ClockLatency PulsePlayback::getClockLatency() * server yet. Give a generic value since nothing better is available. */ if(err != -PA_ERR_NODATA) - ERR("Failed to get stream latency: 0x{:x}", err); + ERR("Failed to get stream latency: {:#x}", as_unsigned(err)); latency = mDevice->BufferSize - mDevice->UpdateSize; neg = 0; } @@ -1377,7 +1378,7 @@ ClockLatency PulseCapture::getClockLatency() if(err != 0) UNLIKELY { - ERR("Failed to get stream latency: 0x{:x}", err); + ERR("Failed to get stream latency: {:#x}", as_unsigned(err)); latency = 0; neg = 0; } diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index 11e2204a83..ccae3e8f7a 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -127,7 +127,7 @@ void Sdl2Backend::open(std::string_view name) case AUDIO_F32SYS: devtype = DevFmtFloat; break; default: throw al::backend_exception{al::backend_error::DeviceError, - "Unhandled SDL format: 0x{:04x}", have.format}; + "Unhandled SDL format: {:#04x}", have.format}; } mFrameSize = BytesFromDevFmt(devtype) * have.channels; @@ -205,7 +205,7 @@ bool Sdl2Backend::reset() case AUDIO_F32SYS: mDevice->FmtType = DevFmtFloat; break; default: throw al::backend_exception{al::backend_error::DeviceError, - "Unhandled SDL format: 0x{:04x}", have.format}; + "Unhandled SDL format: {:#04x}", have.format}; } mFrameSize = BytesFromDevFmt(mDevice->FmtType) * have.channels; diff --git a/alc/backends/sdl3.cpp b/alc/backends/sdl3.cpp index 3f5d80be44..f9297a0825 100644 --- a/alc/backends/sdl3.cpp +++ b/alc/backends/sdl3.cpp @@ -317,7 +317,7 @@ auto Sdl3Backend::reset() -> bool case SDL_AUDIO_F32: mDevice->FmtType = DevFmtFloat; break; default: throw al::backend_exception{al::backend_error::DeviceError, - "Unhandled SDL format: 0x{:04x}", al::to_underlying(have.format)}; + "Unhandled SDL format: {:#04x}", al::to_underlying(have.format)}; } mFrameSize = mDevice->bytesFromFmt() * mNumChannels; diff --git a/alc/backends/sndio.cpp b/alc/backends/sndio.cpp index f334cbe913..ffbdd26e20 100644 --- a/alc/backends/sndio.cpp +++ b/alc/backends/sndio.cpp @@ -99,7 +99,7 @@ int SndioPlayback::mixerProc() size_t wrote{sio_write(mSndHandle, buffer.data(), buffer.size())}; if(wrote > buffer.size() || wrote == 0) { - ERR("sio_write failed: 0x{:x}", wrote); + ERR("sio_write failed: {:#x}", wrote); mDevice->handleDisconnect("Failed to write playback samples"); break; } @@ -357,8 +357,8 @@ int SndioCapture::recordProc() break; if(got > buffer.size()) { - ERR("sio_read failed: 0x{:x}", got); - mDevice->handleDisconnect("sio_read failed: 0x{:x}", got); + ERR("sio_read failed: {:#x}", got); + mDevice->handleDisconnect("sio_read failed: {:#x}", got); break; } diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp index fa165a2d14..19cc7649d5 100644 --- a/alc/backends/solaris.cpp +++ b/alc/backends/solaris.cpp @@ -216,7 +216,7 @@ bool SolarisBackend::reset() mDevice->FmtType = DevFmtInt; else { - ERR("Got unhandled sample type: {} (0x{:x})", info.play.precision, info.play.encoding); + ERR("Got unhandled sample type: {} ({:#x})", info.play.precision, info.play.encoding); return false; } diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index cdeea51b33..3647f670ec 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -38,6 +38,7 @@ #include #include +#include "alnumeric.h" #include "alsem.h" #include "althrd_setname.h" #include "core/device.h" @@ -287,7 +288,7 @@ bool WinMMPlayback::reset() } else { - ERR("Unhandled format tag: 0x{:04x}", mFormat.wFormatTag); + ERR("Unhandled format tag: {:#04x}", as_unsigned(mFormat.wFormatTag)); return false; } diff --git a/alc/events.cpp b/alc/events.cpp index 4b0f9d41dd..dfabcf897f 100644 --- a/alc/events.cpp +++ b/alc/events.cpp @@ -3,6 +3,7 @@ #include "events.h" +#include "alnumeric.h" #include "alspan.h" #include "core/logging.h" #include "device.h" @@ -75,7 +76,7 @@ FORCE_ALIGN ALCboolean ALC_APIENTRY alcEventControlSOFT(ALCsizei count, const AL auto etype = alc::GetEventType(type); if(!etype) { - WARN("Invalid event type: 0x{:04x}", type); + WARN("Invalid event type: {:#04x}", as_unsigned(type)); alcSetError(nullptr, ALC_INVALID_ENUM); return ALC_FALSE; } diff --git a/alc/panning.cpp b/alc/panning.cpp index 76ecfde38a..00c8e955bb 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -1083,7 +1083,7 @@ void aluInitRenderer(al::Device *device, int hrtf_id, std::optional Ambi3OrderMask) { - ERR("Unsupported decoder channel mask 0x{:x} (max 0x{:x})", conf.ChanMask, + ERR("Unsupported decoder channel mask {:#x} (max {:#x})", conf.ChanMask, Ambi3OrderMask); return false; } diff --git a/core/ambdec.cpp b/core/ambdec.cpp index 5f3d63dd5a..9bc2e4240b 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -172,7 +172,7 @@ std::optional AmbDecConf::load(const char *fname) noexcept istr >> std::hex >> ChanMask >> std::dec; if(!ChanMask || ChanMask > Ambi4OrderMask) - return make_error(linenum, "Invalid chan_mask: 0x{:x}", ChanMask); + return make_error(linenum, "Invalid chan_mask: {:#x}", ChanMask); if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa) return make_error(linenum, "FuMa not compatible with over third-order"); } diff --git a/examples/aldebug.cpp b/examples/aldebug.cpp index a3f52e540a..2ab283ad9b 100644 --- a/examples/aldebug.cpp +++ b/examples/aldebug.cpp @@ -37,6 +37,7 @@ #include "AL/alc.h" #include "AL/alext.h" +#include "alnumeric.h" #include "alspan.h" #include "fmt/core.h" @@ -181,7 +182,7 @@ int main(al::span args) alDebugMessageControlEXT(AL_DONT_CARE_EXT, AL_DONT_CARE_EXT, AL_DEBUG_SEVERITY_LOW_EXT, 0, nullptr, AL_TRUE); - fmt::println("Context flags: 0x{:08x}", alGetInteger(AL_CONTEXT_FLAGS_EXT)); + fmt::println("Context flags: {:#08x}", as_unsigned(alGetInteger(AL_CONTEXT_FLAGS_EXT))); /* A debug context has debug output enabled by default. But in case this * isn't a debug context, explicitly enable it (probably won't get much, if diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp index 6449d84926..4430b2ed2d 100644 --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -871,7 +871,7 @@ void AL_APIENTRY AudioState::eventCallback(ALenum eventType, ALuint object, ALui case AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT: fmt::print("Buffer completed"); break; case AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT: fmt::print("Source state changed"); break; case AL_EVENT_TYPE_DISCONNECTED_SOFT: fmt::print("Disconnected"); break; - default: fmt::print("0x{:04x}", eventType); break; + default: fmt::print("{:#04x}", as_unsigned(eventType)); break; } fmt::println("\n" "Object ID: {}\n" @@ -1399,7 +1399,7 @@ int AudioState::handler() break; } if(ALenum err{alGetError()}) - fmt::println(stderr, "Got AL error: 0x{:04x} ({})", err, alGetString(err)); + fmt::println(stderr, "Got AL error: {:#04x} ({})", as_unsigned(err), alGetString(err)); mSrcCond.wait_for(srclock, sleep_time); } @@ -1751,8 +1751,8 @@ bool MovieState::streamComponentOpen(AVStream *stream) const AVCodec *codec{avcodec_find_decoder(avctx->codec_id)}; if(!codec || avcodec_open2(avctx.get(), codec, nullptr) < 0) { - fmt::println(stderr, "Unsupported codec: {} (0x{:x})", avcodec_get_name(avctx->codec_id), - int{avctx->codec_id}); + fmt::println(stderr, "Unsupported codec: {} ({:#x})", avcodec_get_name(avctx->codec_id), + al::to_underlying(avctx->codec_id)); return false; } diff --git a/examples/alstreamcb.cpp b/examples/alstreamcb.cpp index e1241ed07e..37c82f436d 100644 --- a/examples/alstreamcb.cpp +++ b/examples/alstreamcb.cpp @@ -46,6 +46,7 @@ #include "AL/alc.h" #include "AL/alext.h" +#include "alnumeric.h" #include "alspan.h" #include "common/alhelpers.h" #include "fmt/core.h" @@ -342,7 +343,8 @@ struct StreamPlayer { alSourcei(mSource, AL_BUFFER, static_cast(mBuffer)); if(ALenum err{alGetError()}) { - fmt::println(stderr, "Failed to set callback: {} (0x{:04x})", alGetString(err), err); + fmt::println(stderr, "Failed to set callback: {} ({:#04x})", alGetString(err), + as_unsigned(err)); return false; } return true;