Log in

View Full Version : ogg vorbis help


BrewKnowC
02-13-2003, 02:02 PM
Hi, i've reached the audio stage of my game development and have decided to go with ogg vorbis for size vs. quality and it's royalty free aspect. But I'm having trouble finding a starting point on the code needed to simply play an ogg vorbis file. I'm having trouble making heads or tails of the included docs. I was wondering if someone can give just an overview of the steps needed for me to play an ogg file in my win32/directX game. Any additional info would be appreciated as well. Thank You much

Jason Starr
02-13-2003, 10:32 PM
Its fairly straight forward, most of your problems will be in the synchronization part of it. I havn't looked at the OGG vorbis source for a year now so please forgive any errors.

If you take a look at the OGG source you should be able to find a decoder they have already done. ie They have already written a decoder which takes a pointer to an OGG file and plays it.

Basically you are going to have to MOD that so it gives you a segment of WAVE File (I used around 0.5 seconds or so) and then pass that to a streaming DirectSound buffer you have. I have used a 1 second direct sound buffer and that worked nicely without any problems on playback on all the systems I tried. You will also want to do that in a seperate thread I would think.

I would paste some of the code I did but I don't have access to it at the moment. A few people have used my Dsound OGG decoder in their shareware games, the source isn't publically available though. I would suggest you read the DirectX7 SDK on streaming WAVE files and the OGG source a lot and you will get a better understanding of how it all works.

-Jason-

patrox
02-13-2003, 10:48 PM
I would recommand using bass for ogg/wavs etc..

http://www.un4seen.com/

( or www.fmod.org but it's more expensive )

pat.