ruby-sdl2 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/key.c CHANGED
@@ -65,6 +65,8 @@ static VALUE Key_s_keycode_from_scancode(VALUE self, VALUE scancode)
65
65
  * @overload pressed?(code)
66
66
  * @param [Integer] code scancode
67
67
  *
68
+ * @return [Boolean] true if pressed
69
+ *
68
70
  * Get whether the key of the given scancode is pressed or not.
69
71
  */
70
72
  static VALUE Key_s_pressed_p(VALUE self, VALUE code)
@@ -159,7 +161,7 @@ static VALUE Mod_s_state(VALUE self)
159
161
  * Set the current key modifier state
160
162
  *
161
163
  * @note This does not change the keyboard state, only the key modifier flags.
162
- * @return [keymod]
164
+ * @return [void]
163
165
  * @see .state
164
166
  */
165
167
  static VALUE Mod_s_set_state(VALUE self, VALUE keymod)
@@ -220,7 +222,7 @@ static VALUE TextInput_s_stop(VALUE self)
220
222
  * Set the rectanlgle used to type Unicode text inputs.
221
223
  *
222
224
  * @param rect [SDL2::Rect] the rectangle to receive text
223
- * @return [rect]
225
+ * @return [void]
224
226
  */
225
227
  static VALUE TextInput_s_set_rect(VALUE self, VALUE rect)
226
228
  {
@@ -1265,38 +1267,38 @@ void rubysdl2_init_key(void)
1265
1267
  /* @return [Integer] keycode for "SLEEP" key */
1266
1268
  rb_define_const(mKey, "SLEEP", INT2NUM(SDLK_SLEEP));
1267
1269
 
1268
- /* 0 (no modifier is applicable) */
1270
+ /* @return [Integer] 0 (no modifier is applicable) */
1269
1271
  rb_define_const(mMod, "NONE", INT2NUM(KMOD_NONE));
1270
- /* the modifier key bit mask for the left shift key */
1272
+ /* @return [Integer] the modifier key bit mask for the left shift key */
1271
1273
  rb_define_const(mMod, "LSHIFT", INT2NUM(KMOD_LSHIFT));
1272
- /* the modifier key bit mask for the right shift key */
1274
+ /* @return [Integer] the modifier key bit mask for the right shift key */
1273
1275
  rb_define_const(mMod, "RSHIFT", INT2NUM(KMOD_RSHIFT));
1274
- /* the modifier key bit mask for the left control key */
1276
+ /* @return [Integer] the modifier key bit mask for the left control key */
1275
1277
  rb_define_const(mMod, "LCTRL", INT2NUM(KMOD_LCTRL));
1276
- /* the modifier key bit mask for the right control key */
1278
+ /* @return [Integer] the modifier key bit mask for the right control key */
1277
1279
  rb_define_const(mMod, "RCTRL", INT2NUM(KMOD_RCTRL));
1278
- /* the modifier key bit mask for the left alt key */
1280
+ /* @return [Integer] the modifier key bit mask for the left alt key */
1279
1281
  rb_define_const(mMod, "LALT", INT2NUM(KMOD_LALT));
1280
- /* the modifier key bit mask for the right alt key */
1282
+ /* @return [Integer] the modifier key bit mask for the right alt key */
1281
1283
  rb_define_const(mMod, "RALT", INT2NUM(KMOD_RALT));
1282
- /* the modifier key bit mask for the left GUI key (often the window key) */
1284
+ /* @return [Integer] the modifier key bit mask for the left GUI key (often the window key) */
1283
1285
  rb_define_const(mMod, "LGUI", INT2NUM(KMOD_LGUI));
1284
- /* the modifier key bit mask for the right GUI key (often the window key) */
1286
+ /* @return [Integer] the modifier key bit mask for the right GUI key (often the window key) */
1285
1287
  rb_define_const(mMod, "RGUI", INT2NUM(KMOD_RGUI));
1286
- /* the modifier key bit mask for the numlock key */
1288
+ /* @return [Integer] the modifier key bit mask for the numlock key */
1287
1289
  rb_define_const(mMod, "NUM", INT2NUM(KMOD_NUM));
1288
- /* the modifier key bit mask for the capslock key */
1290
+ /* @return [Integer] the modifier key bit mask for the capslock key */
1289
1291
  rb_define_const(mMod, "CAPS", INT2NUM(KMOD_CAPS));
1290
- /* the modifier key bit mask for the mode key (AltGr) */
1292
+ /* @return [Integer] the modifier key bit mask for the mode key (AltGr) */
1291
1293
  rb_define_const(mMod, "MODE", INT2NUM(KMOD_MODE));
1292
- /* the modifier key bit mask for the left and right control key */
1294
+ /* @return [Integer] the modifier key bit mask for the left and right control key */
1293
1295
  rb_define_const(mMod, "CTRL", INT2NUM(KMOD_CTRL));
1294
- /* the modifier key bit mask for the left and right shift key */
1296
+ /* @return [Integer] the modifier key bit mask for the left and right shift key */
1295
1297
  rb_define_const(mMod, "SHIFT", INT2NUM(KMOD_SHIFT));
1296
- /* the modifier key bit mask for the left and right alt key */
1298
+ /* @return [Integer] the modifier key bit mask for the left and right alt key */
1297
1299
  rb_define_const(mMod, "ALT", INT2NUM(KMOD_ALT));
1298
- /* the modifier key bit mask for the left and right GUI key */
1300
+ /* @return [Integer] the modifier key bit mask for the left and right GUI key */
1299
1301
  rb_define_const(mMod, "GUI", INT2NUM(KMOD_GUI));
1300
- /* reserved for future use */
1302
+ /* @return [Integer] reserved bit mask for future use */
1301
1303
  rb_define_const(mMod, "RESERVED", INT2NUM(KMOD_RESERVED));
1302
1304
  }
