rubysdl 1.3.1 → 2.0
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/MANIFEST +22 -2
- data/NEWS.en +80 -0
- data/NEWS.ja +83 -0
- data/README.en +2 -1
- data/README.ja +2 -2
- data/doc-en/Makefile +18 -0
- data/doc-en/cdrom.rsd +417 -0
- data/doc-en/collision.rsd +174 -0
- data/doc-en/event.rsd +1476 -0
- data/doc-en/font.rsd +811 -0
- data/doc-en/general.rsd +43 -0
- data/doc-en/init.rsd +168 -0
- data/doc-en/joystick.rsd +401 -0
- data/doc-en/mixer.rsd +869 -0
- data/doc-en/mpeg.rsd +585 -0
- data/doc-en/opengl.rsd +155 -0
- data/doc-en/sdlskk.rsd +472 -0
- data/doc-en/time.rsd +46 -0
- data/doc-en/video.rsd +2806 -0
- data/doc-en/wm.rsd +112 -0
- data/doc/Makefile +1 -1
- data/doc/cdrom.rsd +3 -3
- data/doc/event.rsd +178 -179
- data/doc/general.rsd +10 -0
- data/doc/init.rsd +2 -2
- data/doc/joystick.rsd +29 -5
- data/doc/mixer.rsd +20 -0
- data/doc/rsd.rb +42 -9
- data/doc/sdlskk.rsd +7 -7
- data/doc/video.rsd +461 -168
- data/doc/wm.rsd +2 -2
- data/extconf.rb +1 -8
- data/lib/rubysdl_aliases.rb +52 -190
- data/lib/rubysdl_compatible_ver1.rb +243 -0
- data/lib/sdl.rb +58 -92
- data/rubysdl.h +59 -68
- data/rubysdl_cdrom.c +125 -102
- data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
- data/rubysdl_event.c +318 -255
- data/rubysdl_event_key.c +299 -287
- data/rubysdl_image.c +37 -13
- data/rubysdl_joystick.c +180 -67
- data/rubysdl_kanji.c +61 -75
- data/rubysdl_main.c +65 -138
- data/rubysdl_mixer.c +339 -214
- data/rubysdl_mouse.c +50 -43
- data/rubysdl_opengl.c +31 -28
- data/rubysdl_pixel.c +17 -28
- data/rubysdl_ref.en.html +5658 -0
- data/rubysdl_ref.en.rd +6337 -0
- data/rubysdl_ref.html +2253 -1964
- data/rubysdl_ref.rd +823 -469
- data/rubysdl_rwops.c +9 -6
- data/rubysdl_sdlskk.c +137 -165
- data/rubysdl_sge_video.c +355 -469
- data/rubysdl_smpeg.c +189 -190
- data/rubysdl_time.c +1 -1
- data/rubysdl_ttf.c +147 -215
- data/rubysdl_video.c +486 -405
- data/rubysdl_wm.c +30 -30
- data/sample/aadraw.rb +9 -9
- data/sample/alpha.rb +12 -13
- data/sample/alphadraw.rb +10 -10
- data/sample/bfont.rb +4 -4
- data/sample/cdrom.rb +11 -4
- data/sample/collision.rb +20 -20
- data/sample/cursor.rb +5 -5
- data/sample/ellipses.rb +20 -16
- data/sample/event2.rb +11 -9
- data/sample/font.rb +4 -4
- data/sample/fpstimer.rb +3 -3
- data/sample/icon.bmp.gz +0 -0
- data/sample/icon.png +0 -0
- data/sample/joy2.rb +14 -14
- data/sample/kanji.rb +7 -7
- data/sample/load_from_io.rb +44 -0
- data/sample/movesp.rb +13 -12
- data/sample/playmod.rb +2 -3
- data/sample/plaympeg.rb +8 -8
- data/sample/playwave.rb +5 -6
- data/sample/sdlskk.rb +11 -11
- data/sample/sgetest.rb +14 -12
- data/sample/stetris.rb +12 -13
- data/sample/testgl.rb +13 -14
- data/sample/testsprite.rb +12 -11
- data/sample/transformblit.rb +23 -22
- metadata +62 -35
- data/rubysdl_event2.c +0 -417
data/doc-en/mixer.rsd
ADDED
@@ -0,0 +1,869 @@
|
|
1
|
+
= Audio
|
2
|
+
* ((<Audio subsystem outline>))
|
3
|
+
* ((<Audio Format>))
|
4
|
+
* ((<SDL::Mixer>))
|
5
|
+
* ((<SDL::Mixer::Wave>))
|
6
|
+
* ((<SDL::Mixer::Music>))
|
7
|
+
* Audio methods
|
8
|
+
TOC
|
9
|
+
|
10
|
+
== Audio subsystem outline
|
11
|
+
SDL has portable and low-level audio playback system.
|
12
|
+
Because this system is too low-level to use from Ruby,
|
13
|
+
you can use only SDL_mixer functions from Ruby.
|
14
|
+
So you should install SDL_mixer before using audio playback.
|
15
|
+
|
16
|
+
Due to popular demand, here is a simple multi-channel audio mixer. It supports 8 channels of 16 bit
|
17
|
+
stereo audio, plus a single channel of music, mixed by the popular MikMod MOD, Timidity MIDI and SMPEG
|
18
|
+
MP3 libraries.
|
19
|
+
|
20
|
+
The process of mixing MIDI files to wave output is very CPU intensive, so if playing regular WAVE files
|
21
|
+
sound great, but playing MIDI files sound choppy, try using 8-bit audio, mono audio, or lower
|
22
|
+
frequencies.
|
23
|
+
|
24
|
+
To play MIDI files, you'll need to get a complete set of GUS patches from:
|
25
|
+
((<Timidity GUS Patches|URL:http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz>))
|
26
|
+
and unpack them in /usr/local/lib under UNIX, and C:\ under Win32.
|
27
|
+
|
28
|
+
|
29
|
+
== Available audio formats
|
30
|
+
|
31
|
+
Ruby/SDL supports playing music and sound samples from the following formats:
|
32
|
+
- WAVE/RIFF (.wav)
|
33
|
+
- AIFF (.aiff)
|
34
|
+
- VOC (.voc)
|
35
|
+
- MOD (.mod .xm .s3m .669 .it .med and more) using included mikmod
|
36
|
+
- MIDI (.mid) using timidity or native midi hardware
|
37
|
+
- OggVorbis (.ogg) requiring ogg/vorbis libraries on system
|
38
|
+
- MP3 (.mp3) requiring SMPEG library on system
|
39
|
+
|
40
|
+
== SDL::Mixer
|
41
|
+
Module for audio playback subsystem.
|
42
|
+
|
43
|
+
== SDL::Mixer::Wave
|
44
|
+
Class for sound samples. Ruby/SDL can play those samples with multi-channel.
|
45
|
+
Support formats are WAVE, AIFF, RIFF, OGG, VOC.
|
46
|
+
|
47
|
+
== SDL::Mixer::Music
|
48
|
+
Class for audio data.
|
49
|
+
Suppor formats are WAVE, MOD, MIDI, OGG, MP3.
|
50
|
+
|
51
|
+
== Audio methods
|
52
|
+
%%%
|
53
|
+
NAME open
|
54
|
+
MOD Mixer
|
55
|
+
TYPE .
|
56
|
+
PURPOSE Initialize the mixer API.
|
57
|
+
|
58
|
+
PROTO
|
59
|
+
open(frequency=Mixer::DEFAULT_FREQUENCY,format=Mixer::DEFAULT_FORMAT,cannels=Mixer::DEFAULT_CHANNELS,chunksize=4096)
|
60
|
+
|
61
|
+
DESC
|
62
|
+
Initialize the mixer API.
|
63
|
+
This must be called before using other functions in this library.
|
64
|
+
SDL must be initialized with SDL::INIT_AUDIO before this call. $[frequency]
|
65
|
+
would be 44100 for 44.1KHz, which is CD audio rate. Most games use 22050,
|
66
|
+
because 44100 requires too much CPU power on older computers.
|
67
|
+
$[chunksize] is the size of each mixed sample. The smaller this is the more your hooks will be called. If
|
68
|
+
make this too small on a slow system, sound may skip. If made to large, sound effects will lag behind the
|
69
|
+
action more. You want a happy medium for your target computer. You also may make this 4096, or larger, if
|
70
|
+
you are just playing music. SDL::Mixer::CHANNELS(8)
|
71
|
+
mixing channels will be allocated by default.
|
72
|
+
|
73
|
+
$[format] are the values listed there:
|
74
|
+
|
75
|
+
:SDL::Mixer::FORMAT_U8
|
76
|
+
Unsigned 8-bit samples
|
77
|
+
:SDL::Mixer::FORMAT_S8
|
78
|
+
Signed 8-bit samples
|
79
|
+
:SDL::Mixer::FORMAT_U16LSB
|
80
|
+
Unsigned 16-bit samples, in little-endian byte order
|
81
|
+
:SDL::Mixer::FORMAT_S16LSB
|
82
|
+
Signed 16-bit samples, in little-endian byte order
|
83
|
+
:SDL::Mixer::FORMAT_U16MSB
|
84
|
+
Unsigned 16-bit samples, in big-endian byte order
|
85
|
+
:SDL::Mixer::FORMAT_S16MSB
|
86
|
+
Signed 16-bit samples, in big-endian byte order
|
87
|
+
:SDL::Mixer::FORMAT_U16
|
88
|
+
same as FORMAT_U16LSB (for backwards compatability probably)
|
89
|
+
:SDL::Mixer::FORMAT_S16
|
90
|
+
same as FORMAT_S16LSB (for backwards compatability probably)
|
91
|
+
:SDL::Mixer::FORMAT_U16SYS
|
92
|
+
Unsigned 16-bit samples, in system byte order
|
93
|
+
:SDL::Mixer::FORMAT_S16SYS
|
94
|
+
Signed 16-bit samples, in system byte order
|
95
|
+
|
96
|
+
SDL::DEFAULT_FORMAT is SDL::Mixer::FORMAT_S16SYS.
|
97
|
+
|
98
|
+
$[channels] is number of sound channels in output.
|
99
|
+
Set to 2 for stereo, 1 for mono. This has nothing to do with mixing channels.
|
100
|
+
Mixer::DEFAULT_CHANNELS is 2.
|
101
|
+
|
102
|
+
NOTES
|
103
|
+
If you observe sound skipping and delaying, you may change some parameters to
|
104
|
+
resolve such problems.
|
105
|
+
Please try to change $[frequency], $[chunksize] and $[format] parameter.
|
106
|
+
|
107
|
+
EXAMPLE
|
108
|
+
# start SDL with audio support
|
109
|
+
SDL.init(SDL::INIT_AUDIO)
|
110
|
+
# 44.1KHz, signed 16bit, system byte order, stereo audio
|
111
|
+
# using 1024 byte chunksize
|
112
|
+
SDL::Mixer.open(44100, SDL::Mixer::DEFAULT_FORMAT, 2, 1024)
|
113
|
+
|
114
|
+
EXCEPTION *
|
115
|
+
|
116
|
+
SEEALSO
|
117
|
+
Mixer.spec
|
118
|
+
Mixer.allocate_channels
|
119
|
+
|
120
|
+
%%
|
121
|
+
NAME spec
|
122
|
+
MOD Mixer
|
123
|
+
TYPE .
|
124
|
+
PURPOSE Get the actual audio format in use by the opened audio device
|
125
|
+
RVAL [Integer, UINT, Integer]
|
126
|
+
|
127
|
+
PROTO
|
128
|
+
spec
|
129
|
+
|
130
|
+
DESC
|
131
|
+
Returns the actual audio format in use by the opened audio device.
|
132
|
+
This may or may not match the parameters you passed to @[Mixer.open].
|
133
|
+
Return value is array of three elements: [frequency, format, channels].
|
134
|
+
|
135
|
+
EXAMPLE
|
136
|
+
frequency, format, channels = SDL::Mixer.spec
|
137
|
+
format_str = case format
|
138
|
+
when SDL::Mixer::AUDIO_U8 then "U8"
|
139
|
+
when SDL::Mixer::AUDIO_S8 then "S8"
|
140
|
+
when SDL::Mixer::AUDIO_U16LSB then "U16LSB"
|
141
|
+
when SDL::Mixer::AUDIO_S16LSB then "S16LSB"
|
142
|
+
when SDL::Mixer::AUDIO_U16MSB then "U16MSB"
|
143
|
+
when SDL::Mixer::AUDIO_S16MSB then "S16MSB"
|
144
|
+
end
|
145
|
+
|
146
|
+
printf "frequency=%dHz format=%s channels=%d", frequency, format_str, channels
|
147
|
+
|
148
|
+
EXCEPTION *
|
149
|
+
|
150
|
+
SEEALSO
|
151
|
+
Mixer.open
|
152
|
+
|
153
|
+
%%
|
154
|
+
NAME driver_name
|
155
|
+
MOD Mixer
|
156
|
+
TYPE .
|
157
|
+
PURPOSE Gets the audio device name
|
158
|
+
RVAL String
|
159
|
+
|
160
|
+
PROTO
|
161
|
+
driver_name
|
162
|
+
driverName
|
163
|
+
|
164
|
+
DESC
|
165
|
+
Returns the opened audio device name as String.
|
166
|
+
|
167
|
+
EXCEPTION
|
168
|
+
Raises @[Error] if audio playback system is not @[opened|Mixer.open] yet.
|
169
|
+
|
170
|
+
SEEALSO
|
171
|
+
Mixer.open
|
172
|
+
|
173
|
+
%%
|
174
|
+
NAME load
|
175
|
+
MOD Mixer::Wave
|
176
|
+
TYPE .
|
177
|
+
PURPOSE Load file for use as a sample.
|
178
|
+
RVAL Mixer::Wave
|
179
|
+
|
180
|
+
PROTO
|
181
|
+
load(filename)
|
182
|
+
|
183
|
+
DESC
|
184
|
+
Load file for use as a sample and returns the instance of @[Mixer::Wave].
|
185
|
+
$[filename] is name of wave file to use.
|
186
|
+
This can load WAVE, AIFF, RIFF, OGG, and VOC files.
|
187
|
+
|
188
|
+
NOTES
|
189
|
+
You must call @[Mixer.open] before calling this method.
|
190
|
+
It must know the output characteristics so it can convert the sample for playback, it does
|
191
|
+
this conversion at load time. Therefore you should pay attention to memory consumption.
|
192
|
+
|
193
|
+
EXCEPTION *
|
194
|
+
|
195
|
+
%%
|
196
|
+
NAME load_from_io
|
197
|
+
MOD Mixer::Wave
|
198
|
+
TYPE .
|
199
|
+
PURPOSE Read IO object for use as a sample.
|
200
|
+
RVAL Mixer::Wave
|
201
|
+
|
202
|
+
PROTO
|
203
|
+
load_from_io(io)
|
204
|
+
loadFromIO(io)
|
205
|
+
|
206
|
+
DESC
|
207
|
+
Read from Ruby's IO object (IO, StringIO or other objects with read, tell, rewind)
|
208
|
+
and returns the instance of @[Mixer::Wave].
|
209
|
+
This can read WAVE, AIFF, RIFF, OGG, and VOC files.
|
210
|
+
|
211
|
+
NOTES
|
212
|
+
You must call @[Mixer.open] before calling this method.
|
213
|
+
It must know the output characteristics so it can convert the sample for playback, it does
|
214
|
+
this conversion at load time. Therefore you should pay attention to memory consumption.
|
215
|
+
|
216
|
+
EXCEPTION *
|
217
|
+
|
218
|
+
%%
|
219
|
+
NAME load
|
220
|
+
MOD Mixer::Music
|
221
|
+
TYPE .
|
222
|
+
PURPOSE Load music file.
|
223
|
+
RVAL Mixer::Music
|
224
|
+
nn
|
225
|
+
PROTO
|
226
|
+
load(filename)
|
227
|
+
|
228
|
+
DESC
|
229
|
+
Load music file to use and returns a instance of @[Mixer::Music].
|
230
|
+
$[filename] is a name of music file to use.
|
231
|
+
This can load WAVE, MOD, MIDI, OGG, MP3, and any file that you use a command to
|
232
|
+
play with.
|
233
|
+
|
234
|
+
NOTES
|
235
|
+
Need SMPEG library to load MP3.
|
236
|
+
|
237
|
+
EXCEPTION *
|
238
|
+
|
239
|
+
%%
|
240
|
+
NAME load_from_string
|
241
|
+
MOD Mixer::Music
|
242
|
+
TYPE .
|
243
|
+
PURPOSE Convert string into music data.
|
244
|
+
RVAL Mixer::Music
|
245
|
+
|
246
|
+
PROTO
|
247
|
+
load_from_string(str)
|
248
|
+
loadFromString(str)
|
249
|
+
|
250
|
+
DESC
|
251
|
+
Convert $[str] string into music data and returns a instance of @[Mixer::Music].
|
252
|
+
This can load WAVE, MOD and OGG.
|
253
|
+
|
254
|
+
NOTES
|
255
|
+
In this method, copy $[str] and store it in returned object.
|
256
|
+
Therefore this method may cause the large memory consumption.
|
257
|
+
|
258
|
+
On Windows, it may be impossible to use this method.
|
259
|
+
|
260
|
+
EXCEPTION *
|
261
|
+
|
262
|
+
%%
|
263
|
+
NAME set_volume
|
264
|
+
MOD Mixer::Wave
|
265
|
+
TYPE #
|
266
|
+
PURPOSE Set volume
|
267
|
+
|
268
|
+
PROTO
|
269
|
+
set_volume(volume)
|
270
|
+
setVolume(volume)
|
271
|
+
|
272
|
+
DESC
|
273
|
+
Set wave volume to $[volume]. $[volume] should be in 0..128.
|
274
|
+
|
275
|
+
%%
|
276
|
+
NAME allocate_channels
|
277
|
+
MOD Mixer
|
278
|
+
TYPE .
|
279
|
+
PURPOSE Set the number of channels to mix
|
280
|
+
RVAL Integer
|
281
|
+
|
282
|
+
PROTO
|
283
|
+
allocate_channels(num_channels)
|
284
|
+
allocateChannels(num_channels)
|
285
|
+
|
286
|
+
DESC
|
287
|
+
Set the number of channels being mixed. This can be called
|
288
|
+
multiple times, even with sounds playing. If numchans is less
|
289
|
+
than the current number of channels, then the higher channels
|
290
|
+
will be stopped, freed, and therefore not mixed any longer. It's
|
291
|
+
probably not a good idea to change the size 1000 times a second
|
292
|
+
though.
|
293
|
+
|
294
|
+
NOTES
|
295
|
+
passing in zero ((*will*)) free all mixing
|
296
|
+
channels, however music will still play.
|
297
|
+
|
298
|
+
RET
|
299
|
+
Returns the number of channels allocated.
|
300
|
+
|
301
|
+
EXAMPLE
|
302
|
+
# allocate 16 mixing channels
|
303
|
+
SDL::Mixer.allocate_channels(16)
|
304
|
+
|
305
|
+
%%
|
306
|
+
NAME set_volume
|
307
|
+
MOD Mixer
|
308
|
+
TYPE .
|
309
|
+
PURPOSE Set the mix volume of a channel
|
310
|
+
RVAL Integer
|
311
|
+
|
312
|
+
PROTO
|
313
|
+
set_volume(channel, volume)
|
314
|
+
setVolume(channel, volume)
|
315
|
+
|
316
|
+
DESC
|
317
|
+
Set the $[volume] for any allocated $[channel].
|
318
|
+
If $[channel] is -1 then
|
319
|
+
all channels at are set at once. The volume is applied during
|
320
|
+
the final mix, along with the sample volume. So setting this
|
321
|
+
volume to 64 will halve the output of all samples played on the
|
322
|
+
specified channel. All channels default to a volume of 128,
|
323
|
+
which is the max. Newly allocated channels will have the max
|
324
|
+
volume set, so setting all channels volumes does not affect
|
325
|
+
subsequent channel allocations.
|
326
|
+
|
327
|
+
RET
|
328
|
+
Returns current volume of the channel. If channel is -1, the
|
329
|
+
average volume is returned.
|
330
|
+
|
331
|
+
SEEALSO
|
332
|
+
Mixer::Wave#set_volume
|
333
|
+
Mixer.set_volume_music
|
334
|
+
|
335
|
+
%%
|
336
|
+
NAME play_channel
|
337
|
+
MOD Mixer
|
338
|
+
TYPE .
|
339
|
+
PURPOSE Play loop
|
340
|
+
RVAL Integer
|
341
|
+
|
342
|
+
PROTO
|
343
|
+
play_channel(channel, wave, loops)
|
344
|
+
playChannel(channel, wave, loops)
|
345
|
+
|
346
|
+
DESC
|
347
|
+
Play $[wave](instance of @[Mixer::Wave] on $[channel], or
|
348
|
+
if $[channel] is -1, pick the first free
|
349
|
+
unreserved channel. The sample will play
|
350
|
+
for $[loops]+1 number of
|
351
|
+
times, unless stopped by halt, or fade out, or setting a new
|
352
|
+
expiration time of less time than it would have originally taken
|
353
|
+
to play the loops, or closing the mixer.
|
354
|
+
if $[loops] is -1, loops infinitely.
|
355
|
+
|
356
|
+
RET
|
357
|
+
the channel the sample is played on.
|
358
|
+
|
359
|
+
EXAMPLE
|
360
|
+
# play sample on first free unreserved channel
|
361
|
+
# play it exactly once through
|
362
|
+
SDL::Mixer.play_channel(-1, sample, 0)
|
363
|
+
|
364
|
+
SEEALSO
|
365
|
+
Mixer.play_channel_timed
|
366
|
+
Mixer.fade_in_channel
|
367
|
+
Mixer.halt
|
368
|
+
Mixer.expire
|
369
|
+
|
370
|
+
%%
|
371
|
+
NAME play_channel_timed
|
372
|
+
MOD Mixer
|
373
|
+
TYPE .
|
374
|
+
PURPOSE Play loop and limit by time
|
375
|
+
RVAL Integer
|
376
|
+
|
377
|
+
PROTO
|
378
|
+
play_channel_timed(channel, wave, loops, ticks)
|
379
|
+
playChannelTimed(channel, wave, loops, ticks)
|
380
|
+
|
381
|
+
DESC
|
382
|
+
If the $[wave] is long enough and has enough $[loops] then the
|
383
|
+
sample will stop after $[ticks] milliseconds. Otherwise this
|
384
|
+
function is the same as @[Mixer.play_channel].
|
385
|
+
|
386
|
+
EXAMPLE
|
387
|
+
# play sample on first free unreserved channel
|
388
|
+
# play it for half a second
|
389
|
+
SDL::Mixer.play_channel(-1, sample, -1, 500)
|
390
|
+
|
391
|
+
SEEALSO
|
392
|
+
Mixer.play_channel
|
393
|
+
Mixer.fade_in_channel_timed
|
394
|
+
Mixer.fade_out
|
395
|
+
Mixer.halt
|
396
|
+
Mixer.expire
|
397
|
+
|
398
|
+
%%
|
399
|
+
NAME fade_in_channel
|
400
|
+
MOD Mixer
|
401
|
+
TYPE .
|
402
|
+
PURPOSE Play loop with fade in
|
403
|
+
RVAL Integer
|
404
|
+
|
405
|
+
PROTO
|
406
|
+
fade_in_channel(channel, wave, loops, ms)
|
407
|
+
fadeInChannel(channel, wave, loops, ms)
|
408
|
+
|
409
|
+
DESC
|
410
|
+
Play $[wave] on $[channel] with fade in.
|
411
|
+
The channel volume starts at 0 and fades up to full volume over
|
412
|
+
$[ms] milliseconds of time. The sample may end before the fade-in
|
413
|
+
is complete if it is too short or doesn't have enough loops.
|
414
|
+
|
415
|
+
Otherwise this function is the same as @[Mixer.play_channel].
|
416
|
+
|
417
|
+
EXAMPLE
|
418
|
+
# play sample on first free unreserved channel
|
419
|
+
# play it exactly 3 times through
|
420
|
+
# fade in over one second
|
421
|
+
SDL::Mixer.fade_in_channel(-1, sample, 2, 1000)
|
422
|
+
|
423
|
+
SEEALSO
|
424
|
+
Mixer.play_channel
|
425
|
+
Mixer.fade_in_channel_timed
|
426
|
+
Mixer.fading
|
427
|
+
Mixer.fade_out
|
428
|
+
Mixer.halt
|
429
|
+
Mixer.expire
|
430
|
+
|
431
|
+
%%
|
432
|
+
NAME fade_in_channel_timed
|
433
|
+
MOD Mixer
|
434
|
+
TYPE .
|
435
|
+
PURPOSE Play loop with fade in and limit by time
|
436
|
+
RVAL Integer
|
437
|
+
|
438
|
+
PROTO
|
439
|
+
fade_in_channel_timed(channel, wave, loops, ms, ticks)
|
440
|
+
fadeInChannelTimed(channel, wave, loops, ms, ticks)
|
441
|
+
|
442
|
+
DESC
|
443
|
+
If the sample is long enough and has enough loops then the
|
444
|
+
sample will stop after ticks milliseconds. Otherwise this
|
445
|
+
method is the same as @[Mixer.play_channel_timed].
|
446
|
+
|
447
|
+
SEEALSO
|
448
|
+
Mixer.play_channel_timed
|
449
|
+
Mixer.fade_in_channel
|
450
|
+
Mixer.fading
|
451
|
+
Mixer.fade_out
|
452
|
+
Mixer.halt
|
453
|
+
Mixer.expire
|
454
|
+
|
455
|
+
%%
|
456
|
+
NAME pause
|
457
|
+
MOD Mixer
|
458
|
+
TYPE .
|
459
|
+
PURPOSE Pause the channel
|
460
|
+
|
461
|
+
PROTO
|
462
|
+
pause(channel)
|
463
|
+
|
464
|
+
DESC
|
465
|
+
Pause $[channel], or all playing channels if -1 is passed in. You
|
466
|
+
may still $[halt|Mixer.halt] a paused channel.
|
467
|
+
|
468
|
+
EXAMPLE
|
469
|
+
# pause all sample playback
|
470
|
+
SDL::Mixer.pause(-1)
|
471
|
+
|
472
|
+
SEEALSO
|
473
|
+
Mixer.resume
|
474
|
+
Mixer.pause?
|
475
|
+
Mixer.halt
|
476
|
+
|
477
|
+
%%
|
478
|
+
NAME resume
|
479
|
+
MOD Mixer
|
480
|
+
TYPE .
|
481
|
+
PURPOSE Resume a paused channel
|
482
|
+
|
483
|
+
PROTO
|
484
|
+
resume(channel)
|
485
|
+
|
486
|
+
DESC
|
487
|
+
Unpause $[channel], or all playing and paused channels if -1 is
|
488
|
+
passed in.
|
489
|
+
|
490
|
+
SEEALSO
|
491
|
+
Mixer.pause
|
492
|
+
Mixer.pause?
|
493
|
+
|
494
|
+
%%
|
495
|
+
NAME halt
|
496
|
+
MOD Mixer
|
497
|
+
TYPE .
|
498
|
+
PURPOSE Stop playing on a channel
|
499
|
+
|
500
|
+
PROTO
|
501
|
+
halt(channel)
|
502
|
+
|
503
|
+
DESC
|
504
|
+
Halt channel playback, or all channels if -1 is passed in.
|
505
|
+
Any callback set by Mix_ChannelFinished will be called.
|
506
|
+
|
507
|
+
SEEALSO
|
508
|
+
Mixer.expire
|
509
|
+
Mixer.fade_out
|
510
|
+
|
511
|
+
%%
|
512
|
+
NAME expire
|
513
|
+
MOD Mixer
|
514
|
+
TYPE .
|
515
|
+
PURPOSE Change the timed stoppage of a channel
|
516
|
+
RVAL Integer
|
517
|
+
|
518
|
+
PROTO
|
519
|
+
expire(channel, ticks)
|
520
|
+
|
521
|
+
DESC
|
522
|
+
Halt $[channel] playback, or all channels
|
523
|
+
if -1 is passed in, after $[ticks] milliseconds.
|
524
|
+
|
525
|
+
RET
|
526
|
+
Returns the number of channels set to expire. Whether or not they
|
527
|
+
are active.
|
528
|
+
|
529
|
+
EXAMPLE
|
530
|
+
# halt playback on all channels in 2 seconds
|
531
|
+
SDL::Mixer.expire(-1, 2000)
|
532
|
+
|
533
|
+
SEEALSO
|
534
|
+
Mixer.halt
|
535
|
+
Mixer.fade_out
|
536
|
+
|
537
|
+
%%
|
538
|
+
NAME fade_out
|
539
|
+
MOD Mixer
|
540
|
+
TYPE .
|
541
|
+
PURPOSE Stop playing channel after timed fade out
|
542
|
+
RVAL Integer
|
543
|
+
|
544
|
+
PROTO
|
545
|
+
fade_out(channel, ms)
|
546
|
+
fadeOut(channel, ms)
|
547
|
+
|
548
|
+
DESC
|
549
|
+
Gradually fade out which $[channel]
|
550
|
+
over $[ms] milliseconds starting
|
551
|
+
from now. The channel will be halted after the fade out is
|
552
|
+
completed. Only channels that are playing are set to fade out,
|
553
|
+
including paused channels.
|
554
|
+
|
555
|
+
RET
|
556
|
+
Returns the number of channels set to fade out.
|
557
|
+
|
558
|
+
EXAMPLE
|
559
|
+
# fade out all channels to finish 3 seconds from now
|
560
|
+
printf "starting fade out of %d channels", SDL::Mixer.fade_out(-1, 3000)
|
561
|
+
|
562
|
+
SEEALSO
|
563
|
+
Mixer.fade_in_channel
|
564
|
+
Mixer.fade_in_channel_timed
|
565
|
+
Mixer.fading
|
566
|
+
|
567
|
+
%%
|
568
|
+
NAME play?
|
569
|
+
MOD Mixer
|
570
|
+
TYPE .
|
571
|
+
PURPOSE Get the active playing status of a channel
|
572
|
+
RVAL true/false
|
573
|
+
|
574
|
+
PROTO
|
575
|
+
play?(channel)
|
576
|
+
|
577
|
+
DESC
|
578
|
+
Returns true if $[channel] is playing, otherwise
|
579
|
+
returns false.
|
580
|
+
|
581
|
+
SEEALSO
|
582
|
+
Mixer.pause?
|
583
|
+
Mixer.fading
|
584
|
+
Mixer.play_channel
|
585
|
+
Mixer.pause
|
586
|
+
|
587
|
+
%%
|
588
|
+
NAME playing_channels
|
589
|
+
MOD Mixer
|
590
|
+
TYPE .
|
591
|
+
PURPOSE Get the number of active playing channels
|
592
|
+
RVAL Integer
|
593
|
+
|
594
|
+
PROTO
|
595
|
+
playing_channels
|
596
|
+
playingChannels
|
597
|
+
|
598
|
+
DESC
|
599
|
+
Returns the number of playing.
|
600
|
+
|
601
|
+
SEEALSO
|
602
|
+
Mixer.pause?
|
603
|
+
Mixer.fading
|
604
|
+
Mixer.play_channel
|
605
|
+
Mixer.pause
|
606
|
+
|
607
|
+
%%
|
608
|
+
NAME pause?
|
609
|
+
MOD Mixer
|
610
|
+
TYPE .
|
611
|
+
PURPOSE Get the pause status of a channel
|
612
|
+
RVAL true/false
|
613
|
+
|
614
|
+
PROTO
|
615
|
+
pause?(channel)
|
616
|
+
|
617
|
+
DESC
|
618
|
+
Returns true if $[channel] is paused, otherwise
|
619
|
+
returns false.
|
620
|
+
|
621
|
+
SEEALSO
|
622
|
+
Mixer.play?
|
623
|
+
Mixer.pause
|
624
|
+
Mixer.resume
|
625
|
+
|
626
|
+
%%
|
627
|
+
NAME fading
|
628
|
+
MOD Mixer
|
629
|
+
TYPE .
|
630
|
+
PURPOSE Get the fade status of a channel
|
631
|
+
RVAL Integer
|
632
|
+
|
633
|
+
PROTO
|
634
|
+
fading(which)
|
635
|
+
|
636
|
+
DESC
|
637
|
+
Tells you if which $[channel] is fading in, out, or not. Does not
|
638
|
+
tell you if the channel is playing anything, or paused, so you'd
|
639
|
+
need to test that separately.
|
640
|
+
Returns the fading status:
|
641
|
+
* SDL::Mixer::FADING_OUT
|
642
|
+
* SDL::Mixer::FADING_IN
|
643
|
+
* SDL::Mixer::NO_FADING
|
644
|
+
|
645
|
+
SEEALSO
|
646
|
+
Mixer.play?
|
647
|
+
Mixer.pause?
|
648
|
+
Mixer.fade_in_channel
|
649
|
+
Mixer.fade_in_channel_timed
|
650
|
+
Mixer.fade_out
|
651
|
+
|
652
|
+
%%
|
653
|
+
NAME play_music
|
654
|
+
MOD Mixer
|
655
|
+
TYPE .
|
656
|
+
PURPOSE Play music, with looping
|
657
|
+
|
658
|
+
PROTO
|
659
|
+
play_music(music, loops)
|
660
|
+
playMusic(music, loops)
|
661
|
+
|
662
|
+
DESC
|
663
|
+
Play the loaded $[music]
|
664
|
+
$[loops] times through from start to finish.
|
665
|
+
The previous music will be halted, or if fading out it waits
|
666
|
+
(blocking) for that to finish.
|
667
|
+
|
668
|
+
EXCEPTION *
|
669
|
+
|
670
|
+
SEEALSO
|
671
|
+
Mixer.fade_in_music
|
672
|
+
|
673
|
+
%%
|
674
|
+
NAME fade_in_music
|
675
|
+
vMOD Mixer
|
676
|
+
TYPE .
|
677
|
+
PURPOSE Play music, with looping, and fade in
|
678
|
+
|
679
|
+
PROTO
|
680
|
+
fade_in_music(music, loops, ms)
|
681
|
+
fadeInMusic(music, loops, ms)
|
682
|
+
|
683
|
+
DESC
|
684
|
+
Fade in over $[ms] milliseconds of time,
|
685
|
+
the loaded $[music], playing
|
686
|
+
it $[loops] times through from start to finish.
|
687
|
+
The fade in effect only applies to the first loop.
|
688
|
+
Any previous music will be halted, or if it is fading out it
|
689
|
+
will wait (blocking) for the fade to complete.
|
690
|
+
|
691
|
+
EXCEPTION *
|
692
|
+
|
693
|
+
SEEALSO
|
694
|
+
Mixer.play_music
|
695
|
+
|
696
|
+
%%
|
697
|
+
NAME set_volume_music
|
698
|
+
MOD Mixer
|
699
|
+
TYPE .
|
700
|
+
PURPOSE Set music volume
|
701
|
+
|
702
|
+
PROTO
|
703
|
+
set_volume_music(volume)
|
704
|
+
setVolumeMusic(volume)
|
705
|
+
|
706
|
+
DESC
|
707
|
+
Set the volume to $[volume], if it is 0 or greater.
|
708
|
+
Setting the volume during a fade will
|
709
|
+
not work, the faders use this function to perform their effect!
|
710
|
+
|
711
|
+
SEEALSO
|
712
|
+
Mixer.fade_in_music
|
713
|
+
Mixer.fade_out_music
|
714
|
+
|
715
|
+
%%
|
716
|
+
NAME pause_music
|
717
|
+
MOD Mixer
|
718
|
+
TYPE .
|
719
|
+
PURPOSE Pause music
|
720
|
+
|
721
|
+
PROTO
|
722
|
+
pause_music
|
723
|
+
pauseMusic
|
724
|
+
|
725
|
+
DESC
|
726
|
+
Pause the music playback. You may @[halt|Mixer.halt_music]
|
727
|
+
paused music.
|
728
|
+
|
729
|
+
SEEALSO
|
730
|
+
Mixer.resume_music
|
731
|
+
Mixer.pause_music?
|
732
|
+
Mixer.halt_music
|
733
|
+
|
734
|
+
%%
|
735
|
+
NAME resume_music
|
736
|
+
MOD Mixer
|
737
|
+
TYPE .
|
738
|
+
PURPOSE Resume paused music
|
739
|
+
|
740
|
+
PROTO
|
741
|
+
resume_music
|
742
|
+
resumeMusic
|
743
|
+
|
744
|
+
DESC
|
745
|
+
Unpause the music. This is safe to use on halted, paused, and
|
746
|
+
already playing music.
|
747
|
+
|
748
|
+
|
749
|
+
SEEALSO
|
750
|
+
Mixer.pause_music
|
751
|
+
Mixer.pause_music?
|
752
|
+
|
753
|
+
%%
|
754
|
+
NAME rewind_music
|
755
|
+
MOD Mixer
|
756
|
+
TYPE .
|
757
|
+
PURPOSE Rewind music to beginning
|
758
|
+
|
759
|
+
PROTO
|
760
|
+
rewind_music
|
761
|
+
rewindMusic
|
762
|
+
|
763
|
+
DESC
|
764
|
+
Rewind the music to the start. This is safe to use on halted,
|
765
|
+
paused, and already playing music. It is not useful to rewind
|
766
|
+
the music immediately after starting playback, because it starts
|
767
|
+
at the beginning by default.
|
768
|
+
|
769
|
+
This function only works for these streams: MOD, OGG, MP3,
|
770
|
+
Native MIDI.
|
771
|
+
|
772
|
+
%%
|
773
|
+
NAME halt_music
|
774
|
+
MOD Mixer
|
775
|
+
TYPE .
|
776
|
+
PURPOSE Stop music playback
|
777
|
+
|
778
|
+
PROTO
|
779
|
+
halt_music
|
780
|
+
haltMusic
|
781
|
+
|
782
|
+
DESC
|
783
|
+
Halt playback of music. This interrupts music fader effects.
|
784
|
+
|
785
|
+
SEEALSO
|
786
|
+
Mixer.fade_out_music
|
787
|
+
|
788
|
+
%%
|
789
|
+
NAME fade_out_music
|
790
|
+
MOD Mixer
|
791
|
+
TYPE .
|
792
|
+
PURPOSE Stop music, with fade out
|
793
|
+
|
794
|
+
PROTO
|
795
|
+
fade_out_music(ms)
|
796
|
+
fadeOutMusic(ms)
|
797
|
+
|
798
|
+
DESC
|
799
|
+
Gradually fade out the music over $[ms] milliseconds starting from
|
800
|
+
now. The music will be halted after the fade out is completed.
|
801
|
+
Only when music is playing and not fading already are set to
|
802
|
+
fade out, including paused channels.
|
803
|
+
|
804
|
+
%%
|
805
|
+
NAME play_music?
|
806
|
+
MOD Mixer
|
807
|
+
TYPE .
|
808
|
+
PURPOSE Test whether music is playing
|
809
|
+
RVAL true/false
|
810
|
+
|
811
|
+
PROTO
|
812
|
+
play_music?
|
813
|
+
playMusic?
|
814
|
+
|
815
|
+
DESC
|
816
|
+
Returns true if music is actively playing, otherwise
|
817
|
+
returns false.
|
818
|
+
|
819
|
+
SEEALSO
|
820
|
+
Mixer.pause_music?
|
821
|
+
Mixer.fading_music
|
822
|
+
Mixer.play_music
|
823
|
+
|
824
|
+
%%
|
825
|
+
NAME pause_music?
|
826
|
+
MOD Mixer
|
827
|
+
TYPE .
|
828
|
+
PURPOSE Test whether music is paused
|
829
|
+
RVAL true/false
|
830
|
+
|
831
|
+
PROTO
|
832
|
+
pause_music?
|
833
|
+
pauseMusic?
|
834
|
+
|
835
|
+
DESC
|
836
|
+
Returns true if music is paused, otherwise returns false.
|
837
|
+
|
838
|
+
SEEALSO
|
839
|
+
Mixer.play_music?
|
840
|
+
Mixer.pause_music
|
841
|
+
Mixer.resume_music
|
842
|
+
|
843
|
+
%%
|
844
|
+
NAME fading_music
|
845
|
+
MOD Mixer
|
846
|
+
TYPE .
|
847
|
+
PURPOSE Get status of current music fade activity
|
848
|
+
RVAL Integer
|
849
|
+
|
850
|
+
PROTO
|
851
|
+
fading_music
|
852
|
+
fadingMusic
|
853
|
+
|
854
|
+
DESC
|
855
|
+
Tells you if music is fading in, out, or not at all. Does not
|
856
|
+
tell you if the channel is playing anything, or paused, so you'd
|
857
|
+
need to test that separately.
|
858
|
+
|
859
|
+
return value is one of follwoing:
|
860
|
+
* SDL::Mixer::FADING_OUT
|
861
|
+
* SDL::Mixer::FADING_IN
|
862
|
+
* SDL::Mixer::NO_FADING
|
863
|
+
|
864
|
+
SEEALSO
|
865
|
+
Mixer.fading
|
866
|
+
Mixer.pause_music?
|
867
|
+
Mixer.play_music?
|
868
|
+
Mixer.fade_out_music
|
869
|
+
|