Re: Modifying streaming sound in realtime

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Friday, October 08, 2010 11:51:35 am Joseph Cooper wrote:
> I'm working on an application that is streaming audio synthesized on
> the fly.

Hi.

Funny enough, this was one of the reasons behind the AL_SOFT_buffer_sub_data 
extension:
http://kcat.strangesoft.net/openal-extensions/SOFT_buffer_sub_data.txt

It's actually taken from the AL_EXT_buffer_sub_data extension that was 
proposed a while back, and recently implemented as AL_SOFT_* since I don't 
know when the AL_EXT_* version will get done (and being marked with SOFT, 
won't conflict with a possible EXT version down the line).

Essentially the way it would work is, instead of a buffer queue you would play 
a single buffer in a loop, and use the alBufferSubDataSOFT function to update 
parts of the buffer while it plays. The "write cursor" can be used to 
determine where you can safely write audio to, to have it heard as soon as 
possible.

It's currently only available in the Git version of OpenAL Soft, though I hope 
to make a release soon once the loop points extension is settled.


Alternatively, under OSX there is the AL_EXT_STATIC_BUFFER extension, which 
allows you to specify your own buffer data pointer for OpenAL to use. Similar 
in use to the above, the buffer contents can be changed while the source is 
playing by simply rewriting the data in the given pointer. Although the 
extension doesn't seem to be as well designed to be used in this way, as 
there's no way to tell where you can safely write to.

Someone from Apple, or someone who is familiar enough with how it works, would 
need to say whether that's really a viable option, though.


Hope that helps.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.