AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint value) { ALCdevice *device; ALCcontext *context; ALeffectslot *slot; ALeffect *effect = NULL; ALenum err; context = GetContextRef(); if(!context) return; WriteLock(&context->PropLock); LockEffectSlotsRead(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); switch(param) { case AL_EFFECTSLOT_EFFECT: device = context->Device; LockEffectsRead(device); effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) { UnlockEffectsRead(device); SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); } err = InitializeEffect(device, slot, effect); UnlockEffectsRead(device); if(err != AL_NO_ERROR) SET_ERROR_AND_GOTO(context, err, done); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); slot->AuxSendAuto = value; UpdateEffectSlotProps(slot); if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) UpdateAllSourceProps(context); break; default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } done: UnlockEffectSlotsRead(context); WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint value) { ALCdevice *device; ALCcontext *context; ALeffectslot *slot; ALeffect *effect = NULL; ALenum err; context = GetContextRef(); if(!context) return; almtx_lock(&context->PropLock); LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_EFFECT: device = context->Device; LockEffectList(device); effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) { UnlockEffectList(device); SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid effect ID %u", value); } err = InitializeEffect(context, slot, effect); UnlockEffectList(device); if(err != AL_NO_ERROR) SETERR_GOTO(context, err, done, "Effect initialization failed"); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Effect slot auxiliary send auto out of range"); slot->AuxSendAuto = value; break; default: SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot integer property 0x%04x", param); } DO_UPDATEPROPS(); done: UnlockEffectSlotList(context); almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) { ALCdevice *Device; ALCcontext *Context; ALeffectslot *EffectSlot; Context = GetContextRef(); if(!Context) return; Device = Context->Device; if((EffectSlot=LookupEffectSlot(Context, effectslot)) != NULL) { switch(param) { case AL_EFFECTSLOT_EFFECT: { ALeffect *effect = NULL; if(iValue == 0 || (effect=LookupEffect(Device, iValue)) != NULL) { ALenum err; err = InitializeEffect(Device, EffectSlot, effect); if(err != AL_NO_ERROR) alSetError(Context, err); else Context->UpdateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); } break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(iValue == AL_TRUE || iValue == AL_FALSE) { EffectSlot->AuxSendAuto = iValue; Context->UpdateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) { ALCcontext *Context; Context = alcGetCurrentContext(); if(!Context) { alSetError(AL_INVALID_OPERATION); return; } SuspendContext(Context); if (alIsAuxiliaryEffectSlot(effectslot)) { ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot); switch(param) { case AL_EFFECTSLOT_EFFECT: if(alIsEffect(iValue)) { ALeffect *effect = (ALeffect*)ALTHUNK_LOOKUPENTRY(iValue); InitializeEffect(Context, ALEffectSlot, effect); } else alSetError(AL_INVALID_VALUE); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(iValue == AL_TRUE || iValue == AL_FALSE) ALEffectSlot->AuxSendAuto = iValue; else alSetError(AL_INVALID_VALUE); break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint value) { ALCdevice *device; ALCcontext *context; ALeffectslot *slot; ALeffect *effect = NULL; ALenum err; context = GetContextRef(); if(!context) return; device = context->Device; if((slot=LookupEffectSlot(context, effectslot)) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); switch(param) { case AL_EFFECTSLOT_EFFECT: effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); err = InitializeEffect(device, slot, effect); if(err != AL_NO_ERROR) SET_ERROR_AND_GOTO(context, err, done); ATOMIC_STORE(&context->UpdateSources, AL_TRUE); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); slot->AuxSendAuto = value; ATOMIC_STORE(&context->UpdateSources, AL_TRUE); break; default: SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint value) { ALCcontext *Context; ALeffectslot *Slot; ALeffect *effect = NULL; ALenum err; Context = GetContextRef(); if(!Context) return; al_try { ALCdevice *device = Context->Device; if((Slot=LookupEffectSlot(Context, effectslot)) == NULL) al_throwerr(Context, AL_INVALID_NAME); switch(param) { case AL_EFFECTSLOT_EFFECT: CHECK_VALUE(Context, value == 0 || (effect=LookupEffect(device, value)) != NULL); err = InitializeEffect(device, Slot, effect); if(err != AL_NO_ERROR) al_throwerr(Context, err); Context->UpdateSources = AL_TRUE; break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: CHECK_VALUE(Context, value == AL_TRUE || value == AL_FALSE); Slot->AuxSendAuto = value; Context->UpdateSources = AL_TRUE; break; default: al_throwerr(Context, AL_INVALID_ENUM); } } al_endtry; ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) { ALCdevice *Device; ALCcontext *Context; ALboolean updateSources = AL_FALSE; ALeffectslot *EffectSlot; Context = GetContextSuspended(); if(!Context) return; Device = Context->Device; if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL) { switch(param) { case AL_EFFECTSLOT_EFFECT: { ALeffect *effect = NULL; if(iValue == 0 || (effect=LookupEffect(Device->EffectMap, iValue)) != NULL) { InitializeEffect(Context, EffectSlot, effect); updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); } break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(iValue == AL_TRUE || iValue == AL_FALSE) { EffectSlot->AuxSendAuto = iValue; updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); // Force updating the sources that use this slot, since it affects the // sending parameters if(updateSources) { ALsizei pos; for(pos = 0;pos < Context->SourceMap.size;pos++) { ALsource *source = Context->SourceMap.array[pos].value; ALuint i; for(i = 0;i < Device->NumAuxSends;i++) { if(!source->Send[i].Slot || source->Send[i].Slot->effectslot != effectslot) continue; source->NeedsUpdate = AL_TRUE; break; } } } ProcessContext(Context); }