data/key.c.m4 CHANGED
@@ -65,6 +65,8 @@ static VALUE Key_s_keycode_from_scancode(VALUE self, VALUE scancode)
65
65
  * @overload pressed?(code)
66
66
  * @param [Integer] code scancode
67
67
  *
68
+ * @return [Boolean] true if pressed
69
+ *
68
70
  * Get whether the key of the given scancode is pressed or not.
69
71
  */
70
72
  static VALUE Key_s_pressed_p(VALUE self, VALUE code)
@@ -159,7 +161,7 @@ static VALUE Mod_s_state(VALUE self)
159
161
  * Set the current key modifier state
160
162
  *
161
163
  * @note This does not change the keyboard state, only the key modifier flags.
162
- * @return [keymod]
164
+ * @return [void]
163
165
  * @see .state
164
166
  */
165
167
  static VALUE Mod_s_set_state(VALUE self, VALUE keymod)
@@ -220,7 +222,7 @@ static VALUE TextInput_s_stop(VALUE self)
220
222
  * Set the rectanlgle used to type Unicode text inputs.
221
223
  *
222
224
  * @param rect [SDL2::Rect] the rectangle to receive text
223
- * @return [rect]
225
+ * @return [void]
224
226
  */
225
227
  static VALUE TextInput_s_set_rect(VALUE self, VALUE rect)
