sq3: show SQLite error messages on stderr by default
[iv.d.git] / sdl2 / mixer.d
blobaffaf928264fd67b92ad60d47c73ab4d559a2779
1 /*
3 Boost Software License - Version 1.0 - August 17th, 2003
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:
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.
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.
28 module iv.sdl2.mixer /*is aliced*/;
29 pragma(lib, "SDL2_mixer");
31 import iv.sdl2.sdl;
33 enum : ubyte {
34 SDL_MIXER_MAJOR_VERSION = 2,
35 SDL_MIXER_MINOR_VERSION = 0,
36 SDL_MIXER_PATCHLEVEL = 0,
39 alias MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION;
40 alias MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION;
41 alias MIX_PATCH_LEVEL = SDL_MIXER_PATCHLEVEL;
43 void SDL_MIXER_VERSION() (ref SDL_version x) {
44 x.major = SDL_MIXER_MAJOR_VERSION;
45 x.minor = SDL_MIXER_MINOR_VERSION;
46 x.patch = SDL_MIXER_PATCHLEVEL;
49 alias SDL_MIX_VERSION = SDL_MIXER_VERSION;
51 alias Mix_SetError = SDL_SetError;
52 alias Mix_GetError = SDL_GetError;
54 alias MIX_InitFlags = int;
56 enum : int {
57 MIX_INIT_FLAC = 0x00000001,
58 MIX_INIT_MOD = 0x00000002,
59 MIX_INIT_MODPLUG = 0x00000004,
60 MIX_INIT_MP3 = 0x00000008,
61 MIX_INIT_OGG = 0x00000010,
62 MIX_INIT_FLUIDSYNTH = 0x00000020,
65 enum {
66 MIX_CHANNELS = 8,
67 MIX_DEFAULT_FREQUENCY = 22050,
68 MIX_DEFAULT_CHANNELS = 2,
69 MIX_MAX_VOLUME = 128,
70 MIX_CHANNEL_POST = -2,
73 version (LittleEndian) {
74 enum MIX_DEFAULT_FORMAT = AUDIO_S16LSB;
75 } else {
76 enum MIX_DEFAULT_FORMAT = AUDIO_S16MSB;
79 struct Mix_Chunk {
80 int allocated;
81 ubyte* abuf;
82 uint alen;
83 ubyte volume;
86 alias Mix_Fading = int;
88 enum : int {
89 MIX_NO_FADING,
90 MIX_FADING_OUT,
91 MIX_FADING_IN
94 alias Mix_MusicType = int;
96 enum : int {
97 MUS_NONE,
98 MUS_CMD,
99 MUS_WAV,
100 MUS_MOD,
101 MUS_MID,
102 MUS_OGG,
103 MUS_MP3,
104 MUS_MP3_MAD,
105 MUS_FLAC,
106 MUS_MODPLUG,
109 struct Mix_Music;
111 string MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED";
113 nothrow {
114 extern (C) {
115 alias Mix_EffectFunc_t = void function (int chan, void* stream, int len, void* udata);
116 alias Mix_EffectDone_t = void function (int chan, void* udata);
119 @nogc {
120 Mix_Chunk* Mix_LoadWAV (const(char)* file) {
121 return Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1);
124 int Mix_PlayChannel (int channel, Mix_Chunk* chunk, int loops) {
125 return Mix_PlayChannelTimed(channel, chunk, loops, -1);
128 int Mix_FadeInChannel (int channel, Mix_Chunk* chunk, int loops, int ms) {
129 return Mix_FadeInChannelTimed(channel, chunk, loops, ms, -1);
134 extern (C) @nogc nothrow {
135 const(SDL_version)* Mix_Linked_Version ();
136 int Mix_Init (int);
137 void Mix_Quit ();
138 int Mix_OpenAudio (int, ushort, int, int);
139 int Mix_AllocateChannels (int);
140 int Mix_QuerySpec (int*, ushort*, int*);
141 Mix_Chunk* Mix_LoadWAV_RW (SDL_RWops*, int);
142 Mix_Music* Mix_LoadMUS (const(char)*);
143 Mix_Music* Mix_LoadMUS_RW (SDL_RWops*, int);
144 Mix_Music* Mix_LoadMUSType_RW (SDL_RWops*, Mix_MusicType, int);
145 Mix_Chunk* Mix_QuickLoad_WAV (ubyte*);
146 Mix_Chunk* Mix_QuickLoad_RAW (ubyte*, uint);
147 void Mix_FreeChunk (Mix_Chunk*);
148 void Mix_FreeMusic (Mix_Music*);
149 int Mix_GetNumChunkDecoders ();
150 const(char)* Mix_GetChunkDecoder (int);
151 int Mix_GetNumMusicDecoders ();
152 const(char)* Mix_GetMusicDecoder (int);
153 Mix_MusicType Mix_GetMusicType (const(Mix_Music)*);
154 void Mix_SetPostMix (void function(void*, ubyte*, int), void*);
155 void Mix_HookMusic (void function(void*, ubyte*, int), void*);
156 void Mix_HookMusicFinished (void function());
157 void* Mix_GetMusicHookData ();
158 void Mix_ChannelFinished (void function (int channel) nothrow @nogc);
159 int Mix_RegisterEffect (int, Mix_EffectFunc_t, Mix_EffectDone_t, void*);
160 int Mix_UnregisterEffect (int, Mix_EffectFunc_t);
161 int Mix_UnregisterAllEffects (int);
162 int Mix_SetPanning (int, ubyte, ubyte);
163 int Mix_SetPosition (int, short, ubyte);
164 int Mix_SetDistance (int, ubyte);
165 // alias int function(int, ubyte) da_Mix_SetReverb;
166 int Mix_SetReverseStereo (int, int);
167 int Mix_ReserveChannels (int);
168 int Mix_GroupChannel (int, int);
169 int Mix_GroupChannels (int, int, int);
170 int Mix_GroupAvailable (int);
171 int Mix_GroupCount (int);
172 int Mix_GroupOldest (int);
173 int Mix_GroupNewer (int);
174 int Mix_PlayChannelTimed (int, Mix_Chunk*, int, int);
175 int Mix_PlayMusic (Mix_Music*, int);
176 int Mix_FadeInMusic (Mix_Music*, int, int);
177 int Mix_FadeInMusicPos (Mix_Music*, int, int, double);
178 int Mix_FadeInChannelTimed (int, Mix_Chunk*, int, int, int);
179 int Mix_Volume (int, int);
180 int Mix_VolumeChunk (Mix_Chunk*, int);
181 int Mix_VolumeMusic (int);
182 int Mix_HaltChannel (int);
183 int Mix_HaltGroup (int);
184 int Mix_HaltMusic ();
185 int Mix_ExpireChannel (int, int);
186 int Mix_FadeOutChannel (int, int);
187 int Mix_FadeOutGroup (int, int);
188 int Mix_FadeOutMusic (int);
189 Mix_Fading Mix_FadingMusic ();
190 Mix_Fading Mix_FadingChannel (int);
191 void Mix_Pause (int);
192 void Mix_Resume (int);
193 int Mix_Paused (int);
194 void Mix_PauseMusic ();
195 void Mix_ResumeMusic ();
196 void Mix_RewindMusic ();
197 int Mix_PausedMusic ();
198 int Mix_SetMusicPosition (double);
199 int Mix_Playing (int);
200 int Mix_PlayingMusic ();
201 int Mix_SetMusicCMD (const(char)*);
202 int Mix_SetSynchroValue (int);
203 int Mix_GetSynchroValue ();
204 Mix_Chunk* Mix_GetChunk (int);
205 void Mix_CloseAudio ();