diff options
author | Chris Robinson <[email protected]> | 2020-03-28 15:37:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-28 18:15:05 -0700 |
commit | f1f9a1417206e6097005c6088b65d56cb4e15429 (patch) | |
tree | 5ca1ad3fc79bfb1789ff0d0d9a28a2cebca845ef | |
parent | 504745abec35c4718833cd7c7ed8db3b242e0aa2 (diff) |
Avoid AL[C]boolean for internal use
-rw-r--r-- | al/auxeffectslot.cpp | 4 | ||||
-rw-r--r-- | al/auxeffectslot.h | 14 | ||||
-rw-r--r-- | al/effect.cpp | 6 | ||||
-rw-r--r-- | al/effect.h | 4 | ||||
-rw-r--r-- | al/listener.h | 2 | ||||
-rw-r--r-- | al/state.cpp | 6 | ||||
-rw-r--r-- | alc/alc.cpp | 13 | ||||
-rw-r--r-- | alc/alcmain.h | 2 | ||||
-rw-r--r-- | alc/alcontext.h | 4 | ||||
-rw-r--r-- | alc/alu.cpp | 2 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 10 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 4 | ||||
-rw-r--r-- | alc/effects/compressor.cpp | 2 | ||||
-rw-r--r-- | alc/panning.cpp | 2 |
14 files changed, 37 insertions, 38 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 6a7bbb46..ac9bcd71 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -394,7 +394,7 @@ START_API_FUNC if(!(value == AL_TRUE || value == AL_FALSE)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Effect slot auxiliary send auto out of range"); - slot->AuxSendAuto = static_cast<ALboolean>(value); + slot->AuxSendAuto = !!value; break; case AL_EFFECTSLOT_TARGET_SOFT: @@ -535,7 +535,7 @@ START_API_FUNC switch(param) { case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: - *value = slot->AuxSendAuto; + *value = slot->AuxSendAuto ? AL_TRUE : AL_FALSE; break; case AL_EFFECTSLOT_TARGET_SOFT: diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index 327cb357..ae41a32a 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -22,8 +22,8 @@ using ALeffectslotArray = al::FlexArray<ALeffectslot*>; struct ALeffectslotProps { - ALfloat Gain; - ALboolean AuxSendAuto; + float Gain; + bool AuxSendAuto; ALeffectslot *Target; ALenum Type; @@ -38,8 +38,8 @@ struct ALeffectslotProps { struct ALeffectslot { - ALfloat Gain{1.0f}; - ALboolean AuxSendAuto{AL_TRUE}; + float Gain{1.0f}; + bool AuxSendAuto{true}; ALeffectslot *Target{nullptr}; struct { @@ -56,8 +56,8 @@ struct ALeffectslot { struct { std::atomic<ALeffectslotProps*> Update{nullptr}; - ALfloat Gain{1.0f}; - ALboolean AuxSendAuto{AL_TRUE}; + float Gain{1.0f}; + bool AuxSendAuto{true}; ALeffectslot *Target{nullptr}; ALenum EffectType{AL_EFFECT_NULL}; @@ -68,7 +68,7 @@ struct ALeffectslot { ALfloat DecayTime{0.0f}; ALfloat DecayLFRatio{0.0f}; ALfloat DecayHFRatio{0.0f}; - ALboolean DecayHFLimit{AL_FALSE}; + bool DecayHFLimit{false}; ALfloat AirAbsorptionGainHF{1.0f}; } Params; diff --git a/al/effect.cpp b/al/effect.cpp index f7d17f50..6ea1be39 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -68,7 +68,7 @@ const EffectList gEffectList[15]{ { "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_DIALOGUE }, }; -ALboolean DisabledEffects[MAX_EFFECTS]; +bool DisabledEffects[MAX_EFFECTS]; namespace { @@ -316,14 +316,14 @@ START_API_FUNC { if(param == AL_EFFECT_TYPE) { - ALboolean isOk{value == AL_EFFECT_NULL}; + bool isOk{value == AL_EFFECT_NULL}; if(!isOk) { for(const EffectList &effectitem : gEffectList) { if(value == effectitem.val && !DisabledEffects[effectitem.type]) { - isOk = AL_TRUE; + isOk = true; break; } } diff --git a/al/effect.h b/al/effect.h index 25225396..74858dc7 100644 --- a/al/effect.h +++ b/al/effect.h @@ -25,7 +25,7 @@ enum { MAX_EFFECTS }; -extern ALboolean DisabledEffects[MAX_EFFECTS]; +extern bool DisabledEffects[MAX_EFFECTS]; extern ALfloat ReverbBoost; @@ -51,7 +51,7 @@ struct ALeffect { DISABLE_ALLOC() }; -inline ALboolean IsReverbEffect(ALenum type) +inline bool IsReverbEffect(const ALenum type) noexcept { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } EffectStateFactory *getFactoryByType(ALenum type); diff --git a/al/listener.h b/al/listener.h index 69276f1a..c96b35bf 100644 --- a/al/listener.h +++ b/al/listener.h @@ -52,7 +52,7 @@ struct ALlistener { ALfloat DopplerFactor; ALfloat SpeedOfSound; /* in units per sec! */ - ALboolean SourceDistanceModel; + bool SourceDistanceModel; DistanceModel mDistanceModel; } Params; diff --git a/al/state.cpp b/al/state.cpp index 25a0efd1..ad67559c 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -126,7 +126,7 @@ START_API_FUNC switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - context->mSourceDistanceModel = AL_TRUE; + context->mSourceDistanceModel = true; DO_UPDATEPROPS(); break; @@ -146,7 +146,7 @@ START_API_FUNC switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - context->mSourceDistanceModel = AL_FALSE; + context->mSourceDistanceModel = false; DO_UPDATEPROPS(); break; @@ -167,7 +167,7 @@ START_API_FUNC switch(capability) { case AL_SOURCE_DISTANCE_MODEL: - value = context->mSourceDistanceModel; + value = context->mSourceDistanceModel ? AL_TRUE : AL_FALSE; break; default: diff --git a/alc/alc.cpp b/alc/alc.cpp index d1964bd4..fc4af2b0 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1201,7 +1201,7 @@ void alc_initconfig(void) { if(len == strlen(effectitem.name) && strncmp(effectitem.name, str, len) == 0) - DisabledEffects[effectitem.type] = AL_TRUE; + DisabledEffects[effectitem.type] = true; } } while(next++); } @@ -1749,7 +1749,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ALCuint new_sends{device->NumAuxSends}; DevFmtChannels oldChans; DevFmtType oldType; - ALboolean update_failed; ALCsizei hrtf_id{-1}; ALCuint oldFreq; @@ -2210,19 +2209,19 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) /* Need to delay returning failure until replacement Send arrays have been * allocated with the appropriate size. */ - update_failed = AL_FALSE; + bool update_failed{false}; FPUCtl mixer_mode{}; for(ALCcontext *context : *device->mContexts.load()) { if(context->mDefaultSlot) { - ALeffectslot *slot = context->mDefaultSlot.get(); + ALeffectslot *slot{context->mDefaultSlot.get()}; aluInitEffectPanning(slot, device); EffectState *state{slot->Effect.State}; state->mOutTarget = device->Dry.Buffer; - if(state->deviceUpdate(device) == AL_FALSE) - update_failed = AL_TRUE; + if(!state->deviceUpdate(device)) + update_failed = true; else UpdateEffectSlotProps(slot, context); } @@ -2246,7 +2245,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) EffectState *state{slot->Effect.State}; state->mOutTarget = device->Dry.Buffer; if(state->deviceUpdate(device) == AL_FALSE) - update_failed = AL_TRUE; + update_failed = true; else UpdateEffectSlotProps(slot, context); } diff --git a/alc/alcmain.h b/alc/alcmain.h index 9293596d..b1f1d45e 100644 --- a/alc/alcmain.h +++ b/alc/alcmain.h @@ -225,7 +225,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> { DevFmtChannels FmtChans{}; DevFmtType FmtType{}; - ALboolean IsHeadphones{AL_FALSE}; + bool IsHeadphones{false}; ALuint mAmbiOrder{0}; /* For DevFmtAmbi* output only, specifies the channel order and * normalization. diff --git a/alc/alcontext.h b/alc/alcontext.h index aea2ea31..2ec3cf25 100644 --- a/alc/alcontext.h +++ b/alc/alcontext.h @@ -47,7 +47,7 @@ struct ALcontextProps { ALfloat DopplerFactor; ALfloat DopplerVelocity; ALfloat SpeedOfSound; - ALboolean SourceDistanceModel; + bool SourceDistanceModel; DistanceModel mDistanceModel; std::atomic<ALcontextProps*> next; @@ -111,7 +111,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext> { std::atomic<ALenum> mLastError{AL_NO_ERROR}; DistanceModel mDistanceModel{DistanceModel::Default}; - ALboolean mSourceDistanceModel{AL_FALSE}; + bool mSourceDistanceModel{false}; ALfloat mDopplerFactor{1.0f}; ALfloat mDopplerVelocity{1.0f}; diff --git a/alc/alu.cpp b/alc/alu.cpp index f50815ae..787cece0 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -436,7 +436,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALeffectslot **sorted_slots, ALCco slot->Params.DecayTime = 0.0f; slot->Params.DecayLFRatio = 0.0f; slot->Params.DecayHFRatio = 0.0f; - slot->Params.DecayHFLimit = AL_FALSE; + slot->Params.DecayHFLimit = false; slot->Params.AirAbsorptionGainHF = 1.0f; } diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 97837460..7e91f28c 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -101,9 +101,9 @@ decltype(jack_error_callback) * pjack_error_callback; jack_options_t ClientOptions = JackNullOption; -ALCboolean jack_load() +bool jack_load() { - ALCboolean error = ALC_FALSE; + bool error{false}; #ifdef HAVE_DYNLOAD if(!jack_handle) @@ -119,14 +119,14 @@ ALCboolean jack_load() if(!jack_handle) { WARN("Failed to load %s\n", JACKLIB); - return ALC_FALSE; + return false; } - error = ALC_FALSE; + error = false; #define LOAD_FUNC(f) do { \ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(jack_handle, #f)); \ if(p##f == nullptr) { \ - error = ALC_TRUE; \ + error = true; \ missing_funcs += "\n" #f; \ } \ } while(0) diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 4d546f44..e02193a1 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -825,8 +825,8 @@ void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int if(info->active_port) TRACE("Active port: %s (%s)\n", info->active_port->name, info->active_port->description); - mDevice->IsHeadphones = (mDevice->FmtChans == DevFmtStereo && - info->active_port && strcmp(info->active_port->name, "analog-output-headphones") == 0); + mDevice->IsHeadphones = (mDevice->FmtChans == DevFmtStereo + && info->active_port && strcmp(info->active_port->name, "analog-output-headphones") == 0); } void PulsePlayback::sinkNameCallback(pa_context*, const pa_sink_info *info, int eol) noexcept diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index ad82037a..e5e0339f 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -43,7 +43,7 @@ struct CompressorState final : public EffectState { ALfloat mGain[MAX_AMBI_CHANNELS][MAX_OUTPUT_CHANNELS]{}; /* Effect parameters */ - ALboolean mEnabled{AL_TRUE}; + bool mEnabled{true}; ALfloat mAttackMult{1.0f}; ALfloat mReleaseMult{1.0f}; ALfloat mEnvFollower{1.0f}; diff --git a/alc/panning.cpp b/alc/panning.cpp index 0b7b5038..13fdac6d 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -746,7 +746,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr return; } - bool headphones{device->IsHeadphones != AL_FALSE}; + bool headphones{device->IsHeadphones}; if(device->Type != Loopback) { if(auto modeopt = ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-mode")) |