kenny.dewhirst's picture

Need help with OpenAL

I've looked around, and all the example code I can find using OpenTK's audio libraries seem to reference deprecated code. If someone could point me towards a tutorial that will just play simple sounds, I'd really appreciate it.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

OpenAL is a low-level API that does not provide any facilities to load audio files from disk. Indeed, it doesn't even know what a "file" is.

Check out the "Playback" sample in the OpenTK Example Browser (you can find that in your start menu, if you are using windows). It loads a .wav file from disk and plays it back using OpenAL.

The DragonOgg project provides a managed loader for .ogg files (an open-source audio format with better compression than .mp3). You can use that to load .ogg files and play them back using the code from the example above (I've been using that successfully for the past year or so).

For other file formats, you will probably have to p/invoke native libraries (but if you do find managed loaders for .mp3 or other formats, please post it!)

kenny.dewhirst's picture

Thank you for the response! Dragon Ogg looks like it's exactly what I wanted.