Module | Rubygame::Mixer |
In: |
ext/rubygame/rubygame_shared.c
|
AUDIO_U8 | = | INT2NUM(AUDIO_U8) |
AUDIO_S8 | = | INT2NUM(AUDIO_S8) |
AUDIO_U16SYS | = | INT2NUM(AUDIO_U16SYS) |
AUDIO_S16SYS | = | INT2NUM(AUDIO_S16SYS) |
Close the audio device being used by the mixer. You should not use any mixer functions after this function, unless you use open_audio() to re-open the audio device. See also open_audio().
Returns nil.
Returns the number of mixing channels currently allocated. See also mix_channels=().
Set the number of mixer channels, allocating or deallocating channels as needed. This can be called many times, even during audio playback. If this call reduces the number of channels allocated, the excess channels will be stopped automatically. See also mix_channels()
Returns the number of mixing channels allocated.
Note that 8 mixing channels are allocated when open_audio() is called. This method only needs to be called if you want a different number (either greater or fewer) of mixing channels.
This method takes this argument:
num_channels: | desired number of mixing channels, an integer. Negative values will cause this method to behave as mix_channels(), returning the number of channels currently allocated, without changing it. |
Initializes the audio device. You must call this before using the other mixer functions. See also close_audio().
Returns nil. May raise an SDLError if initialization fails.
This method takes these arguments:
frequency: | output sampling frequency in samples per second (Hz). 22050 is recommended for most games; 44100 is CD audio rate. The larger the value, the more processing required. |
format: | output sample format. |
channels: | output sound channels. Use 2 for stereo, 1 for mono. (this option does not affect number of mixing channels) |
samplesize: | bytes per output sample. |
Play an audio Sample on a mixing channel, repeating a certain number of extra times. Returns the number of the channel that the sample is being played on.
Raises SDLError if something goes wrong.
This method takes these arguments:
sample: | what Sample to play |
channel_num: | which mixing channel to play the sample on. Use -1 to play on the first unreserved channel. |
repeats: | how many extra times to repeat the sample. Can be -1 to repeat forever until it is stopped. |