OpenAL
Open Audio Library is a cross-platform audio API developed by Creative Labs for efficient rendering of positional and multi-channel audio in three dimensions. It is designed for use in video games and the style and Microsoft Xbox and PCM format, either in 8 or 16 bits, in mono or stereo format. The rendering engine takes care of all the necessary calculations like attenuation, doppler, etc.
Main concepts
To understand the proper functioning of the library, a series of very important concepts must be defined:
Sound buffer
A sound buffer is a space in memory (usually in the computer's main memory, or sound card memory) used to store the bytes representing a sound stored on the computer. Generally, it is an encoding of a certain sound, using a digital encoding.
Sources
A source or origen (translated literally) is what is known as a sound emitter. It is characterized by encapsulating a sound (reproducing it), having a 3D position in the world, a speed, a volume, a frequency, etc. It is one of the most important structures of OpenAL, since it allows the reception of sounds with effects, such as the Doppler effect.
As an important detail, a 3D emitter will only be able to correctly emit sounds of the [MONO] type, with a single reproduction channel. The attributes of a sound can be changed at any time while it is playing, and the sound will be affected by these changes.
Listener
In every communication system there must be a sender (source), a channel (air simulation, in this case) and, of course, a receiver. In the case of OpenAL, the receiver or listener is called the listener.
Like an emitter, a receiver has a series of main characteristics, such as a position, a direction, a speed and a gain. Unfortunately, OpenAL only accepts one listener per OpenAL context. In case you want to play a sound from different listeners, it will be necessary to create a context for each listener, and change it dynamically.
As with the emitters or sources, the changes made to the different parameters of a listener will be reflected in terms of listening to the sound, in real time.
Queues or queues for streaming
OpenAL allows the creation of Queues or queues to introduce sounds and play them continuously, as if it were streaming.
It can be very useful when the sound to be played is too large (say, 2 hours of HD recording), so it will not be possible to save the entire file in a buffer, and play it as is. Therefore, it is necessary to partition the original sound, and play each fragment, and release those already played.
In addition, it should be noted that it is a queue of buffers, and not of sources or emitters. Each fragment extracted from the original sound will be reproduced in an orderly manner according to its position in the queue, and under the established characteristics (position, gain...) for the transmitter to which the queue has been assigned.
You can also use the library and these queues to capture sound with an input device (microphone...) and play it continuously, each fragment being a small amount of recorded audio.
Games using OpenAL
Contenido relacionado
Smarty
Lime mortar
Cyc