Class | Win32::Sound |
In: |
lib/win32/sound.rb
|
Parent: | Object |
VERSION | = | '0.4.1' |
LOW_FREQUENCY | = | 37 |
HIGH_FREQUENCY | = | 32767 |
MAX_VOLUME | = | 0xFFFF |
SYNC | = | 0x0000 |
ASYNC | = | 0x0001 |
NODEFAULT | = | 0x0002 |
MEMORY | = | 0x0004 |
LOOP | = | 0x0008 |
NOSTOP | = | 0x0010 |
NOWAIT | = | 8192 |
ALIAS | = | 65536 |
ALIAS_ID | = | 1114112 |
FILENAME | = | 131072 |
RESOURCE | = | 262148 |
PURGE | = | 0x0040 |
APPLICATION | = | 0x0080 |
Generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes.
The frequency (in Hertz) must be between 37 and 32767. The duration is in milliseconds.
Returns an array of all the available sound devices; their names contain the type of the device and a zero-based ID number. Possible return values are WAVEOUT, WAVEIN, MIDIOUT, MIDIIN, AUX or MIXER.
Plays the specified sound. The sound can be a wave file or a system sound, when used in conjunction with the ALIAS flag.
Valid flags:
Sound::ALIAS
The sound parameter is a system-event alias in the registry or the WIN.INI file. If the registry contains no such name, it plays the system default sound unless the NODEFAULT value is also specified. Do not use with FILENAME.
Sound::APPLICATION
The sound is played using an application-specific association.
Sound::ASYNC
The sound is played asynchronously and the function returns immediately after beginning the sound.
Sound::FILENAME
The sound parameter is the name of a WAV file. Do not use with ALIAS.
Sound::LOOP
The sound plays repeatedly until Sound.stop() is called. You must also specify the ASYNC flag to loop sounds.
Sound::MEMORY
The sound points to an image of a waveform sound in memory.
Sound::NODEFAULT
If the sound cannot be found, the function returns silently without playing the default sound.
Sound::NOSTOP
If a sound is currently playing, the function immediately returns false without playing the requested sound.
Sound::NOWAIT
If the driver is busy, return immediately without playing the sound.
Sound::PURGE
Stop playing all instances of the specified sound.
Sound::SYNC
The sound is played synchronously and the function does not return until the sound ends.
Sets the volume for the left and right channel. If the right_channel is omitted, the volume is set for both channels.
You may optionally pass a single Integer rather than an Array, in which case it is assumed you are setting both channels to the same value.
Stops any currently playing waveform sound. If purge is set to true, then all sounds are stopped. The default is false.