| 1 |
<html lang="en"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>DerelictVorbis</title> |
|---|
| 4 |
<link rel="stylesheet" type="text/css" href="styles.css"> |
|---|
| 5 |
</head> |
|---|
| 6 |
<body> |
|---|
| 7 |
<hr> |
|---|
| 8 |
<hr> |
|---|
| 9 |
<h2 align="center">DerelictVorbis</h2> |
|---|
| 10 |
<hr> |
|---|
| 11 |
<hr> |
|---|
| 12 |
<h3>Introduction</h3> |
|---|
| 13 |
<p>DerelictVorbis is a D binding to Xiph.org's <a href="http://www.xiph.org/vorbis"> |
|---|
| 14 |
Ogg Vorbis codec</a>. Vorbis is a compressed audio format similar to mp3, but |
|---|
| 15 |
allows smaller filesizes with the same level of audio quality and is also |
|---|
| 16 |
patent-free and open source.</p> |
|---|
| 17 |
|
|---|
| 18 |
<p>The Vorbis library is divided into three parts. The codec library itself |
|---|
| 19 |
has many lower-level functions for dealing directly with compressed Vorbis |
|---|
| 20 |
streams. VorbisFile is a higher-level API built on top of the codec |
|---|
| 21 |
for decoding Vorbis files; and VorbisEnc is an API for encoding |
|---|
| 22 |
raw audio data to the Vorbis format. VorbisFile and VorbisEnc should |
|---|
| 23 |
be enough for most projects.</p> |
|---|
| 24 |
|
|---|
| 25 |
<div class="note">VorbisEnc is not yet supported by DerelictVorbis</div> |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
<h3>Using</h3> |
|---|
| 29 |
<ol> |
|---|
| 30 |
<li>Always make sure the DerelictVorbis source modules are available on your import |
|---|
| 31 |
path.</li> |
|---|
| 32 |
<li>In modules that make use of the Vorbis codec or VorbisFile, you will need to import the |
|---|
| 33 |
derelict.ogg.vorbis module.</li> |
|---|
| 34 |
<li>Before calling any Vorbis codec functions, you need to make a call to <tt>DerelictVorbis.load()</tt>. |
|---|
| 35 |
This will load the shared library.</li> |
|---|
| 36 |
<li>Before calling any VorbisFile functions, you need to make a call to <tt>DerelictVorbisFile.load()</tt>. |
|---|
| 37 |
This will load the shared library.</li> |
|---|
| 38 |
</ol> |
|---|
| 39 |
|
|---|
| 40 |
<p> |
|---|
| 41 |
The following is a complete program that loads DerelictVorbis and DerelictVorbisFile. It may be |
|---|
| 42 |
rare that you'll use both at the same time, but this is for demonstration purposes: |
|---|
| 43 |
</p> |
|---|
| 44 |
|
|---|
| 45 |
<pre> |
|---|
| 46 |
import derelict.ogg.vorbis; |
|---|
| 47 |
|
|---|
| 48 |
void main() |
|---|
| 49 |
{ |
|---|
| 50 |
DerelictVorbis.load(); |
|---|
| 51 |
DerelictVorbisFile.load(); |
|---|
| 52 |
|
|---|
| 53 |
// now you can call Vorbis and VorbisFile functions |
|---|
| 54 |
} |
|---|
| 55 |
</pre> |
|---|
| 56 |
|
|---|
| 57 |
<p>Take a look at vorbisfile_example.d in the /examples folder for a complete program that reads header info |
|---|
| 58 |
(Artist, channels, etc.) from Ogg Vorbis files and also decodes them.</p> |
|---|
| 59 |
|
|---|
| 60 |
<p> |
|---|
| 61 |
As with other Derelict packages, DerelictVorbis will throw an exception if an error |
|---|
| 62 |
occurs while loading the shared library. For more information on Derelict |
|---|
| 63 |
exceptions, see the documentation for |
|---|
| 64 |
<a href="loading.html">Loading/Unloading Shared Libraries</a>. |
|---|
| 65 |
</p><p> |
|---|
| 66 |
Finally, the functions <tt>DerelictVorbis.unload()</tt> and <tt>DerelictVorbisFile.unload()</tt> |
|---|
| 67 |
are provided for convenience. In normal practice you do not need to call these |
|---|
| 68 |
functions, as Derelict will unload the library automatically when the app exits. |
|---|
| 69 |
You generally should only use this function if you need to unload either library |
|---|
| 70 |
while the application is running. |
|---|
| 71 |
</p> |
|---|
| 72 |
|
|---|
| 73 |
<h3>Dependencies</h3> |
|---|
| 74 |
<a href="util.html">DerelictUtil</a><br> |
|---|
| 75 |
<a href="ogg.html">DerelictOgg</a> |
|---|
| 76 |
</body> |
|---|
| 77 |
</html> |
|---|