diff options
author | Chris Robinson <[email protected]> | 2023-08-25 02:10:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-08-25 02:10:18 -0700 |
commit | 4b924e636b6e0651304b289a667d358d336d6d03 (patch) | |
tree | 0b55327958d5073175ccc1fbb07b26a93d69046e /al/auxeffectslot.cpp | |
parent | 84c1633f635ce870fe9556c267b1538ecbf1f0cd (diff) |
Allow querying AL_EFFECTSLOT_EFFECT
This doesn't make much sense since the effect associated with the ID may be
modified and not represent the effect being played, or was even deleted and
isn't a valid effect ID, but Generic Software allows querying it so it should
be queryable for compatibility if nothing else.
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r-- | al/auxeffectslot.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 09db0736..66a65b5c 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -548,12 +548,12 @@ FORCE_ALIGN void AL_APIENTRY alAuxiliaryEffectSlotiDirect(ALCcontext *context, A std::lock_guard<std::mutex> ___{device->EffectLock}; ALeffect *effect{value ? LookupEffect(device, static_cast<ALuint>(value)) : nullptr}; if(effect) - err = slot->initEffect(effect->type, effect->Props, context); + err = slot->initEffect(effect->id, effect->type, effect->Props, context); else { if(value != 0) return context->setError(AL_INVALID_VALUE, "Invalid effect ID %u", value); - err = slot->initEffect(AL_EFFECT_NULL, EffectProps{}, context); + err = slot->initEffect(0, AL_EFFECT_NULL, EffectProps{}, context); } } if(err != AL_NO_ERROR) UNLIKELY @@ -754,6 +754,10 @@ FORCE_ALIGN void AL_APIENTRY alGetAuxiliaryEffectSlotiDirect(ALCcontext *context switch(param) { + case AL_EFFECTSLOT_EFFECT: + *value = static_cast<ALint>(slot->EffectId); + break; + case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: *value = slot->AuxSendAuto ? AL_TRUE : AL_FALSE; break; @@ -887,7 +891,7 @@ ALeffectslot::~ALeffectslot() mSlot->InUse = false; } -ALenum ALeffectslot::initEffect(ALenum effectType, const EffectProps &effectProps, +ALenum ALeffectslot::initEffect(ALuint effectId, ALenum effectType, const EffectProps &effectProps, ALCcontext *context) { EffectSlotType newtype{EffectSlotTypeFromEnum(effectType)}; @@ -916,6 +920,7 @@ ALenum ALeffectslot::initEffect(ALenum effectType, const EffectProps &effectProp } else if(newtype != EffectSlotType::None) Effect.Props = effectProps; + EffectId = effectId; /* Remove state references from old effect slot property updates. */ EffectSlotProps *props{context->mFreeEffectslotProps.load()}; @@ -1445,7 +1450,8 @@ void ALeffectslot::eax_set_efx_slot_effect(EaxEffect &effect) { #define EAX_PREFIX "[EAX_SET_EFFECT_SLOT_EFFECT] " - const auto error = initEffect(effect.al_effect_type_, effect.al_effect_props_, eax_al_context_); + const auto error = initEffect(0, effect.al_effect_type_, effect.al_effect_props_, + eax_al_context_); if(error != AL_NO_ERROR) { ERR(EAX_PREFIX "%s\n", "Failed to initialize an effect."); |