wxRuby Documentation Home

Wx::Sound

This class represents a short sound (loaded from Windows WAV file), that
can be stored in memory and played. Currently this class is implemented
on Windows and Unix (using either Open Sound
System
or Simple DirectMedia
Layer
).

Derived from

Object

Methods

Sound.new

Sound.new(%(arg-type)String% fileName, Boolean isResource = false)

Constructs a sound object from a WAV file or, under Windows only, from a
Windows resource. Will raise an exception if the file is not found, or
if there is an error loading the file.

Parameters

Sound.is_playing

boolean Sound.is_playing()

Returns true if a sound is being played at the moment.

This method is currently not implemented under Windows.

Sound.play

boolean Sound.play(%(arg-type)String% fileName, Integer flags = Wx::SOUND_ASYNC)

Shorthand class method for playing a sound file. See
Sound#play for more information on the arguments to this method

Sound.stop

Sound.stop()

If any sound is being played, this method stops it.

Sound#is_ok

boolean is_ok()

Returns true if the object contains a successfully loaded file or
resource, false otherwise.

Sound#play

boolean play(%(arg-type)Integer% flags = Wx::SOUND_ASYNC)

Plays the sound file. If another sound is playing, it will be
interrupted. Returns true on success, false otherwise.

The possible values for flags are:

[This page automatically generated from the Textile source at 2023-06-09 00:45:28 +0000]