Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

robpearmain

How to play OGG file in Managed C# DirectX

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

Advertisement
My best bet would be to use Managed DirectShow with C#. However, since DirectShow actually uses those filters/plugins/codecs/whatever installed on the machine, you would not be able to play the OGG until you install the relevent codecs.

Share this post


Link to post
Share on other sites
Use the OGG File Format specification to write your own loader/decompresser, write out the sound data into a Microsoft.DirectX.DirectSound.Buffer object, and play it.

Alternatively, you could try the Microsoft.DirectX.AudioVideoPlayback.Audio class.

Share this post


Link to post
Share on other sites
It is usually inefficient to buffer the whole ogg, especially if it is a music track, since the raw sound will require a relatively huge amount of memory. Instead, create a buffer that can hold, for example, a second of sound - and read a little bit from the ogg file every second to fill the buffer again.
The latter is the way DirectShow does it

-Nik

EDIT: You can't really go more "real-time" than that, since at least the sound card needs some kind of actual buffer for the data.

[edited by - Nik02 on April 21, 2004 9:19:26 AM]

Share this post


Link to post
Share on other sites
The other way is a good programming excercise, but I think that DirectShow is enough for most cases, including yours.
Only bad thing in DShow approach is that you have to get the ogg/vorbis codec to the target machine.

-Nik

Share this post


Link to post
Share on other sites

  • 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!