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 (and uses either
Open Sound System (#2
) or
Simple DirectMedia Layer (#2
)).
Derived from
Include files
<wx/sound.h>
Default constructor.
Constructs a wave object from a file or resource. Call wxSound::IsOk to determine whether this succeeded.
Parameters
Destroys the wxSound object.
Constructs a wave object from a file or resource.
Parameters
Return value
TRUEif the call was successful, FALSEotherwise.
Returns TRUEif the object contains a successfully loaded file or resource, FALSEotherwise.
static bool IsPlaying(void) const
Returns TRUEif a sound is played at the moment.
bool Play(unsigned flags = wxSOUND_ASYNC) const
Plays the sound file. If another sound is playing, it will be interrupted. Returns TRUEon success, FALSEotherwise.
The possible values for flags are:
wxSOUND_SYNC | Play will block and wait until the sound is replayed. |
wxSOUND_ASYNC | Sound is played asynchronously, Play returns immediately |
wxSOUND_ASYNC | wxSOUND_LOOP | Sound is played asynchronously and loops until another sound is played, wxSound::Stop is called or the program terminates. |
The static form is shorthand for this code:
wxSound(filename).Play(flags);
If a sound is played, this function stops it.
ymasuda 平成17年11月19日