226
228
  {
@@ -796,38 +798,38 @@ void rubysdl2_init_key(void)
796
798
  DEFINE_KEYCODE(EJECT);
797
799
  DEFINE_KEYCODE(SLEEP);
798
800
 
799
- /* 0 (no modifier is applicable) */
801
+ /* @return [Integer] 0 (no modifier is applicable) */
800
802
  DEFINE_KEYMOD(NONE);
801
- /* the modifier key bit mask for the left shift key */
803
+ /* @return [Integer] the modifier key bit mask for the left shift key */
802
804
  DEFINE_KEYMOD(LSHIFT);
803
- /* the modifier key bit mask for the right shift key */
805
+ /* @return [Integer] the modifier key bit mask for the right shift key */
804
806
  DEFINE_KEYMOD(RSHIFT);
805
- /* the modifier key bit mask for the left control key */
807
+ /* @return [Integer] the modifier key bit mask for the left control key */
806
808
  DEFINE_KEYMOD(LCTRL);
807
- /* the modifier key bit mask for the right control key */
809
+ /* @return [Integer] the modifier key bit mask for the right control key */
808
810
  DEFINE_KEYMOD(RCTRL);
809
- /* the modifier key bit mask for the left alt key */
811
+ /* @return [Integer] the modifier key bit mask for the left alt key */
810
812
  DEFINE_KEYMOD(LALT);
811
- /* the modifier key bit mask for the right alt key */
813
+ /* @return [Integer] the modifier key bit mask for the right alt key */
812
814
  DEFINE_KEYMOD(RALT);
813
- /* the modifier key bit mask for the left GUI key (often the window key) */
815
+ /* @return [Integer] the modifier key bit mask for the left GUI key (often the window key) */
814
816
  DEFINE_KEYMOD(LGUI);
815
- /* the modifier key bit mask for the right GUI key (often the window key) */
817
+ /* @return [Integer] the modifier key bit mask for the right GUI key (often the window key) */
816
818
  DEFINE_KEYMOD(RGUI);
817
- /* the modifier key bit mask for the numlock key */
819
+ /* @return [Integer] the modifier key bit mask for the numlock key */
818
820
  DEFINE_KEYMOD(NUM);
819
- /* the modifier key bit mask for the capslock key */
821
+ /* @return [Integer] the modifier key bit mask for the capslock key */
820
822
  DEFINE_KEYMOD(CAPS);
821
- /* the modifier key bit mask for the mode key (AltGr) */
823
+ /* @return [Integer] the modifier key bit mask for the mode key (AltGr) */
822
824
  DEFINE_KEYMOD(MODE);
823
- /* the modifier key bit mask for the left and right control key */
825
+ /* @return [Integer] the modifier key bit mask for the left and right control key */
824
826
  DEFINE_KEYMOD(CTRL);
825
- /* the modifier key bit mask for the left and right shift key */
827
+ /* @return [Integer] the modifier key bit mask for the left and right shift key */
826
828
  DEFINE_KEYMOD(SHIFT);
827
- /* the modifier key bit mask for the left and right alt key */
829
+ /* @return [Integer] the modifier key bit mask for the left and right alt key */
828
830
  DEFINE_KEYMOD(ALT);
829
- /* the modifier key bit mask for the left and right GUI key */
831
+ /* @return [Integer] the modifier key bit mask for the left and right GUI key */
830
832
  DEFINE_KEYMOD(GUI);
831
- /* reserved for future use */
833
+ /* @return [Integer] reserved bit mask for future use */
832
834
  DEFINE_KEYMOD(RESERVED);
833
835
  }
data/lib/sdl2/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module SDL2
2
- # Version string of Ruby/SDL2
3
- VERSION = "0.3.5"
4
- # Version of Ruby/SDL2, [major, minor, patch level]
2
+ # @return [String] Version string of Ruby/SDL2
3
+ VERSION = "0.3.7"
4
+ # @return [Array<Integer>] Version of Ruby/SDL2, [major, minor, patch level]
5
5
  VERSION_NUMBER = VERSION.split(".").map(&:to_i)
6
6
  end
data/main.c CHANGED
@@ -145,11 +145,6 @@ static VALUE libsdl_revision(void)
145
145
  return rb_usascii_str_new_cstr(SDL_GetRevision());
146
146
  }
147
147
 
148
- static VALUE libsdl_revision_number(void)
149
- {
150
- return INT2NUM(SDL_GetRevisionNumber());
151
- }
152
-
153
148
  /*
154
149
  * Document-module: SDL2
155
150
  *
@@ -183,39 +178,41 @@ void Init_sdl2_ext(void)
183
178
  DEFINE_SDL_INIT_CONST(EVERYTHING);
184
179
  DEFINE_SDL_INIT_CONST(NOPARACHUTE);
185
180
 
186
- /* SDL's version string */
181
+ /* @return [String] SDL's version string */
187
182
  rb_define_const(mSDL2, "LIBSDL_VERSION", libsdl_version());
