Audio‎ > ‎Audio API‎ > ‎OpenAL‎ > ‎

Listener

Can you hear me now?

The listener the ears of the world and you put it at the place where you wish to hear things from. If there is sources close by the position of them with respect to our listener will decide on what speakers to play sounds and how loud. To set the values of the listener the alListenerfv function is used. The first parameter is the value to change and the rest is a pointer to the new values.

AL_POSITION: This set the position of the listener . Three float values.
AL_ORIENTATION: This set the way the listener is looking. Six float values. The first three is the direction it is looking and the next three is the up direction.
AL_VELOCITY: The speed and direction the listener is moving as a vector with three values. This is used for the doppler effect only and it does not affect position in any way.
AL_GAIN: Scalar amplitude multiplier. Default value 1.0f.

Multiple listeners
If one need more then one listener, in a split screen game for example there is two ways to make it work.

Multiple Context

There can be only a single listener in a context but one create one for each player. They can share buffers.

Single Context
Using a single context put the listener at <0,0,0>. Then play sources relative to the listener. Each sound in the game might need one source per player.

Comments