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