188
- /* SDL's version array of numbers */
183
+ /* @return [Array(Integer, Integer, Integer)] SDL's version array of numbers */
189
184
  rb_define_const(mSDL2, "LIBSDL_VERSION_NUMBER", libsdl_version_number());
190
- /* SDL's revision (from VCS) string */
185
+ /* @return [String] SDL's revision (from VCS) string */
191
186
  rb_define_const(mSDL2, "LIBSDL_REVISION", libsdl_revision());
192
- /* SDL's revision (from VCS) array of numbers */
193
- rb_define_const(mSDL2, "LIBSDL_REVISION_NUMBER", libsdl_revision_number());
187
+ /* @return [Integer] always 0
188
+ * @deprecated
189
+ */
190
+ rb_define_const(mSDL2, "LIBSDL_REVISION_NUMBER", INT2NUM(0));
194
191
 
195
192
  #ifdef HAVE_SDL_IMAGE_H
196
193
  {
197
194
  const SDL_version* version = IMG_Linked_Version();
198
- /* SDL_image's version string, only available if SDL_image is linked */
195
+ /* @return [String] SDL_image's version string, only available if SDL_image is linked */
199
196
  rb_define_const(mSDL2, "LIBSDL_IMAGE_VERSION", SDL_version_to_String(version));
200
- /* SDL_image's version array of numbers */
197
+ /* @return [Array(Integer, Integer, Integer)] SDL_image's version array of numbers */
201
198
  rb_define_const(mSDL2, "LIBSDL_IMAGE_VERSION_NUMBER", SDL_version_to_Array(version));
202
199
  }
203
200
  #endif
204
201
  #ifdef HAVE_SDL_TTF_H
205
202
  {
206
203
  const SDL_version* version = TTF_Linked_Version();
207
- /* SDL_ttf's version string, only available if SDL_ttf is linked */
204
+ /* @return [String] SDL_ttf's version string, only available if SDL_ttf is linked */
208
205
  rb_define_const(mSDL2, "LIBSDL_TTF_VERSION", SDL_version_to_String(version));
209
- /* SDL_ttf's version array of numbers */
206
+ /* @return [Array(Integer, Integer, Integer)] SDL_ttf's version array of numbers */
210
207
  rb_define_const(mSDL2, "LIBSDL_TTF_VERSION_NUMBER", SDL_version_to_Array(version));
211
208
  }
212
209
  #endif
213
210
  #ifdef HAVE_SDL_MIXER_H
214
211
  {
215
212
  const SDL_version* version = Mix_Linked_Version();
216
- /* SDL_mixer's version string , only available if SDL_mixer is linked */
213
+ /* @return [Integer] SDL_mixer's version string , only available if SDL_mixer is linked */
217
214
  rb_define_const(mSDL2, "LIBSDL_MIXER_VERSION", SDL_version_to_String(version));
218
- /* SDL_mixer's version array of numbers */
215
+ /* @return [Array(Integer, Integer, Integer)] SDL_mixer's version array of numbers */
219
216
  rb_define_const(mSDL2, "LIBSDL_MIXER_VERSION_NUMBER", SDL_version_to_Array(version));
220
217
  }
221
218
  #endif
data/messagebox.c CHANGED
@@ -70,7 +70,7 @@ static void set_color_scheme(VALUE colors, VALUE sym, SDL_MessageBoxColor* color
70
70
  }
71
71
 
