Avoid AL[C]boolean for internal use

This commit is contained in:
Chris Robinson
2020-03-28 15:37:34 -07:00
parent 504745abec
commit f1f9a14172
14 changed files with 37 additions and 38 deletions
+2 -2
View File
@@ -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:
+7 -7
View File
@@ -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;
+3 -3
View File
@@ -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;
}
}
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -52,7 +52,7 @@ struct ALlistener {
ALfloat DopplerFactor;
ALfloat SpeedOfSound; /* in units per sec! */
ALboolean SourceDistanceModel;
bool SourceDistanceModel;
DistanceModel mDistanceModel;
} Params;
+3 -3
View File
@@ -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:
+6 -7
View File
@@ -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);
}
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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};
+1 -1
View File
@@ -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;
}
+5 -5
View File
@@ -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)
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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};
+1 -1
View File
@@ -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"))