OpenAL - how to play unoccupied sound effects?

I use OpenAL in my iPhone project to create sounds that are attenuated when they are further away from the listener.

However - I also want to reproduce some sound effects that will not be attenuated by distance.

So far, I have decided that using stereo sounds that are not attenuated. But now I am adding a lot of voice commands that take up a lot of space, so I want them to be mono, and now again the problem arises that they are weakened by a distance.

The next solution was to set "AL_MIN_GAIN" of the source reproducing voice samples to 1.0, but this seems to work only on the simulator and not on the device.

Are there other ways to play sound effects with openAL that shouldn't be weakened by distance?

+4
source share
3 answers
alSourcei (sourceName, AL_SOURCE_RELATIVE, AL_TRUE); alSource3f (sourceName, AL_POSITION, 0.0f, 0.0f, 0.0f); alSource3f (sourceName, AL_VELOCITY, 0.0f, 0.0f, 0.0f); 

And then the source must remain in the listening position.

+4
source

You can try to open a second context that does not have a distance model. I'm not sure if iOS supports multiple contexts or not, though ...

Alternatively, just keep your β€œvoice” sources in the same position as the listener.

+1
source

Just use

 alSourcei(id, AL_DIRECT_CHANNELS_SOFT, 1) 
Macro

AL_DIRECT_CHANNELS_SOFT defined in <AL/alext.h>

0
source

Source: https://habr.com/ru/post/1341884/


All Articles