72
72
  /*
73
- * @overload show(flag:, window: nil, title:, message:, buttons:, color_scheme: nil)
73
+ * @overload show(flags:, window: nil, title:, message:, buttons:, color_scheme: nil)
74
74
  * Create a model message box.
75
75
  *
76
76
  * You specify one of the following constants as flag
@@ -134,7 +134,7 @@ static void set_color_scheme(VALUE colors, VALUE sym, SDL_MessageBoxColor* color
134
134
  * @param [String] title the title text
135
135
  * @param [String] message the message text
136
136
  * @param [Array<Hash<Symbol => Object>>] buttons array of buttons
137
- * @param [Hash<Symbol=>[Integer,Integer,Integer]> nil] color_scheme
137
+ * @param [Hash<Symbol=>Array(Integer,Integer,Integer)>, nil] color_scheme
138
138
  * color scheme, or nil for the default color scheme
139
139
  * @return [Integer] pressed button id
140
140
  *
@@ -205,16 +205,16 @@ void rubysdl2_init_messagebox(void)
205
205
  rb_define_singleton_method(mMessageBox, "show_simple_box",
206
206
  MessageBox_s_show_simple_box, 4);
207
207
  rb_define_singleton_method(mMessageBox, "show", MessageBox_s_show, 1);
208
- /* This flag means that the message box shows an error message */
208
+ /* @return [Integer] the flag whcih means that the message box shows an error message */
209
209
  rb_define_const(mMessageBox, "ERROR", INT2NUM(SDL_MESSAGEBOX_ERROR));
210
- /* This flag means that the message box shows a warning message */
210
+ /* @return [Integer] the flag whcih means that the message box shows a warning message */
211
211
  rb_define_const(mMessageBox, "WARNING", INT2NUM(SDL_MESSAGEBOX_WARNING));
212
- /* This flag means that the message box shows an informational message */
212
+ /* @return [Integer] the flag whcih means that the message box shows an informational message */
213
213
  rb_define_const(mMessageBox, "INFORMATION", INT2NUM(SDL_MESSAGEBOX_INFORMATION));
214
- /* This flag represents the button is selected when return key is pressed */
214
+ /* @return [Integer] the flag whcih represents the button is selected when return key is pressed */
215
215
  rb_define_const(mMessageBox, "BUTTON_RETURNKEY_DEFAULT",
216
216
  INT2NUM(SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT));
217
- /* This flag represents the button is selected when escape key is pressed */
217
+ /* @return [Integer] the flag whcih represents the button is selected when escape key is pressed */
218
218
  rb_define_const(mMessageBox, "BUTTON_ESCAPEKEY_DEFAULT",
219
219
  INT2NUM(SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT));
220
220
 
