Jump to content
  • Advertisement
Sign in to follow this  

Streaming Audio

This topic is 1740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been wanting to develop a cross-platform strategy for playing music, and I think the answer is OpenAL as it's widely available. What I could do is download the source to libogg, and have 2 buffers: one buffer primed with the audio currently being output, and a second buffer being filled with data to be played. This method is similar to double buffering with OpenGL, but with audio instead. I'll also offline this on another thread. Does this sound reasonable?

 

Now, Android doesn't really OpenAL natively. It uses OpenSL ES, which I can't find much documentation on at this time. I'm thinking of just having an AudioDriver class that'll provide a common interface with my ogg loading/rendering class. If it's running on Android devices, this common driver will compile to use OpenSL ES functions, or if it's another supported platform, it'll use OpenAL.

Share this post


Link to post
Share on other sites
Advertisement

I went back to take a look at how I did my audio library that uses libogg, and from the looks of it, it uses the dual-buffer method you describe. Playback is seamless.

 

EDIT: Whoopsies!  I didn't see your comment about the threading.  In my case, the audio API I was building on, Windows Multimedia, notifies my library when it's done with one of the buffers.  It is at this time, within my callback function, when I will pull in more audio samples.  In this way, my library does not use explicit threading; rather, the concurrency is built into the low-level audio subsystem.

Edited by shuma-gorath

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!