Openal -open Audio Library- 2.0.7.0 Site
One of the greatest strengths of OpenAL 2.0.7.0 is the alsoft.conf configuration file. On Windows, it resides in %APPDATA%\alsoft.ini; on Linux, ~/.alsoftrc.
Most distributions include OpenAL Soft 2.0.7.0 in their repos:
# Debian/Ubuntu
sudo apt-get install libopenal-dev
ALuint source;
alGenSources(1, &source);
alSourcei(source, AL_BUFFER, buffer);
alSource3f(source, AL_POSITION, 2.0f, 0.0f, 1.0f); // 2 meters right, 1 forward
alSourcef(source, AL_GAIN, 0.8f);
alSourcef(source, AL_REFERENCE_DISTANCE, 1.0f);
alSourcef(source, AL_MAX_DISTANCE, 20.0f);
Example (conceptual C flow):
device = alcOpenDevice(NULL);
context = alcCreateContext(device, NULL);
alcMakeContextCurrent(context);
alGenBuffers(1, &buf);
alBufferData(buf, AL_FORMAT_STEREO16, data, size, freq);
alGenSources(1, &src);
alSourcei(src, AL_BUFFER, buf);
alSource3f(src, AL_POSITION, x, y, z);
alSourcePlay(src);
/* ... */
alDeleteSources(1, &src);
alDeleteBuffers(1, &buf);
alcDestroyContext(context);
alcCloseDevice(device);
To enable personalized 3D audio on headphones:
hrtf = true
hrtf_tables = Default HRTF, CustomHRTF.mhr
You can generate custom HRTF using the makehrtf utility supplied with OpenAL Soft. openal -open audio library- 2.0.7.0
alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);
alListener3f(AL_VELOCITY, 0.0f, 0.0f, 0.0f);
// Orientation: 'at' and 'up' vectors
ALfloat orientation[] = 0.0f,0.0f,-1.0f, 0.0f,1.0f,0.0f;
alListenerfv(AL_ORIENTATION, orientation);
[general]
drivers = alsa,pulseaudio,wasapi
channels = stereo
sample-type = float32
period_size = 512
[hrft]
default = true
hrtf = builtin
[effect]
reverb = on
max_sends = 4
[debug]
level = warning
If you are already registered please log in.
Alternatively, please create your account!
Forgot password?
The file you are trying to access requires you to be logged in as a registered user.
Registration is free, create your account!