More OpenAL, Ogg Vorbis support added

Started by Matzon, January 08, 2004, 23:48:36

Previous topic - Next topic

Matzon

I've just comitted support for the ogg vorbis extension.
Ogg vorbis is implemented using the still beta extension 'AL_EXT_vorbis' in OpenAL. The OpenAL implementation can be downloaded from http://openal.org. The extension is Win32 only, and requires the libvorbisfile.dll to be available.

I do not know when support for Mac OS X & Linux is done - you'll have to ask the OpenAL guys about that :)

For easy convinience I have created a precompiled package here:
www.matzon.dk/brian/Random%20Junk/lwjgl_vorbis_ext.zip

and do a:
Quotejava -cp .;lwjgl.jar;lwjgl_test.jar;res.zip; org.lwjgl.test.openal.PlayTest boom.ogg

should see similar output:
QuoteAttempting to load Ogg Vorbis file, checking for extension...found
Attempting to load: boom.ogg
Waiting 5 seconds for sound to complete

So, how do you use it? Pretty easy:
1 - Query for extension (MUST do this to initialize extension)
if(AL.alIsExtensionPresent("AL_EXT_vorbis")) {
  // do stuff
}

2 - load ogg vorbis file into bytebuffer (direct)
3 - buffer data
AL.alBufferData(buffers.get(0), AL.AL_FORMAT_VORBIS_EXT, filebuffer, filebuffer.capacity(), -1);

notice that sample rate and file size is ignored.
4 - play as you would normally

Matzon

Please note that the package at http://www.matzon.dk/brian/Random%20Junk/lwjgl_vorbis_ext.zip uses the new OpenAL router architecture (automatically finds the most suitable dll) - and as such might try to load a false dll or something (it looks for *openal*.* afaik). If so, just backup any oal dlls in %windows%\system32\ (typically openal32.dll & perhaps a wrap_oal.dll), and remove them. Though it ought to use those in the zip file

Matzon

Just a reply of the OpenAL mailinglist (from Ryan C. Gordon):
Quote
QuoteDo you have a timeframe for when can we expect the Mac OS X & Linux
> versions to support the extension (even though they support vorbis via a
> _LOKI extension?)?
My MacOSX implementation supports AL_EXT_vorbis:
 http://icculus.org/al_osx/

(It's also the fastest AL implementation on the Mac right now).

The Linux version supports AL_EXT_vorbis, too.

--ryan.
Could someone verify this?

spasi

I don't know about MacOS, but we have successfully tested the extension on Linux.

vrm

the ogg extension is in openAL for Linux now ?

Matzon

it has always been in linux, you just have to query for the correct extension (AL_EXT_vorbis) and the correct buffer format value, using al.alGetEnumValue (AL_FORMAT_VORBIS_EXT).

I have yet to get it working under linux though...

http://www.openal.org/extensions.html