sdl2-bindings 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
data/lib/sdl2_mixer.rb CHANGED
@@ -1,317 +1,392 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- SDL_MIXER_MAJOR_VERSION = 2
14
- SDL_MIXER_MINOR_VERSION = 0
15
- SDL_MIXER_PATCHLEVEL = 4
16
- MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION
17
- MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION
18
- MIX_PATCHLEVEL = SDL_MIXER_PATCHLEVEL
19
- MIX_CHANNELS = 8
20
- MIX_DEFAULT_FREQUENCY = 22050
21
- MIX_DEFAULT_FORMAT = AUDIO_S16LSB
22
- MIX_DEFAULT_CHANNELS = 2
23
- MIX_MAX_VOLUME = SDL_MIX_MAXVOLUME
24
- MIX_CHANNEL_POST = -2
25
- MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED"
26
-
27
- # Enum
28
-
29
- MIX_INIT_FLAC = 1
30
- MIX_INIT_MOD = 2
31
- MIX_INIT_MP3 = 8
32
- MIX_INIT_OGG = 16
33
- MIX_INIT_MID = 32
34
- MIX_INIT_OPUS = 64
35
- MIX_NO_FADING = 0
36
- MIX_FADING_OUT = 1
37
- MIX_FADING_IN = 2
38
- MUS_NONE = 0
39
- MUS_CMD = 1
40
- MUS_WAV = 2
41
- MUS_MOD = 3
42
- MUS_MID = 4
43
- MUS_OGG = 5
44
- MUS_MP3 = 6
45
- MUS_MP3_MAD_UNUSED = 7
46
- MUS_FLAC = 8
47
- MUS_MODPLUG_UNUSED = 9
48
- MUS_OPUS = 10
49
-
50
- # Typedef
51
-
52
- typedef :int, :MIX_InitFlags
53
- typedef :int, :Mix_Fading
54
- typedef :int, :Mix_MusicType
55
- callback :Mix_EffectFunc_t, [:int, :pointer, :int, :pointer], :void
56
- callback :Mix_EffectDone_t, [:int, :pointer], :void
57
-
58
- # Struct
59
-
60
- class Mix_Chunk < FFI::Struct
61
- layout(
62
- :allocated, :int,
63
- :abuf, :pointer,
64
- :alen, :uint,
65
- :volume, :uchar,
66
- )
67
- end
68
-
69
-
70
- # Function
71
-
72
- def self.setup_mixer_symbols()
73
- symbols = [
74
- :Mix_Linked_Version,
75
- :Mix_Init,
76
- :Mix_Quit,
77
- :Mix_OpenAudio,
78
- :Mix_OpenAudioDevice,
79
- :Mix_AllocateChannels,
80
- :Mix_QuerySpec,
81
- :Mix_LoadWAV_RW,
82
- :Mix_LoadMUS,
83
- :Mix_LoadMUS_RW,
84
- :Mix_LoadMUSType_RW,
85
- :Mix_QuickLoad_WAV,
86
- :Mix_QuickLoad_RAW,
87
- :Mix_FreeChunk,
88
- :Mix_FreeMusic,
89
- :Mix_GetNumChunkDecoders,
90
- :Mix_GetChunkDecoder,
91
- :Mix_HasChunkDecoder,
92
- :Mix_GetNumMusicDecoders,
93
- :Mix_GetMusicDecoder,
94
- :Mix_HasMusicDecoder,
95
- :Mix_GetMusicType,
96
- :Mix_SetPostMix,
97
- :Mix_HookMusic,
98
- :Mix_HookMusicFinished,
99
- :Mix_GetMusicHookData,
100
- :Mix_ChannelFinished,
101
- :Mix_RegisterEffect,
102
- :Mix_UnregisterEffect,
103
- :Mix_UnregisterAllEffects,
104
- :Mix_SetPanning,
105
- :Mix_SetPosition,
106
- :Mix_SetDistance,
107
- :Mix_SetReverseStereo,
108
- :Mix_ReserveChannels,
109
- :Mix_GroupChannel,
110
- :Mix_GroupChannels,
111
- :Mix_GroupAvailable,
112
- :Mix_GroupCount,
113
- :Mix_GroupOldest,
114
- :Mix_GroupNewer,
115
- :Mix_PlayChannelTimed,
116
- :Mix_PlayMusic,
117
- :Mix_FadeInMusic,
118
- :Mix_FadeInMusicPos,
119
- :Mix_FadeInChannelTimed,
120
- :Mix_Volume,
121
- :Mix_VolumeChunk,
122
- :Mix_VolumeMusic,
123
- :Mix_HaltChannel,
124
- :Mix_HaltGroup,
125
- :Mix_HaltMusic,
126
- :Mix_ExpireChannel,
127
- :Mix_FadeOutChannel,
128
- :Mix_FadeOutGroup,
129
- :Mix_FadeOutMusic,
130
- :Mix_FadingMusic,
131
- :Mix_FadingChannel,
132
- :Mix_Pause,
133
- :Mix_Resume,
134
- :Mix_Paused,
135
- :Mix_PauseMusic,
136
- :Mix_ResumeMusic,
137
- :Mix_RewindMusic,
138
- :Mix_PausedMusic,
139
- :Mix_SetMusicPosition,
140
- :Mix_Playing,
141
- :Mix_PlayingMusic,
142
- :Mix_SetMusicCMD,
143
- :Mix_SetSynchroValue,
144
- :Mix_GetSynchroValue,
145
- :Mix_SetSoundFonts,
146
- :Mix_GetSoundFonts,
147
- :Mix_EachSoundFont,
148
- :Mix_GetChunk,
149
- :Mix_CloseAudio,
150
- ]
151
- args = {
152
- :Mix_Linked_Version => [],
153
- :Mix_Init => [:int],
154
- :Mix_Quit => [],
155
- :Mix_OpenAudio => [:int, :ushort, :int, :int],
156
- :Mix_OpenAudioDevice => [:int, :ushort, :int, :int, :pointer, :int],
157
- :Mix_AllocateChannels => [:int],
158
- :Mix_QuerySpec => [:pointer, :pointer, :pointer],
159
- :Mix_LoadWAV_RW => [:pointer, :int],
160
- :Mix_LoadMUS => [:pointer],
161
- :Mix_LoadMUS_RW => [:pointer, :int],
162
- :Mix_LoadMUSType_RW => [:pointer, :int, :int],
163
- :Mix_QuickLoad_WAV => [:pointer],
164
- :Mix_QuickLoad_RAW => [:pointer, :uint],
165
- :Mix_FreeChunk => [:pointer],
166
- :Mix_FreeMusic => [:pointer],
167
- :Mix_GetNumChunkDecoders => [],
168
- :Mix_GetChunkDecoder => [:int],
169
- :Mix_HasChunkDecoder => [:pointer],
170
- :Mix_GetNumMusicDecoders => [],
171
- :Mix_GetMusicDecoder => [:int],
172
- :Mix_HasMusicDecoder => [:pointer],
173
- :Mix_GetMusicType => [:pointer],
174
- :Mix_SetPostMix => [:pointer, :pointer],
175
- :Mix_HookMusic => [:pointer, :pointer],
176
- :Mix_HookMusicFinished => [:pointer],
177
- :Mix_GetMusicHookData => [],
178
- :Mix_ChannelFinished => [:pointer],
179
- :Mix_RegisterEffect => [:int, :Mix_EffectFunc_t, :Mix_EffectDone_t, :pointer],
180
- :Mix_UnregisterEffect => [:int, :Mix_EffectFunc_t],
181
- :Mix_UnregisterAllEffects => [:int],
182
- :Mix_SetPanning => [:int, :uchar, :uchar],
183
- :Mix_SetPosition => [:int, :short, :uchar],
184
- :Mix_SetDistance => [:int, :uchar],
185
- :Mix_SetReverseStereo => [:int, :int],
186
- :Mix_ReserveChannels => [:int],
187
- :Mix_GroupChannel => [:int, :int],
188
- :Mix_GroupChannels => [:int, :int, :int],
189
- :Mix_GroupAvailable => [:int],
190
- :Mix_GroupCount => [:int],
191
- :Mix_GroupOldest => [:int],
192
- :Mix_GroupNewer => [:int],
193
- :Mix_PlayChannelTimed => [:int, :pointer, :int, :int],
194
- :Mix_PlayMusic => [:pointer, :int],
195
- :Mix_FadeInMusic => [:pointer, :int, :int],
196
- :Mix_FadeInMusicPos => [:pointer, :int, :int, :double],
197
- :Mix_FadeInChannelTimed => [:int, :pointer, :int, :int, :int],
198
- :Mix_Volume => [:int, :int],
199
- :Mix_VolumeChunk => [:pointer, :int],
200
- :Mix_VolumeMusic => [:int],
201
- :Mix_HaltChannel => [:int],
202
- :Mix_HaltGroup => [:int],
203
- :Mix_HaltMusic => [],
204
- :Mix_ExpireChannel => [:int, :int],
205
- :Mix_FadeOutChannel => [:int, :int],
206
- :Mix_FadeOutGroup => [:int, :int],
207
- :Mix_FadeOutMusic => [:int],
208
- :Mix_FadingMusic => [],
209
- :Mix_FadingChannel => [:int],
210
- :Mix_Pause => [:int],
211
- :Mix_Resume => [:int],
212
- :Mix_Paused => [:int],
213
- :Mix_PauseMusic => [],
214
- :Mix_ResumeMusic => [],
215
- :Mix_RewindMusic => [],
216
- :Mix_PausedMusic => [],
217
- :Mix_SetMusicPosition => [:double],
218
- :Mix_Playing => [:int],
219
- :Mix_PlayingMusic => [],
220
- :Mix_SetMusicCMD => [:pointer],
221
- :Mix_SetSynchroValue => [:int],
222
- :Mix_GetSynchroValue => [],
223
- :Mix_SetSoundFonts => [:pointer],
224
- :Mix_GetSoundFonts => [],
225
- :Mix_EachSoundFont => [:pointer, :pointer],
226
- :Mix_GetChunk => [:int],
227
- :Mix_CloseAudio => [],
228
- }
229
- retvals = {
230
- :Mix_Linked_Version => :pointer,
231
- :Mix_Init => :int,
232
- :Mix_Quit => :void,
233
- :Mix_OpenAudio => :int,
234
- :Mix_OpenAudioDevice => :int,
235
- :Mix_AllocateChannels => :int,
236
- :Mix_QuerySpec => :int,
237
- :Mix_LoadWAV_RW => :pointer,
238
- :Mix_LoadMUS => :pointer,
239
- :Mix_LoadMUS_RW => :pointer,
240
- :Mix_LoadMUSType_RW => :pointer,
241
- :Mix_QuickLoad_WAV => :pointer,
242
- :Mix_QuickLoad_RAW => :pointer,
243
- :Mix_FreeChunk => :void,
244
- :Mix_FreeMusic => :void,
245
- :Mix_GetNumChunkDecoders => :int,
246
- :Mix_GetChunkDecoder => :pointer,
247
- :Mix_HasChunkDecoder => :int,
248
- :Mix_GetNumMusicDecoders => :int,
249
- :Mix_GetMusicDecoder => :pointer,
250
- :Mix_HasMusicDecoder => :int,
251
- :Mix_GetMusicType => :int,
252
- :Mix_SetPostMix => :void,
253
- :Mix_HookMusic => :void,
254
- :Mix_HookMusicFinished => :void,
255
- :Mix_GetMusicHookData => :pointer,
256
- :Mix_ChannelFinished => :void,
257
- :Mix_RegisterEffect => :int,
258
- :Mix_UnregisterEffect => :int,
259
- :Mix_UnregisterAllEffects => :int,
260
- :Mix_SetPanning => :int,
261
- :Mix_SetPosition => :int,
262
- :Mix_SetDistance => :int,
263
- :Mix_SetReverseStereo => :int,
264
- :Mix_ReserveChannels => :int,
265
- :Mix_GroupChannel => :int,
266
- :Mix_GroupChannels => :int,
267
- :Mix_GroupAvailable => :int,
268
- :Mix_GroupCount => :int,
269
- :Mix_GroupOldest => :int,
270
- :Mix_GroupNewer => :int,
271
- :Mix_PlayChannelTimed => :int,
272
- :Mix_PlayMusic => :int,
273
- :Mix_FadeInMusic => :int,
274
- :Mix_FadeInMusicPos => :int,
275
- :Mix_FadeInChannelTimed => :int,
276
- :Mix_Volume => :int,
277
- :Mix_VolumeChunk => :int,
278
- :Mix_VolumeMusic => :int,
279
- :Mix_HaltChannel => :int,
280
- :Mix_HaltGroup => :int,
281
- :Mix_HaltMusic => :int,
282
- :Mix_ExpireChannel => :int,
283
- :Mix_FadeOutChannel => :int,
284
- :Mix_FadeOutGroup => :int,
285
- :Mix_FadeOutMusic => :int,
286
- :Mix_FadingMusic => :int,
287
- :Mix_FadingChannel => :int,
288
- :Mix_Pause => :void,
289
- :Mix_Resume => :void,
290
- :Mix_Paused => :int,
291
- :Mix_PauseMusic => :void,
292
- :Mix_ResumeMusic => :void,
293
- :Mix_RewindMusic => :void,
294
- :Mix_PausedMusic => :int,
295
- :Mix_SetMusicPosition => :int,
296
- :Mix_Playing => :int,
297
- :Mix_PlayingMusic => :int,
298
- :Mix_SetMusicCMD => :int,
299
- :Mix_SetSynchroValue => :int,
300
- :Mix_GetSynchroValue => :int,
301
- :Mix_SetSoundFonts => :int,
302
- :Mix_GetSoundFonts => :pointer,
303
- :Mix_EachSoundFont => :int,
304
- :Mix_GetChunk => :pointer,
305
- :Mix_CloseAudio => :void,
306
- }
307
- symbols.each do |sym|
308
- begin
309
- attach_function sym, args[sym], retvals[sym]
310
- rescue FFI::NotFoundError => error
311
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
312
- end
313
- end
314
- end
315
-
316
- end
317
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ MIXER_MAJOR_VERSION = 2
14
+ MIXER_MINOR_VERSION = 0
15
+ MIXER_PATCHLEVEL = 4
16
+ MIX_CHANNELS = 8
17
+ MIX_DEFAULT_FREQUENCY = 22050
18
+ MIX_DEFAULT_FORMAT = AUDIO_S16LSB
19
+ MIX_DEFAULT_CHANNELS = 2
20
+ MIX_MAX_VOLUME = MIX_MAXVOLUME
21
+ MIX_CHANNEL_POST = -2
22
+ MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED"
23
+
24
+ # Enum
25
+
26
+ MIX_INIT_FLAC = 1
27
+ MIX_INIT_MOD = 2
28
+ MIX_INIT_MP3 = 8
29
+ MIX_INIT_OGG = 16
30
+ MIX_INIT_MID = 32
31
+ MIX_INIT_OPUS = 64
32
+ MIX_NO_FADING = 0
33
+ MIX_FADING_OUT = 1
34
+ MIX_FADING_IN = 2
35
+ MUS_NONE = 0
36
+ MUS_CMD = 1
37
+ MUS_WAV = 2
38
+ MUS_MOD = 3
39
+ MUS_MID = 4
40
+ MUS_OGG = 5
41
+ MUS_MP3 = 6
42
+ MUS_MP3_MAD_UNUSED = 7
43
+ MUS_FLAC = 8
44
+ MUS_MODPLUG_UNUSED = 9
45
+ MUS_OPUS = 10
46
+
47
+ # Typedef
48
+
49
+ typedef :int, :MIX_InitFlags
50
+ typedef :int, :Mix_Fading
51
+ typedef :int, :Mix_MusicType
52
+ callback :Mix_EffectFunc_t, [:int, :pointer, :int, :pointer], :void
53
+ callback :Mix_EffectDone_t, [:int, :pointer], :void
54
+
55
+ # Struct
56
+
57
+ class Mix_Chunk < FFI::Struct
58
+ layout(
59
+ :allocated, :int,
60
+ :abuf, :pointer,
61
+ :alen, :uint,
62
+ :volume, :uchar,
63
+ )
64
+ end
65
+
66
+
67
+ # Function
68
+
69
+ def self.setup_mixer_symbols(output_error = false)
70
+ symbols = [
71
+ :Mix_Linked_Version,
72
+ :Mix_Init,
73
+ :Mix_Quit,
74
+ :Mix_OpenAudio,
75
+ :Mix_OpenAudioDevice,
76
+ :Mix_AllocateChannels,
77
+ :Mix_QuerySpec,
78
+ :Mix_LoadWAV_RW,
79
+ :Mix_LoadMUS,
80
+ :Mix_LoadMUS_RW,
81
+ :Mix_LoadMUSType_RW,
82
+ :Mix_QuickLoad_WAV,
83
+ :Mix_QuickLoad_RAW,
84
+ :Mix_FreeChunk,
85
+ :Mix_FreeMusic,
86
+ :Mix_GetNumChunkDecoders,
87
+ :Mix_GetChunkDecoder,
88
+ :Mix_HasChunkDecoder,
89
+ :Mix_GetNumMusicDecoders,
90
+ :Mix_GetMusicDecoder,
91
+ :Mix_HasMusicDecoder,
92
+ :Mix_GetMusicType,
93
+ :Mix_SetPostMix,
94
+ :Mix_HookMusic,
95
+ :Mix_HookMusicFinished,
96
+ :Mix_GetMusicHookData,
97
+ :Mix_ChannelFinished,
98
+ :Mix_RegisterEffect,
99
+ :Mix_UnregisterEffect,
100
+ :Mix_UnregisterAllEffects,
101
+ :Mix_SetPanning,
102
+ :Mix_SetPosition,
103
+ :Mix_SetDistance,
104
+ :Mix_SetReverseStereo,
105
+ :Mix_ReserveChannels,
106
+ :Mix_GroupChannel,
107
+ :Mix_GroupChannels,
108
+ :Mix_GroupAvailable,
109
+ :Mix_GroupCount,
110
+ :Mix_GroupOldest,
111
+ :Mix_GroupNewer,
112
+ :Mix_PlayChannelTimed,
113
+ :Mix_PlayMusic,
114
+ :Mix_FadeInMusic,
115
+ :Mix_FadeInMusicPos,
116
+ :Mix_FadeInChannelTimed,
117
+ :Mix_Volume,
118
+ :Mix_VolumeChunk,
119
+ :Mix_VolumeMusic,
120
+ :Mix_HaltChannel,
121
+ :Mix_HaltGroup,
122
+ :Mix_HaltMusic,
123
+ :Mix_ExpireChannel,
124
+ :Mix_FadeOutChannel,
125
+ :Mix_FadeOutGroup,
126
+ :Mix_FadeOutMusic,
127
+ :Mix_FadingMusic,
128
+ :Mix_FadingChannel,
129
+ :Mix_Pause,
130
+ :Mix_Resume,
131
+ :Mix_Paused,
132
+ :Mix_PauseMusic,
133
+ :Mix_ResumeMusic,
134
+ :Mix_RewindMusic,
135
+ :Mix_PausedMusic,
136
+ :Mix_SetMusicPosition,
137
+ :Mix_Playing,
138
+ :Mix_PlayingMusic,
139
+ :Mix_SetMusicCMD,
140
+ :Mix_SetSynchroValue,
141
+ :Mix_GetSynchroValue,
142
+ :Mix_SetSoundFonts,
143
+ :Mix_GetSoundFonts,
144
+ :Mix_EachSoundFont,
145
+ :Mix_GetChunk,
146
+ :Mix_CloseAudio,
147
+ ]
148
+ apis = {
149
+ :Mix_Linked_Version => :Mix_Linked_Version,
150
+ :Mix_Init => :Mix_Init,
151
+ :Mix_Quit => :Mix_Quit,
152
+ :Mix_OpenAudio => :Mix_OpenAudio,
153
+ :Mix_OpenAudioDevice => :Mix_OpenAudioDevice,
154
+ :Mix_AllocateChannels => :Mix_AllocateChannels,
155
+ :Mix_QuerySpec => :Mix_QuerySpec,
156
+ :Mix_LoadWAV_RW => :Mix_LoadWAV_RW,
157
+ :Mix_LoadMUS => :Mix_LoadMUS,
158
+ :Mix_LoadMUS_RW => :Mix_LoadMUS_RW,
159
+ :Mix_LoadMUSType_RW => :Mix_LoadMUSType_RW,
160
+ :Mix_QuickLoad_WAV => :Mix_QuickLoad_WAV,
161
+ :Mix_QuickLoad_RAW => :Mix_QuickLoad_RAW,
162
+ :Mix_FreeChunk => :Mix_FreeChunk,
163
+ :Mix_FreeMusic => :Mix_FreeMusic,
164
+ :Mix_GetNumChunkDecoders => :Mix_GetNumChunkDecoders,
165
+ :Mix_GetChunkDecoder => :Mix_GetChunkDecoder,
166
+ :Mix_HasChunkDecoder => :Mix_HasChunkDecoder,
167
+ :Mix_GetNumMusicDecoders => :Mix_GetNumMusicDecoders,
168
+ :Mix_GetMusicDecoder => :Mix_GetMusicDecoder,
169
+ :Mix_HasMusicDecoder => :Mix_HasMusicDecoder,
170
+ :Mix_GetMusicType => :Mix_GetMusicType,
171
+ :Mix_SetPostMix => :Mix_SetPostMix,
172
+ :Mix_HookMusic => :Mix_HookMusic,
173
+ :Mix_HookMusicFinished => :Mix_HookMusicFinished,
174
+ :Mix_GetMusicHookData => :Mix_GetMusicHookData,
175
+ :Mix_ChannelFinished => :Mix_ChannelFinished,
176
+ :Mix_RegisterEffect => :Mix_RegisterEffect,
177
+ :Mix_UnregisterEffect => :Mix_UnregisterEffect,
178
+ :Mix_UnregisterAllEffects => :Mix_UnregisterAllEffects,
179
+ :Mix_SetPanning => :Mix_SetPanning,
180
+ :Mix_SetPosition => :Mix_SetPosition,
181
+ :Mix_SetDistance => :Mix_SetDistance,
182
+ :Mix_SetReverseStereo => :Mix_SetReverseStereo,
183
+ :Mix_ReserveChannels => :Mix_ReserveChannels,
184
+ :Mix_GroupChannel => :Mix_GroupChannel,
185
+ :Mix_GroupChannels => :Mix_GroupChannels,
186
+ :Mix_GroupAvailable => :Mix_GroupAvailable,
187
+ :Mix_GroupCount => :Mix_GroupCount,
188
+ :Mix_GroupOldest => :Mix_GroupOldest,
189
+ :Mix_GroupNewer => :Mix_GroupNewer,
190
+ :Mix_PlayChannelTimed => :Mix_PlayChannelTimed,
191
+ :Mix_PlayMusic => :Mix_PlayMusic,
192
+ :Mix_FadeInMusic => :Mix_FadeInMusic,
193
+ :Mix_FadeInMusicPos => :Mix_FadeInMusicPos,
194
+ :Mix_FadeInChannelTimed => :Mix_FadeInChannelTimed,
195
+ :Mix_Volume => :Mix_Volume,
196
+ :Mix_VolumeChunk => :Mix_VolumeChunk,
197
+ :Mix_VolumeMusic => :Mix_VolumeMusic,
198
+ :Mix_HaltChannel => :Mix_HaltChannel,
199
+ :Mix_HaltGroup => :Mix_HaltGroup,
200
+ :Mix_HaltMusic => :Mix_HaltMusic,
201
+ :Mix_ExpireChannel => :Mix_ExpireChannel,
202
+ :Mix_FadeOutChannel => :Mix_FadeOutChannel,
203
+ :Mix_FadeOutGroup => :Mix_FadeOutGroup,
204
+ :Mix_FadeOutMusic => :Mix_FadeOutMusic,
205
+ :Mix_FadingMusic => :Mix_FadingMusic,
206
+ :Mix_FadingChannel => :Mix_FadingChannel,
207
+ :Mix_Pause => :Mix_Pause,
208
+ :Mix_Resume => :Mix_Resume,
209
+ :Mix_Paused => :Mix_Paused,
210
+ :Mix_PauseMusic => :Mix_PauseMusic,
211
+ :Mix_ResumeMusic => :Mix_ResumeMusic,
212
+ :Mix_RewindMusic => :Mix_RewindMusic,
213
+ :Mix_PausedMusic => :Mix_PausedMusic,
214
+ :Mix_SetMusicPosition => :Mix_SetMusicPosition,
215
+ :Mix_Playing => :Mix_Playing,
216
+ :Mix_PlayingMusic => :Mix_PlayingMusic,
217
+ :Mix_SetMusicCMD => :Mix_SetMusicCMD,
218
+ :Mix_SetSynchroValue => :Mix_SetSynchroValue,
219
+ :Mix_GetSynchroValue => :Mix_GetSynchroValue,
220
+ :Mix_SetSoundFonts => :Mix_SetSoundFonts,
221
+ :Mix_GetSoundFonts => :Mix_GetSoundFonts,
222
+ :Mix_EachSoundFont => :Mix_EachSoundFont,
223
+ :Mix_GetChunk => :Mix_GetChunk,
224
+ :Mix_CloseAudio => :Mix_CloseAudio,
225
+ }
226
+ args = {
227
+ :Mix_Linked_Version => [],
228
+ :Mix_Init => [:int],
229
+ :Mix_Quit => [],
230
+ :Mix_OpenAudio => [:int, :ushort, :int, :int],
231
+ :Mix_OpenAudioDevice => [:int, :ushort, :int, :int, :pointer, :int],
232
+ :Mix_AllocateChannels => [:int],
233
+ :Mix_QuerySpec => [:pointer, :pointer, :pointer],
234
+ :Mix_LoadWAV_RW => [:pointer, :int],
235
+ :Mix_LoadMUS => [:pointer],
236
+ :Mix_LoadMUS_RW => [:pointer, :int],
237
+ :Mix_LoadMUSType_RW => [:pointer, :int, :int],
238
+ :Mix_QuickLoad_WAV => [:pointer],
239
+ :Mix_QuickLoad_RAW => [:pointer, :uint],
240
+ :Mix_FreeChunk => [:pointer],
241
+ :Mix_FreeMusic => [:pointer],
242
+ :Mix_GetNumChunkDecoders => [],
243
+ :Mix_GetChunkDecoder => [:int],
244
+ :Mix_HasChunkDecoder => [:pointer],
245
+ :Mix_GetNumMusicDecoders => [],
246
+ :Mix_GetMusicDecoder => [:int],
247
+ :Mix_HasMusicDecoder => [:pointer],
248
+ :Mix_GetMusicType => [:pointer],
249
+ :Mix_SetPostMix => [:pointer, :pointer],
250
+ :Mix_HookMusic => [:pointer, :pointer],
251
+ :Mix_HookMusicFinished => [:pointer],
252
+ :Mix_GetMusicHookData => [],
253
+ :Mix_ChannelFinished => [:pointer],
254
+ :Mix_RegisterEffect => [:int, :Mix_EffectFunc_t, :Mix_EffectDone_t, :pointer],
255
+ :Mix_UnregisterEffect => [:int, :Mix_EffectFunc_t],
256
+ :Mix_UnregisterAllEffects => [:int],
257
+ :Mix_SetPanning => [:int, :uchar, :uchar],
258
+ :Mix_SetPosition => [:int, :short, :uchar],
259
+ :Mix_SetDistance => [:int, :uchar],
260
+ :Mix_SetReverseStereo => [:int, :int],
261
+ :Mix_ReserveChannels => [:int],
262
+ :Mix_GroupChannel => [:int, :int],
263
+ :Mix_GroupChannels => [:int, :int, :int],
264
+ :Mix_GroupAvailable => [:int],
265
+ :Mix_GroupCount => [:int],
266
+ :Mix_GroupOldest => [:int],
267
+ :Mix_GroupNewer => [:int],
268
+ :Mix_PlayChannelTimed => [:int, :pointer, :int, :int],
269
+ :Mix_PlayMusic => [:pointer, :int],
270
+ :Mix_FadeInMusic => [:pointer, :int, :int],
271
+ :Mix_FadeInMusicPos => [:pointer, :int, :int, :double],
272
+ :Mix_FadeInChannelTimed => [:int, :pointer, :int, :int, :int],
273
+ :Mix_Volume => [:int, :int],
274
+ :Mix_VolumeChunk => [:pointer, :int],
275
+ :Mix_VolumeMusic => [:int],
276
+ :Mix_HaltChannel => [:int],
277
+ :Mix_HaltGroup => [:int],
278
+ :Mix_HaltMusic => [],
279
+ :Mix_ExpireChannel => [:int, :int],
280
+ :Mix_FadeOutChannel => [:int, :int],
281
+ :Mix_FadeOutGroup => [:int, :int],
282
+ :Mix_FadeOutMusic => [:int],
283
+ :Mix_FadingMusic => [],
284
+ :Mix_FadingChannel => [:int],
285
+ :Mix_Pause => [:int],
286
+ :Mix_Resume => [:int],
287
+ :Mix_Paused => [:int],
288
+ :Mix_PauseMusic => [],
289
+ :Mix_ResumeMusic => [],
290
+ :Mix_RewindMusic => [],
291
+ :Mix_PausedMusic => [],
292
+ :Mix_SetMusicPosition => [:double],
293
+ :Mix_Playing => [:int],
294
+ :Mix_PlayingMusic => [],
295
+ :Mix_SetMusicCMD => [:pointer],
296
+ :Mix_SetSynchroValue => [:int],
297
+ :Mix_GetSynchroValue => [],
298
+ :Mix_SetSoundFonts => [:pointer],
299
+ :Mix_GetSoundFonts => [],
300
+ :Mix_EachSoundFont => [:pointer, :pointer],
301
+ :Mix_GetChunk => [:int],
302
+ :Mix_CloseAudio => [],
303
+ }
304
+ retvals = {
305
+ :Mix_Linked_Version => :pointer,
306
+ :Mix_Init => :int,
307
+ :Mix_Quit => :void,
308
+ :Mix_OpenAudio => :int,
309
+ :Mix_OpenAudioDevice => :int,
310
+ :Mix_AllocateChannels => :int,
311
+ :Mix_QuerySpec => :int,
312
+ :Mix_LoadWAV_RW => :pointer,
313
+ :Mix_LoadMUS => :pointer,
314
+ :Mix_LoadMUS_RW => :pointer,
315
+ :Mix_LoadMUSType_RW => :pointer,
316
+ :Mix_QuickLoad_WAV => :pointer,
317
+ :Mix_QuickLoad_RAW => :pointer,
318
+ :Mix_FreeChunk => :void,
319
+ :Mix_FreeMusic => :void,
320
+ :Mix_GetNumChunkDecoders => :int,
321
+ :Mix_GetChunkDecoder => :pointer,
322
+ :Mix_HasChunkDecoder => :int,
323
+ :Mix_GetNumMusicDecoders => :int,
324
+ :Mix_GetMusicDecoder => :pointer,
325
+ :Mix_HasMusicDecoder => :int,
326
+ :Mix_GetMusicType => :int,
327
+ :Mix_SetPostMix => :void,
328
+ :Mix_HookMusic => :void,
329
+ :Mix_HookMusicFinished => :void,
330
+ :Mix_GetMusicHookData => :pointer,
331
+ :Mix_ChannelFinished => :void,
332
+ :Mix_RegisterEffect => :int,
333
+ :Mix_UnregisterEffect => :int,
334
+ :Mix_UnregisterAllEffects => :int,
335
+ :Mix_SetPanning => :int,
336
+ :Mix_SetPosition => :int,
337
+ :Mix_SetDistance => :int,
338
+ :Mix_SetReverseStereo => :int,
339
+ :Mix_ReserveChannels => :int,
340
+ :Mix_GroupChannel => :int,
341
+ :Mix_GroupChannels => :int,
342
+ :Mix_GroupAvailable => :int,
343
+ :Mix_GroupCount => :int,
344
+ :Mix_GroupOldest => :int,
345
+ :Mix_GroupNewer => :int,
346
+ :Mix_PlayChannelTimed => :int,
347
+ :Mix_PlayMusic => :int,
348
+ :Mix_FadeInMusic => :int,
349
+ :Mix_FadeInMusicPos => :int,
350
+ :Mix_FadeInChannelTimed => :int,
351
+ :Mix_Volume => :int,
352
+ :Mix_VolumeChunk => :int,
353
+ :Mix_VolumeMusic => :int,
354
+ :Mix_HaltChannel => :int,
355
+ :Mix_HaltGroup => :int,
356
+ :Mix_HaltMusic => :int,
357
+ :Mix_ExpireChannel => :int,
358
+ :Mix_FadeOutChannel => :int,
359
+ :Mix_FadeOutGroup => :int,
360
+ :Mix_FadeOutMusic => :int,
361
+ :Mix_FadingMusic => :int,
362
+ :Mix_FadingChannel => :int,
363
+ :Mix_Pause => :void,
364
+ :Mix_Resume => :void,
365
+ :Mix_Paused => :int,
366
+ :Mix_PauseMusic => :void,
367
+ :Mix_ResumeMusic => :void,
368
+ :Mix_RewindMusic => :void,
369
+ :Mix_PausedMusic => :int,
370
+ :Mix_SetMusicPosition => :int,
371
+ :Mix_Playing => :int,
372
+ :Mix_PlayingMusic => :int,
373
+ :Mix_SetMusicCMD => :int,
374
+ :Mix_SetSynchroValue => :int,
375
+ :Mix_GetSynchroValue => :int,
376
+ :Mix_SetSoundFonts => :int,
377
+ :Mix_GetSoundFonts => :pointer,
378
+ :Mix_EachSoundFont => :int,
379
+ :Mix_GetChunk => :pointer,
380
+ :Mix_CloseAudio => :void,
381
+ }
382
+ symbols.each do |sym|
383
+ begin
384
+ attach_function apis[sym], sym, args[sym], retvals[sym]
385
+ rescue FFI::NotFoundError => error
386
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
387
+ end
388
+ end
389
+ end
390
+
391
+ end
392
+