[openal] [c++] Some basic questions

Akinak 101 May 04, 2008 at 19:58

hi there again.
i have just finished openal tutorials, and played some ogg files with it,
now to add sound to my engine and i have some questions.

  1. acording to developer.creative.com

Streaming audio into OpenAL involves a simple process of buffer queuing. There are no circular buffers or play and write cursors to worry about. An OpenAL Source can be given a list of OpenAL Buffers to play one after another. When a Buffer in the queue finishes playing, it can be un-queued, filled in with new audio data, and re-queued!

so when im playing a big file ( a background musice for exp. ) if i want to use streaming i have to create multiply buffers and fill them with data and then queue them in a source,
then what about memory and io, reading entire sound in a vector and fill it in multiply buffers or just read from file and fill a buffer while another buffer is playing, in first way ( fill a vector and close ogg file ) i think there is no diffrences between it and filling entire sound in 1 buffer, in second way ( fill buffer while reading from file ) i need to read from file continuesly , this costs alot i think !
so how should i handle long soungs?
1- read them once and fill a buffer for each of them.
2- read them once and fill an array(vector) for each of them and use QueueBuffer to fill buffers little by little ( how little this buffers should be ??? )
3- read them continuesly while playing them…

  1. there is a win64 version of openal too, i wrote my graphics engine with d3d9, till now i dont care about win32 or win64,
    graphics part works well on both , but with openal it seems i need to build a win64 & win32 version of game engine. ??

  2. when i have filled a buffer , where this data go ? on RAM, SOUND CARD or ??
  3. what size is a good size for filling a buffer if i want to seprate a song in diferente buffers ?

  4. is openal thread safe, im giong to create a new thread for entire sound operations , is it safe to call “alSourcePause” from another thread while openAL is playing the sound in other one ?

sorry for bad english
and hope this gets usefull for others too…

0 Replies

Please log in or register to post a reply.

No replies have been made yet.