Lesson #9 (OpenAL Vorbis Extension)

With the new (still beta) release of openal with AL_EXT_vorbis support it is now easy to play .ogg files.
The ogg extension is not working correctly with some openal implementations. Also it may be depracted now.

1) First you need the openal with router for windows. Available from creative. You can download it here

2) From the you need to download wrap_oal.dll. You need to copy it over the file already available in your windows system32 folder. (NB the beta version of wrap_oal.dll is no longer available you should rely on it being implemented in the latest drivers for your soundcard or dowload the latest openal runtime from creative).

3) Also you need to have ogg vorbis sdk. Available from All the dll files in the bin folder need to be copied into your windows system32 folder!

Now your openal should have the vorbis extension working.

How do we use it from our delphi programs?

First we need to determine if the extension is available. OpenAL supplies the alIsExtensionPresent function for that purpose. Checking for the AL_EXT_vorbis will look like this:


oggext is a boolean. So it is true if the AL_EXT_vorbis extension is available and false if it is not available. Also alIsExtensionPresent initializes ogg vorbis. This means that without checking for the extension you cannot use it, only after checking the extension is available for using.

Getting the ogg file into an buffer is as easy as copying the compressed ogg file into the buffer. The looks like this:

AlBufferData(buffer, AL_FORMAT_VORBIS_EXT, oggfile.Memory, oggfile.Size, 44800);

Delphi cannot compile this yet as AL_FORMAT_VORBIS_EXT is not yet in the altypes.pas file. You need to add the following line to that file.

AL_FORMAT_VORBIS_EXT                  = $10003;

Place it below the other AL_FORMAT consts.

If you only get silence when trying to play an ogg file, you may want to edit alut.pas.

In the alutinit procedure change:

Device := alcOpenDevice(’DirectSound3D’);


Device := alcOpenDevice(nil);

Placing the above into the sourcecode from the first lesson is easy. Take a look at the completed sourcecode below.