DerelictAL



Introduction

DerelictAL is a D binding to the OpenAL library.
Some functions have been omitted from the binding. This was done because the functions were, in the C headers, either marked as unused or flagged for removal in the future. Also, no bindings for the alut* functions are included at this time. Finally, the alu* functions are included but are currently only available on Windows as they were only compiled into the Windows version of OpenAL at the time the binding was created. If they become available in OpenAL on other platforms, then DerelictAL will eventually expose them on those platforms as well.

Using

  1. Always make sure the DerelictAL source modules are available on your import path.
  2. In modules that make use of DerelictAL, you will need to import the derelict.openal.al module.
  3. Before calling any OpenAL functions, you need to make a call to DerelictAL.load(). This will load the shared library.

The following is a complete program that loads DerelictAL:

import derelict.openal.al;

void main()
{
	DerelictAL.load();
	
	// now you can call OpenAL functions
}

From this point on, you may call OpenAL functions as normal. Additionally, because not all applications will need the alu* functions, the loading of these functions has been separated from the rest of the OpenAL functions. This is so that DerelictAL.load will not fail if any alu* functions are missing and you don't need them anyway. As such, you must make a call to DerelictAL.loadALU in order to load the alu* functions. As noted above, these functions are currently only available on Windows. You can call DerelictAL.load() in a platform-indpendent manner, but you should wrap any calls to DerelictALU functions in a version(Windows) block.

Return values and function parameters of type ALubyte* or ALCubyte*, when intended to represent a string, have been declared in DerelictAL as char* instead.

import derelict.openal.al;

void main()
{
	DerelictAL.load();
	DerelictALU.load();
	
	// call OpenAL functions
	
	version(Windows)
	{
		// call alu* functions
	}
}

As with other Derelict packages, DerelictAL will throw an exception if an error occurs while loading the shared library. For more information on Derelict exceptions, see the documentation for Loading/Unloading Shared Libraries.

Finally, the method DerelictAL.unload() is provided for convenience. In normal practice you do not need to call this function, as Derelict will unload the library automatically when the app exits. You generally should only use this function if you need to unload DerelictAL while the application is running.

Dependencies

DerelictUtil