How to play OGG and/or MP3 with OpenAL?

Started by kitfox, September 14, 2016, 11:45:42

Previous topic - Next topic

kitfox

I'm new to OpenAL and trying to figure out the best way to load and play audio files using it.  My stumbling block at the moment is trying to find classes that can read OGG or MP3 files so I can then send their sound data to the OpenAL API.  (I'd prefer to use this over WAV, since WAV veresions of my files are around 10 times larger.  Also, the WaveData class does not seem to be included with LWJGL 3).

A tutorial that describes how to stream OGG would be really nice, but just finding a decoder would be helpful too.  (Also, it would be great to find code with a nonrestrictive commercial license.  Something like Apache 2 or BSD).

Could anyone give this newbie some tips?

Kai

LWJGL 3 can directly decode Ogg Vorbis to PCM, via the org.lwjgl.stb.STBVorbis class.

spasi

Quote from: kitfox on September 14, 2016, 11:45:42A tutorial that describes how to stream OGG would be really nice

This demo does stream decoding and playback of an Ogg Vorbis file.

kitfox


This demo does stream decoding and playback of an Ogg Vorbis file.
[/quote]

Thanks.  This code has about two dozen lines that cause errors with the LWJGL 3 release, though.  I'll try to see if I can adapt it.