[Openal-devel] Faster buffer model, and more random stuff

Сергей Беляшов sergey.belyashov at gmail.com
Mon Mar 3 01:45:26 PST 2008


I think that is better to use update ideology than mapping or static buffers.
For example:
/** \brief update buffer data
 * @param name buffer name
 * @param format data format
 * @param data pointer to the data
 * @param size data size
 * @param frequency data frequency
 * @return actual size of data used by this command
 */
ALsizei alBufferDataUpdate(ALuint name, ALenum format, const ALvoid* data,
                                                    ALsizei size,
ALsizei frequency);

For recently created buffers it works as alBufferData() but for
buffers which already contains some data it only updates them. Return
result indicating how many data copied to the buffer (depends on
current buffer size and internal audio format).

This function has advantages over static buffer extension and buffer
mapping, because it protect buffer from changing at play time and hide
internal buffer format. Also it guarantee no new internal memory
allocations (except first call for empty buffers) unlike static buffer
and alBufferData().
But has one disadvantage - program should use its our buffer for
realtime audio decoding which need to be passed to the
alBufferDataUpdate.

P.S.: sorry, if I use other's idea.


More information about the Openal-devel mailing list