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(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(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(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 Wed Sep 09 02:21:23 +0100 2009]