Skip to content

Commit

Permalink
Fix printing some more hex values
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Dec 9, 2024
1 parent 47712b3 commit 000c302
Show file tree
Hide file tree
Showing 32 changed files with 225 additions and 154 deletions.
30 changes: 17 additions & 13 deletions al/auxeffectslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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&) {
}
Expand Down Expand Up @@ -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&) {
}
Expand Down Expand Up @@ -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&) {
}
Expand All @@ -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&) {
}
Expand Down Expand Up @@ -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&) {
}
Expand Down Expand Up @@ -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&) {
}
Expand All @@ -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&) {
}
Expand All @@ -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&) {
}
Expand Down
29 changes: 18 additions & 11 deletions al/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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<std::mutex> debuglock{context->mDebugCbLock};
if(context->mDebugGroups.size() >= MaxDebugGroupDepth)
Expand Down Expand Up @@ -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&) {
}
Expand Down Expand Up @@ -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&) {
}
Expand Down
4 changes: 2 additions & 2 deletions al/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions al/effects/autowah.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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); }
Expand Down
31 changes: 21 additions & 10 deletions al/effects/chorus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "AL/efx.h"

#include "alc/context.h"
#include "alnumeric.h"
#include "effects.h"

#if ALSOFT_EAX
Expand Down Expand Up @@ -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:
Expand All @@ -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); }
Expand Down Expand Up @@ -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); }
Expand All @@ -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); }
Expand All @@ -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); }
Expand All @@ -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:
Expand All @@ -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); }
Expand Down Expand Up @@ -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); }
Expand All @@ -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); }
Expand All @@ -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); }
Expand Down
15 changes: 9 additions & 6 deletions al/effects/compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "AL/efx.h"

#include "alc/context.h"
#include "alnumeric.h"
#include "effects.h"

#if ALSOFT_EAX
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
Expand Down
Loading

0 comments on commit 000c302

Please sign in to comment.