Jump to content
  • Advertisement
Sign in to follow this  
Marmin

using ogg in a game

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

Hi, i want to use ogg vorbis compression in my game. I 've looked at DirectSound and DirectMusic.. should i use DirectMusic? I'm using Pascal and there are no tutorials whatsoever, as usual.

Share this post


Link to post
Share on other sites
Advertisement
You probably want to use DirectShow since that is the only soundobject in DirectX that uses the filters available on your computer to play a sound-file. If you use DirectSound, you'll need to load and decompress the file yourself.
AFAIK, DirectMusic doesn't support ogg loading. Only midi and other instrumental filetypes (and of course wav).

Anyhow, I'd like to suggest that you use OpenAL for sound programming. It's a very capable and easy to use sound API and MUCH easier than the DirectX-sound APIs.

Share this post


Link to post
Share on other sites
Pascal huh? Cool, not used that in years!
Well, if you can import a c dll into pascal (which I'm sure probably you can) then just use the ogg dll and documentation on the site.
If you use DirectShow you have to install the ogg codec on any machine you use ogg in... if you use the dll you can embed ogg playing into your application.

Share this post


Link to post
Share on other sites
Quote:
Original post by paulecoyote
Pascal huh? Cool, not used that in years!
Hehe.. I've heard that before :lol: The Pascal world is unfortunately a bit isolated.

Yep, I've looked into DirectSound. quote: 'If you use DirectSound, you'll need to load and decompress the file yourself' OK- maybe i'll use a wav file then instead of a ogg vorbis file. I'm cutting it 22.1 khz and 16 bit that shouldn't be a too large file.

Thanks anyway for the kind replies. :)
I'm using DirectX 8.1, what's the most used way to load a wav file into a IDirectSoundBuffer ? Do I load from a resource and then just copy into the stream? MSDN has this nice tutorial about a drum machine. I'll study this some more.

Share this post


Link to post
Share on other sites
The OggVorbis library has quite a convenient interface. Most of the difficult functions of the libogg and libvorbis libraries are wrapped in a very handy OggVorbisFile-library.

The harderst part of your sound programming would probably be filling of the DirectSound buffers etc.

After you have written your WAV-capable sound engine, I would recommend to look into these libraries. The decompressing of an OGG is a matter of calling a function like ov_read() and your buffer will be filled with wave-data. (Ok, maybe a bit over-simplified, but it's not too difficult, really.)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!