1 /*
2 
3 Boost Software License - Version 1.0 - August 17th,2003
4 
5 Permission is hereby granted,free of charge,to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use,reproduce,display,distribute,
8 execute,and transmit the Software,and to prepare derivative works of the
9 Software,and to permit third-parties to whom the Software is furnished to
10 do so,all subject to the following:
11 
12 The copyright notices in the Software and this entire statement,including
13 the above license grant,this restriction and the following disclaimer,
14 must be included in all copies of the Software,in whole or in part,and
15 all derivative works of the Software,unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
20 IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE,TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY,WHETHER IN CONTRACT,TORT OR OTHERWISE,
24 ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */
28 module derelict.allegro5.audio;
29 
30 private {
31     import derelict.util.loader,
32            derelict.util.system;
33 
34     import derelict.allegro5.internal,
35            derelict.allegro5.types;
36 
37     enum libNames = genLibNames("Audio");
38 }
39 
40 enum {
41     ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT = 513,
42     ALLEGRO_EVENT_AUDIO_STREAM_FINISHED = 514,
43     ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT = 515,
44 }
45 
46 alias ALLEGRO_AUDIO_DEPTH = int;
47 enum {
48     ALLEGRO_AUDIO_DEPTH_INT8 = 0x00,
49     ALLEGRO_AUDIO_DEPTH_INT16 = 0x01,
50     ALLEGRO_AUDIO_DEPTH_INT24 = 0x02,
51     ALLEGRO_AUDIO_DEPTH_FLOAT32 = 0x03,
52     ALLEGRO_AUDIO_DEPTH_UNSIGNED = 0x08,
53     ALLEGRO_AUDIO_DEPTH_UINT8 = ALLEGRO_AUDIO_DEPTH_INT8 | ALLEGRO_AUDIO_DEPTH_UNSIGNED,
54     ALLEGRO_AUDIO_DEPTH_UINT16 = ALLEGRO_AUDIO_DEPTH_INT16 | ALLEGRO_AUDIO_DEPTH_UNSIGNED,
55     ALLEGRO_AUDIO_DEPTH_UINT24 = ALLEGRO_AUDIO_DEPTH_INT24 | ALLEGRO_AUDIO_DEPTH_UNSIGNED,
56 }
57 
58 alias ALLEGRO_CHANNEL_CONF = int;
59 enum {
60     ALLEGRO_CHANNEL_CONF_1 = 0x10,
61     ALLEGRO_CHANNEL_CONF_2 = 0x20,
62     ALLEGRO_CHANNEL_CONF_3 = 0x30,
63     ALLEGRO_CHANNEL_CONF_4 = 0x40,
64     ALLEGRO_CHANNEL_CONF_5_1 = 0x51,
65     ALLEGRO_CHANNEL_CONF_6_1 = 0x61,
66     ALLEGRO_CHANNEL_CONF_7_1 = 0x71,
67 }
68 enum ALLEGRO_MAX_CHANNELS = 8;
69 
70 alias ALLEGRO_PLAYMODE = int;
71 enum {
72     ALLEGRO_PLAYMODE_ONCE = 0x100,
73     ALLEGRO_PLAYMODE_LOOP = 0x101,
74     ALLEGRO_PLAYMODE_BIDIR = 0x102,
75 }
76 
77 alias ALLEGRO_MIXER_QUALITY = int;
78 enum {
79     ALLEGRO_MIXER_QUALITY_POINT = 0x110,
80     ALLEGRO_MIXER_QUALITY_LINEAR = 0x111,
81     ALLEGRO_MIXER_QUALITY_CUBIC = 0x112,
82 }
83 
84 enum ALLEGRO_AUDIO_PAN_NONE = -1000.0f;
85 
86 struct ALLEGRO_SAMPLE;
87 
88 struct ALLEGRO_SAMPLE_ID {
89     int _index;
90     int _id;
91 }
92 
93 struct ALLEGRO_SAMPLE_INSTANCE;
94 struct ALLEGRO_AUDIO_STREAM;
95 struct ALLEGRO_MIXER;
96 struct ALLEGRO_VOICE;
97 
98 // Callback types used for some of the function arguments below
99 extern(C) nothrow {
100     alias PostProcessCallback = void function(void*,uint,void*);
101     alias SampleLoader = ALLEGRO_SAMPLE* function(const(char)*);
102     alias SampleSaver = bool function(const(char)*,ALLEGRO_SAMPLE*);
103     alias StreamLoader = ALLEGRO_AUDIO_STREAM* function(const(char)*,size_t,uint);
104     alias SampleLoaderF = ALLEGRO_SAMPLE* function(ALLEGRO_FILE*);
105     alias SampleSaverF = bool function(ALLEGRO_FILE*,ALLEGRO_SAMPLE*);
106     alias StreamLoaderF = ALLEGRO_AUDIO_STREAM* function(ALLEGRO_FILE*,size_t,uint);
107 }
108 extern(C) @nogc nothrow {
109     alias da_al_create_sample = ALLEGRO_SAMPLE* function(void*,uint,uint,ALLEGRO_AUDIO_DEPTH,ALLEGRO_CHANNEL_CONF,bool);
110     alias da_al_destroy_sample = void function(ALLEGRO_SAMPLE*);
111 
112     alias da_al_create_sample_instance = ALLEGRO_SAMPLE_INSTANCE* function(ALLEGRO_SAMPLE*);
113     alias da_al_destroy_sample_instance = void function(ALLEGRO_SAMPLE_INSTANCE*);
114 
115     alias da_al_get_sample_frequency = uint function(const(ALLEGRO_SAMPLE)*);
116     alias da_al_get_sample_length = uint function(const(ALLEGRO_SAMPLE)*);
117     alias da_al_get_sample_depth = ALLEGRO_AUDIO_DEPTH function(const(ALLEGRO_SAMPLE)*);
118     alias da_al_get_sample_channels = ALLEGRO_CHANNEL_CONF function(const(ALLEGRO_SAMPLE)*);
119     alias da_al_get_sample_data = void* function(const(ALLEGRO_SAMPLE)*);
120 
121     alias da_al_get_sample_instance_frequency = uint function(const(ALLEGRO_SAMPLE_INSTANCE)*);
122     alias da_al_get_sample_instance_length = uint function(const(ALLEGRO_SAMPLE_INSTANCE)*);
123     alias da_al_get_sample_instance_position = uint function(const(ALLEGRO_SAMPLE_INSTANCE)*);
124 
125     alias da_al_get_sample_instance_speed = float function(const(ALLEGRO_SAMPLE_INSTANCE)*);
126     alias da_al_get_sample_instance_gain = float function(const(ALLEGRO_SAMPLE_INSTANCE)*);
127     alias da_al_get_sample_instance_pan = float function(const(ALLEGRO_SAMPLE_INSTANCE)*);
128     alias da_al_get_sample_instance_time = float function(const(ALLEGRO_SAMPLE_INSTANCE)*);
129 
130     alias da_al_get_sample_instance_depth = ALLEGRO_AUDIO_DEPTH function(const(ALLEGRO_SAMPLE_INSTANCE)*);
131     alias da_al_get_sample_instance_channels = ALLEGRO_CHANNEL_CONF function(const(ALLEGRO_SAMPLE_INSTANCE)*);
132     alias da_al_get_sample_instance_playmode = ALLEGRO_PLAYMODE function(const(ALLEGRO_SAMPLE_INSTANCE)*);
133 
134     alias da_al_get_sample_instance_playing = bool function(const(ALLEGRO_SAMPLE_INSTANCE)*);
135     alias da_al_get_sample_instance_attached = bool function(const(ALLEGRO_SAMPLE_INSTANCE)*);
136 
137     alias da_al_set_sample_instance_position = bool function(ALLEGRO_SAMPLE_INSTANCE*,uint);
138     alias da_al_set_sample_instance_length = bool function(ALLEGRO_SAMPLE_INSTANCE*,uint);
139 
140     alias da_al_set_sample_instance_speed = bool function(ALLEGRO_SAMPLE_INSTANCE*,float);
141     alias da_al_set_sample_instance_gain = bool function(ALLEGRO_SAMPLE_INSTANCE*,float);
142     alias da_al_set_sample_instance_pan = bool function(ALLEGRO_SAMPLE_INSTANCE*,float);
143 
144     alias da_al_set_sample_instance_playmode = bool function(ALLEGRO_SAMPLE_INSTANCE*,ALLEGRO_PLAYMODE);
145 
146     alias da_al_set_sample_instance_playing = bool function(ALLEGRO_SAMPLE_INSTANCE*,bool);
147     alias da_al_detach_sample_instance = bool function(ALLEGRO_SAMPLE_INSTANCE*);
148 
149     alias da_al_set_sample = bool function(ALLEGRO_SAMPLE_INSTANCE*,ALLEGRO_SAMPLE*);
150     alias da_al_get_sample = ALLEGRO_SAMPLE* function(ALLEGRO_SAMPLE_INSTANCE*);
151     alias da_al_play_sample_instance = bool function(ALLEGRO_SAMPLE_INSTANCE*);
152     alias da_al_stop_sample_instance = bool function(ALLEGRO_SAMPLE_INSTANCE*);
153 
154     alias da_al_create_audio_stream = ALLEGRO_AUDIO_STREAM* function(size_t,uint,uint,ALLEGRO_AUDIO_DEPTH,ALLEGRO_CHANNEL_CONF);
155     alias da_al_destroy_audio_stream = void function(ALLEGRO_AUDIO_STREAM*);
156     alias da_al_drain_audio_stream = void function(ALLEGRO_AUDIO_STREAM*);
157 
158     alias da_al_get_audio_stream_frequency = uint function(const(ALLEGRO_AUDIO_STREAM)*);
159     alias da_al_get_audio_stream_length = uint function(const(ALLEGRO_AUDIO_STREAM)*);
160     alias da_al_get_audio_stream_fragments = uint function(const(ALLEGRO_AUDIO_STREAM)*);
161     alias da_al_get_available_audio_stream_fragments = uint function(const(ALLEGRO_AUDIO_STREAM)*);
162 
163     alias da_al_get_audio_stream_speed = float function(const(ALLEGRO_AUDIO_STREAM)*);
164     alias da_al_get_audio_stream_gain = float function(const(ALLEGRO_AUDIO_STREAM)*);
165     alias da_al_get_audio_stream_pan = float function(const(ALLEGRO_AUDIO_STREAM)*);
166 
167     alias da_al_get_audio_stream_channels = ALLEGRO_CHANNEL_CONF function(const(ALLEGRO_AUDIO_STREAM)*);
168     alias da_al_get_audio_stream_depth = ALLEGRO_AUDIO_DEPTH function(const(ALLEGRO_AUDIO_STREAM)*);
169     alias da_al_get_audio_stream_playmode = ALLEGRO_PLAYMODE function(const(ALLEGRO_AUDIO_STREAM)*);
170 
171     alias da_al_get_audio_stream_playing = bool function(const(ALLEGRO_AUDIO_STREAM)*);
172     alias da_al_get_audio_stream_attached = bool function(const(ALLEGRO_AUDIO_STREAM)*);
173     alias da_al_get_audio_stream_played_samples = long function(const(ALLEGRO_AUDIO_STREAM)*);
174 
175     alias da_al_get_audio_stream_fragment = void* function(const(ALLEGRO_AUDIO_STREAM)*);
176 
177     alias da_al_set_audio_stream_speed = bool function(ALLEGRO_AUDIO_STREAM*,float);
178     alias da_al_set_audio_stream_gain = bool function(ALLEGRO_AUDIO_STREAM*,float);
179     alias da_al_set_audio_stream_pan = bool function(ALLEGRO_AUDIO_STREAM*,float);
180 
181     alias da_al_set_audio_stream_playmode = bool function(ALLEGRO_AUDIO_STREAM*,ALLEGRO_PLAYMODE);
182 
183     alias da_al_set_audio_stream_playing = bool function(ALLEGRO_AUDIO_STREAM*,bool);
184     alias da_al_detach_audio_stream = bool function(ALLEGRO_AUDIO_STREAM *);
185     alias da_al_set_audio_stream_fragment = bool function(ALLEGRO_AUDIO_STREAM*,void*);
186 
187     alias da_al_rewind_audio_stream = bool function(ALLEGRO_AUDIO_STREAM*);
188     alias da_al_seek_audio_stream_secs = bool function(ALLEGRO_AUDIO_STREAM*,double);
189     alias da_al_get_audio_stream_position_secs = double function(ALLEGRO_AUDIO_STREAM*);
190     alias da_al_get_audio_stream_length_secs = double function(ALLEGRO_AUDIO_STREAM*);
191     alias da_al_set_audio_stream_loop_secs = bool function(ALLEGRO_AUDIO_STREAM*,double,double);
192 
193     alias da_al_get_audio_stream_event_source = ALLEGRO_EVENT_SOURCE* function(ALLEGRO_AUDIO_STREAM*);
194 
195     alias da_al_create_mixer = ALLEGRO_MIXER* function(uint,ALLEGRO_AUDIO_DEPTH,ALLEGRO_CHANNEL_CONF);
196     alias da_al_destroy_mixer = void function(ALLEGRO_MIXER*);
197     alias da_al_attach_sample_instance_to_mixer = bool function(ALLEGRO_SAMPLE_INSTANCE*,ALLEGRO_MIXER*);
198     alias da_al_attach_audio_stream_to_mixer = bool function(ALLEGRO_AUDIO_STREAM*,ALLEGRO_MIXER*);
199     alias da_al_attach_mixer_to_mixer = bool function(ALLEGRO_MIXER*,ALLEGRO_MIXER*);
200     alias da_al_set_mixer_postprocess_callback = bool function(ALLEGRO_MIXER*,PostProcessCallback,void*);
201 
202     alias da_al_get_mixer_frequency = uint function(const(ALLEGRO_MIXER)*);
203     alias da_al_get_mixer_channels = ALLEGRO_CHANNEL_CONF function(const(ALLEGRO_MIXER)*);
204     alias da_al_get_mixer_depth = ALLEGRO_AUDIO_DEPTH function(const(ALLEGRO_MIXER)*);
205     alias da_al_get_mixer_quality = ALLEGRO_MIXER_QUALITY function(const(ALLEGRO_MIXER)*);
206     alias da_al_get_mixer_gain = float function(const(ALLEGRO_MIXER)*);
207     alias da_al_get_mixer_playing = bool function(const(ALLEGRO_MIXER)*);
208     alias da_al_get_mixer_attached = bool function(const(ALLEGRO_MIXER)*);
209     alias da_al_set_mixer_frequency = bool function(ALLEGRO_MIXER*,uint);
210     alias da_al_set_mixer_quality = bool function(ALLEGRO_MIXER*,ALLEGRO_MIXER_QUALITY);
211     alias da_al_set_mixer_gain = bool function(ALLEGRO_MIXER*,float);
212     alias da_al_set_mixer_playing = bool function(ALLEGRO_MIXER*,bool);
213     alias da_al_detach_mixer = bool function(ALLEGRO_MIXER*);
214 
215     alias da_al_create_voice = ALLEGRO_VOICE* function(uint,ALLEGRO_AUDIO_DEPTH,ALLEGRO_CHANNEL_CONF);
216     alias da_al_destroy_voice = void function(ALLEGRO_VOICE*);
217     alias da_al_attach_sample_instance_to_voice = bool function(ALLEGRO_SAMPLE_INSTANCE*,ALLEGRO_VOICE*);
218     alias da_al_attach_audio_stream_to_voice = bool function(ALLEGRO_AUDIO_STREAM*,ALLEGRO_VOICE*);
219     alias da_al_attach_mixer_to_voice = bool function(ALLEGRO_MIXER*,ALLEGRO_VOICE*);
220     alias da_al_detach_voice = void function(ALLEGRO_VOICE*);
221 
222     alias da_al_get_voice_frequency = uint function(const(ALLEGRO_VOICE)*);
223     alias da_al_get_voice_position = uint function(const(ALLEGRO_VOICE)*);
224     alias da_al_get_voice_channels = ALLEGRO_CHANNEL_CONF function(const(ALLEGRO_VOICE)*);
225     alias da_al_get_voice_depth = ALLEGRO_AUDIO_DEPTH function(const(ALLEGRO_VOICE)*);
226     alias da_al_get_voice_playing = bool function(const(ALLEGRO_VOICE)*);
227     alias da_al_set_voice_position = bool function(ALLEGRO_VOICE*,uint);
228     alias da_al_set_voice_playing = bool function(ALLEGRO_VOICE*,bool);
229 
230     alias da_al_install_audio = bool function();
231     alias da_al_uninstall_audio = void function();
232     alias da_al_is_audio_installed = bool function();
233     alias da_al_get_allegro_audio_version = uint function();
234 
235     alias da_al_get_channel_count = size_t function(ALLEGRO_CHANNEL_CONF);
236     alias da_al_get_audio_depth_size = size_t function(ALLEGRO_AUDIO_DEPTH);
237 
238     alias da_al_reserve_samples = bool function(int);
239     alias da_al_get_default_mixer = ALLEGRO_MIXER* function();
240     alias da_al_set_default_mixer = bool function(ALLEGRO_MIXER*);
241     alias da_al_restore_default_mixer = bool function();
242     alias da_al_play_sample = bool function(ALLEGRO_SAMPLE*,float,float,float,ALLEGRO_PLAYMODE,ALLEGRO_SAMPLE_ID*);
243     alias da_al_stop_sample = void function(ALLEGRO_SAMPLE_ID*);
244     alias da_al_stop_samples = void function();
245     alias da_al_get_default_voice = ALLEGRO_VOICE* function();
246     alias da_al_set_default_voice = void function(ALLEGRO_VOICE*);
247 
248     alias da_al_register_sample_loader = bool function(const(char)*,SampleLoader);
249     alias da_al_register_sample_saver = bool function(const(char)*,SampleSaver);
250     alias da_al_register_audio_stream_loader = bool function(const(char)*,StreamLoader);
251 
252     alias da_al_register_sample_loader_f = bool function(const(char)*,SampleLoaderF);
253     alias da_al_register_sample_saver_f = bool function(const(char)*,SampleSaverF);
254     alias da_al_register_audio_stream_loader_f = bool function(const(char)*,StreamLoaderF);
255 
256     alias da_al_load_sample = ALLEGRO_SAMPLE* function(const(char)*);
257     alias da_al_save_sample = bool function(const(char)*,ALLEGRO_SAMPLE *);
258     alias da_al_load_audio_stream = ALLEGRO_AUDIO_STREAM* function(const(char)*,size_t,uint);
259 
260     alias da_al_load_sample_f = ALLEGRO_SAMPLE* function(ALLEGRO_FILE*,const(char)*);
261     alias da_al_save_sample_f = bool function(ALLEGRO_FILE*,const(char)*,ALLEGRO_SAMPLE*);
262     alias da_al_load_audio_stream_f = ALLEGRO_AUDIO_STREAM* function(ALLEGRO_FILE*,const(char)*,size_t,uint);
263 }
264 
265 __gshared {
266     da_al_create_sample al_create_sample;
267     da_al_destroy_sample al_destroy_sample;
268     da_al_create_sample_instance al_create_sample_instance;
269     da_al_destroy_sample_instance al_destroy_sample_instance;
270     da_al_get_sample_frequency al_get_sample_frequency;
271     da_al_get_sample_length al_get_sample_length;
272     da_al_get_sample_depth al_get_sample_depth;
273     da_al_get_sample_channels al_get_sample_channels;
274     da_al_get_sample_data al_get_sample_data;
275     da_al_get_sample_instance_frequency al_get_sample_instance_frequency;
276     da_al_get_sample_instance_length al_get_sample_instance_length;
277     da_al_get_sample_instance_position al_get_sample_instance_position;
278     da_al_get_sample_instance_speed al_get_sample_instance_speed;
279     da_al_get_sample_instance_gain al_get_sample_instance_gain;
280     da_al_get_sample_instance_pan al_get_sample_instance_pan;
281     da_al_get_sample_instance_time al_get_sample_instance_time;
282     da_al_get_sample_instance_depth al_get_sample_instance_depth;
283     da_al_get_sample_instance_channels al_get_sample_instance_channels;
284     da_al_get_sample_instance_playmode al_get_sample_instance_playmode;
285     da_al_get_sample_instance_playing al_get_sample_instance_playing;
286     da_al_get_sample_instance_attached al_get_sample_instance_attached;
287     da_al_set_sample_instance_position al_set_sample_instance_position;
288     da_al_set_sample_instance_length al_set_sample_instance_length;
289     da_al_set_sample_instance_speed al_set_sample_instance_speed;
290     da_al_set_sample_instance_gain al_set_sample_instance_gain;
291     da_al_set_sample_instance_pan al_set_sample_instance_pan;
292     da_al_set_sample_instance_playmode al_set_sample_instance_playmode;
293     da_al_set_sample_instance_playing al_set_sample_instance_playing;
294     da_al_detach_sample_instance al_detach_sample_instance;
295     da_al_set_sample al_set_sample;
296     da_al_get_sample al_get_sample;
297     da_al_play_sample_instance al_play_sample_instance;
298     da_al_stop_sample_instance al_stop_sample_instance;
299     da_al_create_audio_stream al_create_audio_stream;
300     da_al_destroy_audio_stream al_destroy_audio_stream;
301     da_al_drain_audio_stream al_drain_audio_stream;
302     da_al_get_audio_stream_frequency al_get_audio_stream_frequency;
303     da_al_get_audio_stream_length al_get_audio_stream_length;
304     da_al_get_audio_stream_fragments al_get_audio_stream_fragments;
305     da_al_get_available_audio_stream_fragments al_get_available_audio_stream_fragments;
306     da_al_get_audio_stream_speed al_get_audio_stream_speed;
307     da_al_get_audio_stream_gain al_get_audio_stream_gain;
308     da_al_get_audio_stream_pan al_get_audio_stream_pan;
309     da_al_get_audio_stream_channels al_get_audio_stream_channels;
310     da_al_get_audio_stream_depth al_get_audio_stream_depth;
311     da_al_get_audio_stream_playmode al_get_audio_stream_playmode;
312     da_al_get_audio_stream_playing al_get_audio_stream_playing;
313     da_al_get_audio_stream_attached al_get_audio_stream_attached;
314     da_al_get_audio_stream_played_samples al_get_audio_stream_played_samples;
315     da_al_get_audio_stream_fragment al_get_audio_stream_fragment;
316     da_al_set_audio_stream_speed al_set_audio_stream_speed;
317     da_al_set_audio_stream_gain al_set_audio_stream_gain;
318     da_al_set_audio_stream_pan al_set_audio_stream_pan;
319     da_al_set_audio_stream_playmode al_set_audio_stream_playmode;
320     da_al_set_audio_stream_playing al_set_audio_stream_playing;
321     da_al_detach_audio_stream al_detach_audio_stream;
322     da_al_set_audio_stream_fragment al_set_audio_stream_fragment;
323     da_al_rewind_audio_stream al_rewind_audio_stream;
324     da_al_seek_audio_stream_secs al_seek_audio_stream_secs;
325     da_al_get_audio_stream_position_secs al_get_audio_stream_position_secs;
326     da_al_get_audio_stream_length_secs al_get_audio_stream_length_secs;
327     da_al_set_audio_stream_loop_secs al_set_audio_stream_loop_secs;
328     da_al_get_audio_stream_event_source al_get_audio_stream_event_source;
329     da_al_create_mixer al_create_mixer;
330     da_al_destroy_mixer al_destroy_mixer;
331     da_al_attach_sample_instance_to_mixer al_attach_sample_instance_to_mixer;
332     da_al_attach_audio_stream_to_mixer al_attach_audio_stream_to_mixer;
333     da_al_attach_mixer_to_mixer al_attach_mixer_to_mixer;
334     da_al_set_mixer_postprocess_callback al_set_mixer_postprocess_callback;
335     da_al_get_mixer_frequency al_get_mixer_frequency;
336     da_al_get_mixer_channels al_get_mixer_channels;
337     da_al_get_mixer_depth al_get_mixer_depth;
338     da_al_get_mixer_quality al_get_mixer_quality;
339     da_al_get_mixer_gain al_get_mixer_gain;
340     da_al_get_mixer_playing al_get_mixer_playing;
341     da_al_get_mixer_attached al_get_mixer_attached;
342     da_al_set_mixer_frequency al_set_mixer_frequency;
343     da_al_set_mixer_quality al_set_mixer_quality;
344     da_al_set_mixer_gain al_set_mixer_gain;
345     da_al_set_mixer_playing al_set_mixer_playing;
346     da_al_detach_mixer al_detach_mixer;
347     da_al_create_voice al_create_voice;
348     da_al_destroy_voice al_destroy_voice;
349     da_al_attach_sample_instance_to_voice al_attach_sample_instance_to_voice;
350     da_al_attach_audio_stream_to_voice al_attach_audio_stream_to_voice;
351     da_al_attach_mixer_to_voice al_attach_mixer_to_voice;
352     da_al_detach_voice al_detach_voice;
353     da_al_get_voice_frequency al_get_voice_frequency;
354     da_al_get_voice_position al_get_voice_position;
355     da_al_get_voice_channels al_get_voice_channels;
356     da_al_get_voice_depth al_get_voice_depth;
357     da_al_get_voice_playing al_get_voice_playing;
358     da_al_set_voice_position al_set_voice_position;
359     da_al_set_voice_playing al_set_voice_playing;
360     da_al_install_audio al_install_audio;
361     da_al_uninstall_audio al_uninstall_audio;
362     da_al_is_audio_installed al_is_audio_installed;
363     da_al_get_allegro_audio_version al_get_allegro_audio_version;
364     da_al_get_channel_count al_get_channel_count;
365     da_al_get_audio_depth_size al_get_audio_depth_size;
366     da_al_reserve_samples al_reserve_samples;
367     da_al_get_default_mixer al_get_default_mixer;
368     da_al_set_default_mixer al_set_default_mixer;
369     da_al_restore_default_mixer al_restore_default_mixer;
370     da_al_play_sample al_play_sample;
371     da_al_stop_sample al_stop_sample;
372     da_al_stop_samples al_stop_samples;
373     da_al_get_default_voice al_get_default_voice;
374     da_al_set_default_voice al_set_default_voice;
375     da_al_register_sample_loader al_register_sample_loader;
376     da_al_register_sample_saver al_register_sample_saver;
377     da_al_register_audio_stream_loader al_register_audio_stream_loader;
378     da_al_register_sample_loader_f al_register_sample_loader_f;
379     da_al_register_sample_saver_f al_register_sample_saver_f;
380     da_al_register_audio_stream_loader_f al_register_audio_stream_loader_f;
381     da_al_load_sample al_load_sample;
382     da_al_save_sample al_save_sample;
383     da_al_load_audio_stream al_load_audio_stream;
384     da_al_load_sample_f al_load_sample_f;
385     da_al_save_sample_f al_save_sample_f;
386     da_al_load_audio_stream_f al_load_audio_stream_f;
387 }
388 
389 class DerelictAllegro5AudioLoader : SharedLibLoader {
390     public this() {
391         super(libNames);
392     }
393 
394     protected override void loadSymbols() {
395         bindFunc(cast(void**)&al_create_sample, "al_create_sample");
396         bindFunc(cast(void**)&al_destroy_sample, "al_destroy_sample");
397         bindFunc(cast(void**)&al_create_sample_instance, "al_create_sample_instance");
398         bindFunc(cast(void**)&al_destroy_sample_instance, "al_destroy_sample_instance");
399         bindFunc(cast(void**)&al_get_sample_frequency, "al_get_sample_frequency");
400         bindFunc(cast(void**)&al_get_sample_length, "al_get_sample_length");
401         bindFunc(cast(void**)&al_get_sample_depth, "al_get_sample_depth");
402         bindFunc(cast(void**)&al_get_sample_channels, "al_get_sample_channels");
403         bindFunc(cast(void**)&al_get_sample_data, "al_get_sample_data");
404         bindFunc(cast(void**)&al_get_sample_instance_frequency, "al_get_sample_instance_frequency");
405         bindFunc(cast(void**)&al_get_sample_instance_length, "al_get_sample_instance_length");
406         bindFunc(cast(void**)&al_get_sample_instance_position, "al_get_sample_instance_position");
407         bindFunc(cast(void**)&al_get_sample_instance_speed, "al_get_sample_instance_speed");
408         bindFunc(cast(void**)&al_get_sample_instance_gain, "al_get_sample_instance_gain");
409         bindFunc(cast(void**)&al_get_sample_instance_pan, "al_get_sample_instance_pan");
410         bindFunc(cast(void**)&al_get_sample_instance_time, "al_get_sample_instance_time");
411         bindFunc(cast(void**)&al_get_sample_instance_depth, "al_get_sample_instance_depth");
412         bindFunc(cast(void**)&al_get_sample_instance_channels, "al_get_sample_instance_channels");
413         bindFunc(cast(void**)&al_get_sample_instance_playmode, "al_get_sample_instance_playmode");
414         bindFunc(cast(void**)&al_get_sample_instance_playing, "al_get_sample_instance_playing");
415         bindFunc(cast(void**)&al_get_sample_instance_attached, "al_get_sample_instance_attached");
416         bindFunc(cast(void**)&al_set_sample_instance_position, "al_set_sample_instance_position");
417         bindFunc(cast(void**)&al_set_sample_instance_length, "al_set_sample_instance_length");
418         bindFunc(cast(void**)&al_set_sample_instance_speed, "al_set_sample_instance_speed");
419         bindFunc(cast(void**)&al_set_sample_instance_gain, "al_set_sample_instance_gain");
420         bindFunc(cast(void**)&al_set_sample_instance_pan, "al_set_sample_instance_pan");
421         bindFunc(cast(void**)&al_set_sample_instance_playmode, "al_set_sample_instance_playmode");
422         bindFunc(cast(void**)&al_set_sample_instance_playing, "al_set_sample_instance_playing");
423         bindFunc(cast(void**)&al_detach_sample_instance, "al_detach_sample_instance");
424         bindFunc(cast(void**)&al_set_sample, "al_set_sample");
425         bindFunc(cast(void**)&al_get_sample, "al_get_sample");
426         bindFunc(cast(void**)&al_play_sample_instance, "al_play_sample_instance");
427         bindFunc(cast(void**)&al_stop_sample_instance, "al_stop_sample_instance");
428         bindFunc(cast(void**)&al_create_audio_stream, "al_create_audio_stream");
429         bindFunc(cast(void**)&al_destroy_audio_stream, "al_destroy_audio_stream");
430         bindFunc(cast(void**)&al_drain_audio_stream, "al_drain_audio_stream");
431         bindFunc(cast(void**)&al_get_audio_stream_frequency, "al_get_audio_stream_frequency");
432         bindFunc(cast(void**)&al_get_audio_stream_length, "al_get_audio_stream_length");
433         bindFunc(cast(void**)&al_get_audio_stream_fragments, "al_get_audio_stream_fragments");
434         bindFunc(cast(void**)&al_get_available_audio_stream_fragments, "al_get_available_audio_stream_fragments");
435         bindFunc(cast(void**)&al_get_audio_stream_speed, "al_get_audio_stream_speed");
436         bindFunc(cast(void**)&al_get_audio_stream_gain, "al_get_audio_stream_gain");
437         bindFunc(cast(void**)&al_get_audio_stream_pan, "al_get_audio_stream_pan");
438         bindFunc(cast(void**)&al_get_audio_stream_channels, "al_get_audio_stream_channels");
439         bindFunc(cast(void**)&al_get_audio_stream_depth, "al_get_audio_stream_depth");
440         bindFunc(cast(void**)&al_get_audio_stream_playmode, "al_get_audio_stream_playmode");
441         bindFunc(cast(void**)&al_get_audio_stream_playing, "al_get_audio_stream_playing");
442         bindFunc(cast(void**)&al_get_audio_stream_attached, "al_get_audio_stream_attached");
443         bindFunc(cast(void**)&al_get_audio_stream_played_samples, "al_get_audio_stream_played_samples");
444         bindFunc(cast(void**)&al_get_audio_stream_fragment, "al_get_audio_stream_fragment");
445         bindFunc(cast(void**)&al_set_audio_stream_speed, "al_set_audio_stream_speed");
446         bindFunc(cast(void**)&al_set_audio_stream_gain, "al_set_audio_stream_gain");
447         bindFunc(cast(void**)&al_set_audio_stream_pan, "al_set_audio_stream_pan");
448         bindFunc(cast(void**)&al_set_audio_stream_playmode, "al_set_audio_stream_playmode");
449         bindFunc(cast(void**)&al_set_audio_stream_playing, "al_set_audio_stream_playing");
450         bindFunc(cast(void**)&al_detach_audio_stream, "al_detach_audio_stream");
451         bindFunc(cast(void**)&al_set_audio_stream_fragment, "al_set_audio_stream_fragment");
452         bindFunc(cast(void**)&al_rewind_audio_stream, "al_rewind_audio_stream");
453         bindFunc(cast(void**)&al_seek_audio_stream_secs, "al_seek_audio_stream_secs");
454         bindFunc(cast(void**)&al_get_audio_stream_position_secs, "al_get_audio_stream_position_secs");
455         bindFunc(cast(void**)&al_get_audio_stream_length_secs, "al_get_audio_stream_length_secs");
456         bindFunc(cast(void**)&al_set_audio_stream_loop_secs, "al_set_audio_stream_loop_secs");
457         bindFunc(cast(void**)&al_get_audio_stream_event_source, "al_get_audio_stream_event_source");
458         bindFunc(cast(void**)&al_create_mixer, "al_create_mixer");
459         bindFunc(cast(void**)&al_destroy_mixer, "al_destroy_mixer");
460         bindFunc(cast(void**)&al_attach_sample_instance_to_mixer, "al_attach_sample_instance_to_mixer");
461         bindFunc(cast(void**)&al_attach_audio_stream_to_mixer, "al_attach_audio_stream_to_mixer");
462         bindFunc(cast(void**)&al_attach_mixer_to_mixer, "al_attach_mixer_to_mixer");
463         bindFunc(cast(void**)&al_set_mixer_postprocess_callback, "al_set_mixer_postprocess_callback");
464         bindFunc(cast(void**)&al_get_mixer_frequency, "al_get_mixer_frequency");
465         bindFunc(cast(void**)&al_get_mixer_channels, "al_get_mixer_channels");
466         bindFunc(cast(void**)&al_get_mixer_depth, "al_get_mixer_depth");
467         bindFunc(cast(void**)&al_get_mixer_quality, "al_get_mixer_quality");
468         bindFunc(cast(void**)&al_get_mixer_gain, "al_get_mixer_gain");
469         bindFunc(cast(void**)&al_get_mixer_playing, "al_get_mixer_playing");
470         bindFunc(cast(void**)&al_get_mixer_attached, "al_get_mixer_attached");
471         bindFunc(cast(void**)&al_set_mixer_frequency, "al_set_mixer_frequency");
472         bindFunc(cast(void**)&al_set_mixer_quality, "al_set_mixer_quality");
473         bindFunc(cast(void**)&al_set_mixer_gain, "al_set_mixer_gain");
474         bindFunc(cast(void**)&al_set_mixer_playing, "al_set_mixer_playing");
475         bindFunc(cast(void**)&al_detach_mixer, "al_detach_mixer");
476         bindFunc(cast(void**)&al_create_voice, "al_create_voice");
477         bindFunc(cast(void**)&al_destroy_voice, "al_destroy_voice");
478         bindFunc(cast(void**)&al_attach_sample_instance_to_voice, "al_attach_sample_instance_to_voice");
479         bindFunc(cast(void**)&al_attach_audio_stream_to_voice, "al_attach_audio_stream_to_voice");
480         bindFunc(cast(void**)&al_attach_mixer_to_voice, "al_attach_mixer_to_voice");
481         bindFunc(cast(void**)&al_detach_voice, "al_detach_voice");
482         bindFunc(cast(void**)&al_get_voice_frequency, "al_get_voice_frequency");
483         bindFunc(cast(void**)&al_get_voice_position, "al_get_voice_position");
484         bindFunc(cast(void**)&al_get_voice_channels, "al_get_voice_channels");
485         bindFunc(cast(void**)&al_get_voice_depth, "al_get_voice_depth");
486         bindFunc(cast(void**)&al_get_voice_playing, "al_get_voice_playing");
487         bindFunc(cast(void**)&al_set_voice_position, "al_set_voice_position");
488         bindFunc(cast(void**)&al_set_voice_playing, "al_set_voice_playing");
489         bindFunc(cast(void**)&al_install_audio, "al_install_audio");
490         bindFunc(cast(void**)&al_uninstall_audio, "al_uninstall_audio");
491         bindFunc(cast(void**)&al_is_audio_installed, "al_is_audio_installed");
492         bindFunc(cast(void**)&al_get_allegro_audio_version, "al_get_allegro_audio_version");
493         bindFunc(cast(void**)&al_get_audio_depth_size, "al_get_audio_depth_size");
494         bindFunc(cast(void**)&al_reserve_samples, "al_reserve_samples");
495         bindFunc(cast(void**)&al_get_default_mixer, "al_get_default_mixer");
496         bindFunc(cast(void**)&al_set_default_mixer, "al_set_default_mixer");
497         bindFunc(cast(void**)&al_restore_default_mixer, "al_restore_default_mixer");
498         bindFunc(cast(void**)&al_play_sample, "al_play_sample");
499         bindFunc(cast(void**)&al_stop_sample, "al_stop_sample");
500         bindFunc(cast(void**)&al_stop_samples, "al_stop_samples");
501         bindFunc(cast(void**)&al_get_default_voice, "al_get_default_voice");
502         bindFunc(cast(void**)&al_set_default_voice, "al_set_default_voice");
503         bindFunc(cast(void**)&al_register_audio_stream_loader, "al_register_audio_stream_loader");
504         bindFunc(cast(void**)&al_register_sample_saver, "al_register_sample_saver");
505         bindFunc(cast(void**)&al_register_sample_loader_f, "al_register_sample_loader_f");
506         bindFunc(cast(void**)&al_register_sample_saver_f, "al_register_sample_saver_f");
507         bindFunc(cast(void**)&al_register_audio_stream_loader_f, "al_register_audio_stream_loader_f");
508         bindFunc(cast(void**)&al_load_sample, "al_load_sample");
509         bindFunc(cast(void**)&al_save_sample, "al_save_sample");
510         bindFunc(cast(void**)&al_load_audio_stream, "al_load_audio_stream");
511         bindFunc(cast(void**)&al_load_sample_f, "al_load_sample_f");
512         bindFunc(cast(void**)&al_save_sample_f, "al_save_sample_f");
513         bindFunc(cast(void**)&al_load_audio_stream_f, "al_load_audio_stream_f");
514     }
515 }
516 
517 __gshared DerelictAllegro5AudioLoader DerelictAllegro5Audio;
518 
519 shared static this() {
520     DerelictAllegro5Audio = new DerelictAllegro5AudioLoader;
521 }