| 1 |
<html lang="en"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>DerelictAL</title> |
|---|
| 4 |
<link rel="stylesheet" type="text/css" href="styles.css"> |
|---|
| 5 |
</head> |
|---|
| 6 |
<body> |
|---|
| 7 |
<hr> |
|---|
| 8 |
<hr> |
|---|
| 9 |
<h2 align="center">DerelictAL</h2> |
|---|
| 10 |
<hr> |
|---|
| 11 |
<hr> |
|---|
| 12 |
<h3>Introduction</h3> |
|---|
| 13 |
DerelictAL is a D binding to the <a href="http://www.openal.org/">OpenAL</a> |
|---|
| 14 |
library. |
|---|
| 15 |
|
|---|
| 16 |
<div class="note">Some functions have been omitted from the binding. This was |
|---|
| 17 |
done because the functions were, in the C headers, either marked as unused or |
|---|
| 18 |
flagged for removal in the future. Also, no bindings for the alut* functions are |
|---|
| 19 |
included at this time. Finally, the alu* functions are included but are currently |
|---|
| 20 |
only available on Windows as they were only compiled into the Windows version |
|---|
| 21 |
of OpenAL at the time the binding was created. If they become available in OpenAL |
|---|
| 22 |
on other platforms, then DerelictAL will eventually expose them on those platforms |
|---|
| 23 |
as well.</div> |
|---|
| 24 |
|
|---|
| 25 |
<h3>Using</h3> |
|---|
| 26 |
<ol> |
|---|
| 27 |
<li>Always make sure the DerelictAL source modules are available on your import |
|---|
| 28 |
path.</li> |
|---|
| 29 |
<li>In modules that make use of DerelictAL, you will need to import the derelict.openal.al |
|---|
| 30 |
module.</li> |
|---|
| 31 |
<li>Before calling any OpenAL functions, you need to make a call to <tt>DerelictAL.load()</tt>. |
|---|
| 32 |
This will load the shared library.</li> |
|---|
| 33 |
</ol> |
|---|
| 34 |
|
|---|
| 35 |
<p> |
|---|
| 36 |
The following is a complete program that loads DerelictAL: |
|---|
| 37 |
</p> |
|---|
| 38 |
|
|---|
| 39 |
<pre> |
|---|
| 40 |
import derelict.openal.al; |
|---|
| 41 |
|
|---|
| 42 |
void main() |
|---|
| 43 |
{ |
|---|
| 44 |
DerelictAL.load(); |
|---|
| 45 |
|
|---|
| 46 |
// now you can call OpenAL functions |
|---|
| 47 |
} |
|---|
| 48 |
</pre> |
|---|
| 49 |
|
|---|
| 50 |
<p> |
|---|
| 51 |
From this point on, you may call OpenAL functions as normal. Additionally, because |
|---|
| 52 |
not all applications will need the alu* functions, the loading of these functions |
|---|
| 53 |
has been separated from the rest of the OpenAL functions. This is so that DerelictAL.load |
|---|
| 54 |
will not fail if any alu* functions are missing and you don't need them anyway. |
|---|
| 55 |
As such, you must make a call to <tt>DerelictAL.loadALU</tt> in order to load the alu* |
|---|
| 56 |
functions. As noted above, these functions are currently only available on Windows. |
|---|
| 57 |
You can call <tt>DerelictAL.load()</tt> in a platform-indpendent manner, but you should |
|---|
| 58 |
wrap any calls to DerelictALU functions in a <tt>version(Windows)</tt> block. |
|---|
| 59 |
</p> |
|---|
| 60 |
|
|---|
| 61 |
<div class="note">Return values and function parameters of type |
|---|
| 62 |
<tt>ALubyte*</tt> or <tt>ALCubyte*</tt>, when intended to represent a string, |
|---|
| 63 |
have been declared in DerelictAL as <tt>char*</tt> instead.</div> |
|---|
| 64 |
|
|---|
| 65 |
<p><pre> |
|---|
| 66 |
import derelict.openal.al; |
|---|
| 67 |
|
|---|
| 68 |
void main() |
|---|
| 69 |
{ |
|---|
| 70 |
DerelictAL.load(); |
|---|
| 71 |
DerelictALU.load(); |
|---|
| 72 |
|
|---|
| 73 |
// call OpenAL functions |
|---|
| 74 |
|
|---|
| 75 |
version(Windows) |
|---|
| 76 |
{ |
|---|
| 77 |
// call alu* functions |
|---|
| 78 |
} |
|---|
| 79 |
} |
|---|
| 80 |
</pre></p> |
|---|
| 81 |
|
|---|
| 82 |
<p> |
|---|
| 83 |
As with other Derelict packages, DerelictAL will throw an exception if an error |
|---|
| 84 |
occurs while loading the shared library. For more information on Derelict |
|---|
| 85 |
exceptions, see the documentation for |
|---|
| 86 |
<a href="loading.html">Loading/Unloading Shared Libraries</a>.</p> |
|---|
| 87 |
|
|---|
| 88 |
<p> |
|---|
| 89 |
Finally, the method <tt>DerelictAL.unload()</tt> is provided for convenience. |
|---|
| 90 |
In normal practice you do not need to call this function, as Derelict will unload |
|---|
| 91 |
the library automatically when the app exits. You generally should only use this |
|---|
| 92 |
function if you need to unload DerelictAL while the application is running. |
|---|
| 93 |
</p> |
|---|
| 94 |
|
|---|
| 95 |
<h3>Dependencies</h3> |
|---|
| 96 |
<a href="util.html">DerelictUtil</a> |
|---|
| 97 |
|
|---|
| 98 |
</body> |
|---|
| 99 |
</html> |
|---|