1 [CCode (cheader_filename="SDL_mixer.h")]
3 [CCode (cname="Mix_Linked_Version")]
4 public static unowned SDL.Version linked();
6 [CCode (cname="Mix_OpenAudio")]
7 public static int open(int frequency, uint16 format, int channels, int chunksize);
9 [CCode (cname="Mix_CloseAudio")]
10 public static void close();
12 [CCode (cname="Mix_QuerySpec")]
13 public static int query(ref int frequency, ref uint16 format, ref int channels);
15 [CCode (cname="Mix_SetPostMix")]
16 public static void set_post_mixer(MixFunction f, void* arg);
18 [CCode (cname="Mix_SetSynchroValue")]
19 public static int set_synchro_value(int value);
21 [CCode (cname="Mix_GetSynchroValue")]
22 public static int get_synchro_value();
24 public delegate void MixFunction(void* udata, uchar[] stream);
25 public delegate void MusicFinishedCallback();
26 public delegate void ChannelFinishedCallback(int channel);
27 public delegate void EffectCallback(int chan, void* stream, int len, void* udata);
28 public delegate void EffectDoneCallback(int chan, void* udata);
30 [CCode (cname="int", cprefix="MIX_", has_type_id = false)]
31 public enum FadeStatus {
32 NO_FADING, FADING_OUT, FADING_IN
35 [CCode (cname="int", cprefix="MUS_", has_type_id = false)]
36 public enum MusicType {
37 NONE, CMD, WAV, MOD, MID, OGG, MP3, MP3_MAD
40 [CCode (cname="Mix_Chunk", free_function="Mix_FreeChunk")]
43 [CCode (cname="Mix_LoadWAV_RW")]
44 public Chunk.WAV(SDL.RWops src, int freesrc=0);
46 [CCode (cname="Mix_QuickLoad_WAV")]
47 public Chunk.QuickWAV([CCode (array_length = false)] uchar[] mem);
49 [CCode (cname="Mix_QuickLoad_RAW")]
50 public Chunk.QuickRAW(uchar[] mem);
52 [CCode (cname="Mix_VolumeChunk")]
53 public int volume(int num);
56 [CCode (cname="Mix_Music", free_function="Mix_FreeMusic")]
59 [CCode (cname="Mix_GetMusicHookData")]
60 public static void* get_hook_data();
62 [CCode (cname="Mix_HookMusic")]
63 public static void hook_mixer(MixFunction? f, void* arg);
65 [CCode (cname="Mix_HookMusicFinished")]
66 public static void hook_finished(MusicFinishedCallback cb);
68 [CCode (cname="Mix_FadeOutMusic")]
69 public static int fade_out(int ms);
71 [CCode (cname="Mix_FadingMusic")]
72 public static FadeStatus is_fading();
74 [CCode (cname="Mix_VolumeMusic")]
75 public static int volume(int num);
77 [CCode (cname="Mix_HaltMusic")]
78 public static int halt();
80 [CCode (cname="Mix_PauseMusic")]
81 public static void pause();
83 [CCode (cname="Mix_ResumeMusic")]
84 public static void resume();
86 [CCode (cname="Mix_RewindMusic")]
87 public static void rewind();
89 [CCode (cname="Mix_PausedMusic")]
90 public static int is_paused();
92 [CCode (cname="Mix_SetMusicPosition")]
93 public static int position(double position);
95 [CCode (cname="Mix_PlayingMusic")]
96 public static int is_playing();
98 [CCode (cname="Mix_SetMusicCMD")]
99 public static int set_play_command(string command);
101 [CCode (cname="Mix_LoadMUS")]
102 public Music(string file);
104 [CCode (cname="Mix_LoadMUS_RW")]
105 public Music.RW(SDL.RWops rw);
107 [CCode (cname="Mix_GetMusicType")]
108 public MusicType type();
110 [CCode (cname="Mix_PlayMusic")]
111 public int play(int loops);
113 [CCode (cname="Mix_FadeInMusicPos")]
114 public int fade_in(int loops, int ms, double position=0.0);
118 public class Effect {
119 [CCode (cname="Mix_RegisterEffect")]
120 public static int register(int chan, EffectCallback f,
121 EffectDoneCallback? d, void* arg);
123 [CCode (cname="Mix_UnregisterEffect")]
124 public static int unregister(int chan, EffectCallback f);
126 [CCode (cname="Mix_UnregisterAllEffects")]
127 public static int unregister_all(int channel);
130 [CCode (cname="int", has_type_id = false)]
132 public struct Channel: int {
133 [CCode (cname="Mix_AllocateChannels")]
134 public static int allocate(int num_channels);
136 [CCode (cname="Mix_ReserveChannels")]
137 public static int reserve(int num_channels);
139 [CCode (cname="Mix_ChannelFinished")]
140 public static void hook_finished(ChannelFinishedCallback? cb);
142 [CCode (cname="Mix_SetPanning")]
143 public int pan(uchar left, uchar right);
145 [CCode (cname="Mix_SetPosition")]
146 public int position(int16 degrees, uchar distance);
148 [CCode (cname="Mix_SetDistance")]
149 public int distance(uchar distance);
151 [CCode (cname="Mix_SetReverseStereo")]
152 public int reverse_stereo(int flip);
154 [CCode (cname="Mix_PlayChannelTimed")]
155 public int play(Chunk chunk, int loops, int ticks=-1);
157 [CCode (cname="Mix_FadeInChannelTimed")]
158 public int fade_in(Chunk chunk, int loops, int ms, int ticks=-1);
160 [CCode (cname="Mix_FadeOutChannelTimed")]
161 public int fade_out(int ms);
163 [CCode (cname="Mix_FadingChannel")]
164 public FadeStatus is_fading();
166 [CCode (cname="Mix_Volume")]
167 public int volume(int num);
169 [CCode (cname="Mix_HaltChannel")]
172 [CCode (cname="Mix_ExpireChannel")]
173 public int expire(int ticks);
175 [CCode (cname="Mix_Pause")]
178 [CCode (cname="Mix_Paused")]
179 public int is_paused();
181 [CCode (cname="Mix_Resume")]
182 public void resume();
184 [CCode (cname="Mix_Playing")]
185 public int is_playing();
187 [CCode (cname="Mix_GetChunk")]
188 public Chunk? get_chunk();
191 [CCode (cname="int", has_type_id = false)]
193 public struct ChannelGroup: int {
194 [CCode (cname="Mix_GroupChannel")]
195 public static int add(int channel, int group);
197 [CCode (cname="Mix_GroupChannels")]
198 public static int add_range(int from_channel, int to_channel, int group);
200 [CCode (cname="Mix_GroupAvailable")]
201 public int first_available();
203 [CCode (cname="Mix_GroupCount")]
206 [CCode (cname="Mix_GroupOldest")]
209 [CCode (cname="Mix_GroupNewer")]
212 [CCode (cname="Mix_HaltGroup")]
215 [CCode (cname="Mix_FadeOutGroup")]
216 public int fade_out(int ms);