Пример #1
0
static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect)
{
    if(ALEffectSlot->effect.type != (effect?effect->type:AL_EFFECT_NULL))
    {
        ALeffectState *NewState = NULL;
        if(!effect || effect->type == AL_EFFECT_NULL)
            NewState = NoneCreate();
        else if(effect->type == AL_EFFECT_EAXREVERB)
            NewState = EAXVerbCreate();
        else if(effect->type == AL_EFFECT_REVERB)
            NewState = VerbCreate();
        else if(effect->type == AL_EFFECT_ECHO)
            NewState = EchoCreate();
        /* No new state? An error occured.. */
        if(NewState == NULL ||
           ALEffect_DeviceUpdate(NewState, Context->Device) == AL_FALSE)
        {
            if(NewState)
                ALEffect_Destroy(NewState);
            return;
        }
        if(ALEffectSlot->EffectState)
            ALEffect_Destroy(ALEffectSlot->EffectState);
        ALEffectSlot->EffectState = NewState;
    }
    if(!effect)
    {
        memset(&ALEffectSlot->effect, 0, sizeof(ALEffectSlot->effect));
        return;
    }
    memcpy(&ALEffectSlot->effect, effect, sizeof(*effect));
    ALEffect_Update(ALEffectSlot->EffectState, Context, effect);
}
ALeffectState* EAXVerbCreate( void )
{
	ALeffectState* State = VerbCreate();

	if ( State )
	{
		State->DeviceUpdate = EAXVerbDeviceUpdate;
		State->Update = EAXVerbUpdate;
		State->Process = EAXVerbProcess;
	}

	return State;
}