[openal] Where can I find the enum parameters that these functions accept: GetEffectf/fv-GetEffecti/iv GetFilteri/iv-GetFilterif/fv, GetAuxiliary...

Chris Robinson chris.kcat at gmail.com
Thu Jul 29 04:14:25 EDT 2021


On Thu, 29 Jul 2021 09:08:21 +0300
Sean <s.tolstoyevski at gmail.com> wrote:

> Hello there,
> 
> I've been reviewing the OpenAL-Soft source for a long time.
> 
> I couldn't find any parameters that these functions can accept.

This is detailed in the Effects Extension Guide PDF. It's part of the
Core SDK download on openal.org, or if you don't have Windows to
install it, it can be downloaded separately from here:

https://openal-soft.org/misc-downloads/Effects%20Extension%20Guide.pdf

> Looking at the overall code structure of OpenAL-Soft, *param* is 
> evaluated in the switch statement.
> Like alGetSourcef.
> 
> By examining these codes, I can tell if I'm doing the right things.
> 
> But I couldn't find anything in the source code for effects, filters
> and AuxiliarySends.
> Where exactly are these defined in OpenAL-Soft?

By default, the only parameter an effect can set is AL_EFFECT_TYPE, of
which the available values are AL_EFFECT_NULL, AL_EFFECT_EAXREVERB,
AL_EFFECT_REVERB, AL_EFFECT_CHORUS, and others. Which effects are
available is implementation-dependent, so for example some may not allow
you to set a Chorus effect if it's not implemented. OpenAL Soft
supports all of those standard effect types.

Once an effect type is set, then the alEffect* functions can accept
other parameters relating to that effect. So if you call

alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);

and it succeeds, you can then call

alEffectf(effect, AL_EAXREVERB_DENSITY, density);
alEffectf(effect, AL_EAXREVERB_DIFFUSION, diffusion);
...etc...

to set the reverb effect parameters. When you change the effect type,
for example by calling

alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_CHORUS);

the reverb parameters are cleared and you can now set the chorus effect
parameters:

alEffecti(effect, AL_CHORUS_WAVEFORM, waveform);
...etc...

The EFX-standard effect types, and their parameters, are described in
the above-linked guide. OpenAL Soft comes with an efx-presets.h header,
which defines a number of reverb presets that can be assigned to
effects.


Filters are similar. By default, only the AL_FILTER_TYPE property can
be set, of which there's AL_FILTER_NULL, AL_FILTER_LOWPASS,
AL_FILTER_HIGHPASS, and AL_FILTER_BANDPASS types. Set one of the filter
types, then you can set that type's properties. The guide explains what
properties are available for the different types.


AuxiliaryEffectSlots are more typical objects, which have a set
predefined number of properties that can be set. An effect can be set
on one, and sources can be connected to one to have the given effect
apply to the given sources.

> In particular, I cannot understand how vector functions work.

The vector functions are how properties that need multiple values can
be given them. All single-value properties (e.g. AL_EFFECT_TYPE) can be
set through the single-value or array/vector functions. For example,

alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
// and
ALint type[1] = { AL_EFFECT_EAXREVERB };
alEffectiv(effect, AL_EFFECT_TYPE, type);

have the same result. However, some properties require multiple values
and can only be used with the array/vector functions, like
AL_EAXREVERB_REFLECTIONS_PAN which needs three values to specify a
direction and magnitude:

ALfloat pan[3] = { x, y, z };
alEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, pan);


More information about the openal mailing list