Module | Rubygame::Mixer |
In: |
ext/rubygame/rubygame_event.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 name of the audio driver that SDL is using.
May raise an SDLError if initialization fails.
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 sample rate in audio samples per second (Hz). Affects the quality of the sound output, at the expense of CPU usage. If nil, the default (22050) is used. 22050 is recommended for most games. For reference, 44100 is CD quality. The larger the value, the more processing required. | ||||||||
format: | output sample format. If nil, the default recommended system format is
used. It‘s highly recommended you leave this nil!
But if you‘re feeling reckless, you can use one of these constants located in the Rubygame::Mixer module:
| ||||||||
channels: | output sound channels. Use 2 for stereo, 1 for mono. If nil, the default (2) is used. This option is not related to mixing channels. | ||||||||
buffer: | size of the sound buffer, in bytes. If nil, the default (1024) is used. Larger values have more delay before playing a sound, but require less CPU usage (and have less skipping on slow systems). |
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. |