data/mixer.c CHANGED
@@ -27,34 +27,40 @@ typedef struct Music {
27
27
 
28
28
  static void Chunk_free(Chunk* c)
29
29
  {
30
- if (rubysdl2_is_active() && c->chunk)
30
+ if (rubysdl2_is_active() && c->chunk)
31
31
  Mix_FreeChunk(c->chunk);
32
32
  free(c);
33
33
  }
34
34
 
35
+ DEFINE_DATA_TYPE(Chunk, Chunk_free);
36
+
35
37
  static VALUE Chunk_new(Mix_Chunk* chunk)
36
38
  {
37
- Chunk* c = ALLOC(Chunk);
39
+ Chunk* c;
40
+ VALUE obj = TypedData_Make_Struct(cChunk, Chunk, &Chunk_data_type, c);
38
41
  c->chunk = chunk;
39
- return Data_Wrap_Struct(cChunk, 0, Chunk_free, c);
42
+ return obj;
40
43
  }
41
44
 
42
45
  DEFINE_WRAPPER(Mix_Chunk, Chunk, chunk, cChunk, "SDL2::Mixer::Chunk");
43
46
 
44
47
  static void Music_free(Music* m)
45
48
  {
46
- if (rubysdl2_is_active() && m->music)
49
+ if (rubysdl2_is_active() && m->music)
47
50
  Mix_FreeMusic(m->music);
48
51
  free(m);
49
52
  }
50
53
 
54
+ DEFINE_DATA_TYPE(Music, Music_free);
55
+
51
56
  static VALUE Music_new(Mix_Music* music)
52
57
  {
53
- Music* c = ALLOC(Music);
58
+ Music* c;
59
+ VALUE obj = TypedData_Make_Struct(cMusic, Music, &Music_data_type, c);
54
60
  c->music = music;
55
- return Data_Wrap_Struct(cMusic, 0, Music_free, c);
61
+ return obj;
56
62
  }
57
-
63
+
58
64
  DEFINE_WRAPPER(Mix_Music, Music, music, cMusic, "SDL2::Mixer::Music");
59
65
 
60
66
  /*
@@ -135,7 +141,7 @@ static void check_channel(VALUE ch, int allow_minus_1)
135
141
  int channel = NUM2INT(ch);
136
142
  if (channel >= Mix_AllocateChannels(-1))
137
143
  rb_raise(rb_eArgError, "too large number of channel (%d)", channel);
138
- if (channel == -1 && !allow_minus_1 || channel < -1)
144
+ if ((channel == -1 && !allow_minus_1) || channel < -1)
139
145
  rb_raise(rb_eArgError, "negative number of channel is not allowed");
140
146
  }
141
147
 
@@ -193,7 +199,7 @@ static VALUE Mixer_s_close(VALUE self)
193
199
  *
194
200
  * This method returns the most suitable setting for {.open} the device.
195
201
  *
196
- * @return [[Integer, Integer, Integer, Integer]]
202
+ * @return [Array(Integer, Integer, Integer, Integer)]
197
203
  * the suitable frequency in Hz, the suitable format,
198
204
  * the suitable number of channels (1 for mono, 2 for stereo),
199
205
  * and the number of call of {.open}.
@@ -456,6 +462,8 @@ static VALUE Channels_s_fade_out(VALUE self, VALUE channel, VALUE ms)
456
462
  * Return true if a specified channel is playing.
457
463
  *
458
464
  * @param channel [Integer] channel to test
465
+ * @return [Boolean]
466
+ *
459
467
  * @see .pause?
460
468
  * @see .fading
461
469
  */
@@ -473,6 +481,7 @@ static VALUE Channels_s_play_p(VALUE self, VALUE channel)
473
481
  * other halting methods.
474
482
  *
475
483
  * @param channel [Integer] channel to test
484
+ * @return [Boolean]
476
485
  *
477
486
  * @see .play?
478
487
  * @see .fading
@@ -537,6 +546,8 @@ static VALUE Channels_s_playing_chunk(VALUE self, VALUE channel)
537
546
  /*
538
547
  * Initialize the channel with given **tag**.
539
548
  *
549
+ * @param tag [Integer] channel indentifier
550
+ *
540
551
  * Groups with a common tag are identified.
541
552
  */
542
553
  static VALUE Group_initialize(VALUE self, VALUE tag)
@@ -575,7 +586,7 @@ inline static int Group_tag(VALUE group)
575
586
  * **self** and **other** are considered to be same
576
587
  * if they have the same tag.
577
588
  *
578
- * @param other [SDL2::Mixer::Channel::Group] a compared object
589
+ * @param other [SDL2::Mixer::Channels::Group] a compared object
579
590
  * @return [Boolean]
580
591
  */
581
592
  static VALUE Group_eq(VALUE self, VALUE other)
@@ -749,7 +760,7 @@ static VALUE MusicChannel_s_volume(VALUE self)
749
760
  *
750
761
  * @param vol [Integer] the volume for mixing,
751
762
  * from 0 to {SDL2::Mixer::MAX_VOLUME}(128).
752
- * @return [vol]
763
+ * @return [void]
753
764
  *
754
765
  * @see .volume
755
766
  */
@@ -822,6 +833,7 @@ static VALUE MusicChannel_s_halt(VALUE self)
822
833
  * @overload fade_out(ms)
823
834
  * Halt the music playback with fade-out effect.
824
835
  *
836
+ * @param ms [Integer] milliseconds of fade-out effect
825
837
  * @return [nil]
826
838
  */
827
839
  static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
@@ -831,6 +843,8 @@ static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
831
843
 
832
844
  /*
833
845
  * Return true if a music is playing.
846
+ *
847
+ * @return [Boolean]
834
848
  */
835
849
  static VALUE MusicChannel_s_play_p(VALUE self)
836
850
  {
@@ -839,6 +853,8 @@ static VALUE MusicChannel_s_play_p(VALUE self)
839
853
 
840
854
  /*
841
855
  * Return true if a music playback is paused.
856
+ *
857
+ * @return [Boolean]
842
858
  */
843
859
  static VALUE MusicChannel_s_pause_p(VALUE self)
844
860
  {
@@ -960,7 +976,7 @@ static VALUE Chunk_volume(VALUE self)
960
976
  * Set the volume of the sample.
961
977
  *
962
978
  * @param vol [Integer] the new volume
963
- * @return [vol]
979
+ * @return [void]
964
980
  *
965
981
  * @see #volume
966
982
  */
@@ -1067,58 +1083,58 @@ void rubysdl2_init_mixer(void)
1067
1083
  rb_define_module_function(mMixer, "query", Mixer_s_query, 0);
1068
1084
 
1069
1085
  /* */
1070
- /* Initialize Ogg flac loader */
1086
+ /* @return [Integer] bitmask which means initialization of Ogg flac loader */
1071
1087
  rb_define_const(mMixer, "INIT_FLAC", UINT2NUM(MIX_INIT_FLAC));
1072
- /* Initialize MOD loader */
1088
+ /* @return [Integer] bitmask which means initialization of MOD loader */
1073
1089
  rb_define_const(mMixer, "INIT_MOD", UINT2NUM(MIX_INIT_MOD));
1074
- /* Initialize MP3 loader */
1090
+ /* @return [Integer] bitmask which means initialization of MP3 loader */
1075
1091
  rb_define_const(mMixer, "INIT_MP3", UINT2NUM(MIX_INIT_MP3));
1076
- /* Initialize Ogg vorbis loader */
1092
+ /* @return [Integer] bitmask which means initialization of Ogg vorbis loader */
1077
1093
  rb_define_const(mMixer, "INIT_OGG", UINT2NUM(MIX_INIT_OGG));
1078
1094
 
1079
- #if HAVE_CONST_MIX_INIT_MODPLUG
1080
- /* Initialize libmodplug */
1095
+ #ifdef HAVE_CONST_MIX_INIT_MODPLUG
1096
+ /* @return [Integer] bitmask which means initialization of libmodplug */
1081
1097
  rb_define_const(mMixer, "INIT_MODPLUG", UINT2NUM(MIX_INIT_MODPLUG));
1082
1098
  #endif
1083
- #if HAVE_CONST_MIX_INIT_FLUIDSYNTH
1084
- /* Initialize fluidsynth */
1099
+ #ifdef HAVE_CONST_MIX_INIT_FLUIDSYNTH
1100
+ /* @return [Integer] bitmask which means initialization of fluidsynth */
1085
1101
  rb_define_const(mMixer, "INIT_FLUIDSYNTH", UINT2NUM(MIX_INIT_FLUIDSYNTH));
1086
1102
  #endif
1087
- #if HAVE_CONST_MIX_INIT_MID
1088
- /* Initialize mid */
1103
+ #ifdef HAVE_CONST_MIX_INIT_MID
1104
+ /* @return [Integer] bitmask which means initialization of mid */
1089
1105
  rb_define_const(mMixer, "INIT_MID", UINT2NUM(MIX_INIT_MID));
1090
1106
  #endif
1091
1107
 
1092
1108
  /* */
1093
- /* Unsiged 8-bit sample format. Used by {Mixer.open} */
1109
+ /* @return [Integer] the value representing Unsiged 8-bit sample format. Used by {Mixer.open} */
1094
1110
  rb_define_const(mMixer, "FORMAT_U8", UINT2NUM(AUDIO_U8));
1095
- /* Siged 8-bit sample format. Used by {Mixer.open} */
1111
+ /* @return [Integer] the value representing Siged 8-bit sample format. Used by {Mixer.open} */
1096
1112
  rb_define_const(mMixer, "FORMAT_S8", UINT2NUM(AUDIO_S8));
1097
- /* Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
1113
+ /* @return [Integer] the value representing Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
1098
1114
  rb_define_const(mMixer, "FORMAT_U16LSB", UINT2NUM(AUDIO_U16LSB));
1099
- /* Siged 16-bit little-endian sample format. Used by {Mixer.open} */
1115
+ /* @return [Integer] the value representing Siged 16-bit little-endian sample format. Used by {Mixer.open} */
1100
1116
  rb_define_const(mMixer, "FORMAT_S16LSB", UINT2NUM(AUDIO_S16LSB));
1101
- /* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
1117
+ /* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
1102
1118
  rb_define_const(mMixer, "FORMAT_U16MSB", UINT2NUM(AUDIO_U16MSB));
1103
- /* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
1119
+ /* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
1104
1120
  rb_define_const(mMixer, "FORMAT_S16MSB", UINT2NUM(AUDIO_S16MSB));
1105
- /* Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
1121
+ /* @return [Integer] the value representing Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
1106
1122
  rb_define_const(mMixer, "FORMAT_U16SYS", UINT2NUM(AUDIO_U16SYS));
1107
- /* Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
1123
+ /* @return [Integer] the value representing Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
1108
1124
  rb_define_const(mMixer, "FORMAT_S16SYS", UINT2NUM(AUDIO_S16SYS));
1109
- /* Default frequency. 22050 (Hz) */
1125
+ /* @return [Integer] Default frequency. 22050 (Hz) */
1110
1126
  rb_define_const(mMixer, "DEFAULT_FREQUENCY", UINT2NUM(MIX_DEFAULT_FREQUENCY));
1111
- /* Default sample format. Same as {Mixer::FORMAT_S16SYS}. */
1127
+ /* @return [Integer] Default sample format. Same as {Mixer\:\:FORMAT_S16SYS}. */
1112
1128
  rb_define_const(mMixer, "DEFAULT_FORMAT", UINT2NUM(MIX_DEFAULT_FORMAT));
1113
- /* Default number of channels. 2. */
1129
+ /* @return [Integer] Default number of channels. 2. */
1114
1130
  rb_define_const(mMixer, "DEFAULT_CHANNELS", INT2FIX(MIX_DEFAULT_CHANNELS));
1115
- /* Max volume value. 128. */
1131
+ /* @return [Integer] Max volume value. 128. */
1116
1132
  rb_define_const(mMixer, "MAX_VOLUME", INT2FIX(MIX_MAX_VOLUME));
1117
- /* This constants represents that the channel is not fading in and fading out. */
1133
+ /* @return [Integer] the value represents that the channel is not fading in and fading out. */
1118
1134
  rb_define_const(mMixer, "NO_FADING", INT2FIX(MIX_NO_FADING));
1119
- /* This constants represents that the channel is fading out. */
1135
+ /* @return [Integer] the value represents that the channel is fading out. */
1120
1136
  rb_define_const(mMixer, "FADING_OUT", INT2FIX(MIX_FADING_OUT));
1121
- /* This constants represents that the channel is fading in. */
1137
+ /* @return [Integer] the value represents that the channel is fading in. */
1122
1138
  rb_define_const(mMixer, "FADING_IN", INT2FIX(MIX_FADING_IN));
1123
1139
 
1124
1140
 
@@ -1154,7 +1170,7 @@ void rubysdl2_init_mixer(void)
1154
1170
  rb_define_module_function(mChannels, "pause", Channels_s_pause, 1);
1155
1171
  rb_define_module_function(mChannels, "resume", Channels_s_resume, 1);
1156
1172
  rb_define_module_function(mChannels, "halt", Channels_s_halt, 1);
1157
- rb_define_module_function(mChannels, "expire", Channels_s_expire, 1);
1173
+ rb_define_module_function(mChannels, "expire", Channels_s_expire, 2);
1158
1174
  rb_define_module_function(mChannels, "fade_out", Channels_s_fade_out, 2);
1159
1175
  rb_define_module_function(mChannels, "play?", Channels_s_play_p, 1);
1160
1176
  rb_define_module_function(mChannels, "pause?", Channels_s_pause_p, 1);