Sign in to follow this  
Marmin

using ogg in a game

Recommended Posts

Marmin    523
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
Pipo DeClown    804
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
paulecoyote    1065
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
Marmin    523
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
DaBono    1496
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this