Jump to content
  • Advertisement
Sign in to follow this  
BEHOLDER192875

Using DirectX9 to play Ogg Vorbis files

This topic is 3512 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

How in the world can I get Windows/DirectX to play an Ogg Vorbis file? .ogg I am using Microsoft Visual C++ 2008 Studio Express. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You can use either XAudio2, or the depreciated DirectSound.
I don't think that either of them provide simple functions that just plays a .ogg file, so you'll have to write the loader yourself.

This process can be much simplifyied if you go visit the theora site here and download the provided decoders. You'll need libogg and libvorbis. The documentation there should help you get started.

Share this post


Link to post
Share on other sites
This GameDev article might help you. It shouldn't be too difficult to replace the OpenAL stuff with XAudio2 or Directsound code (I'd recommend XAudio2, because it's better supported and is a nicer API anyway). Basically you can't directly play it, you're going to have to use libogg and libvorbis to decode it to PCM data, then play that with some other audio API. You can stream it, or do it all in one go.

Share this post


Link to post
Share on other sites
Here is a class for streaming ogg. You can basically cut and paste it into your project. Somewhere online I've also found a tutorial on loading a ogg into memory and using the DirectSound buffer to play it but I can't find it now.

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!