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 or Simple DirectMedia Layer).
__init__ | Default constructor. |
Create | Constructs a wave object from a file or resource. |
CreateFromData | Create a sound object from data in a memory buffer in WAV format. |
IsOk | Returns True if the object contains a successfully loaded file or resource, False otherwise. |
Play | Plays the sound file. |
PlaySound | Plays the sound file. |
Stop | If a sound is played, this function stops it. |
__nonzero__ |
This class represents a short sound (loaded from Windows WAV file), that can be stored in memory and played.
Possible constructors:
Sound()
Sound(fileName)
Overloaded Implementations:
__init__ (self)
Default constructor.
__init__ (self, fileName)
Constructs a wave object from a file or, under Windows, from a Windows resource.
Call IsOk to determine whether this succeeded.
Parameters: | fileName (string) – The filename or Windows resource. |
---|
True if fileName is a resource, False if it is a filename.
Constructs a wave object from a file or resource.
Parameters: | fileName (string) – The filename or Windows resource. |
---|
True if fileName is a resource, False if it is a filename.
Returns: | True if the call was successful, False otherwise. |
---|
Create a sound object from data in a memory buffer in WAV format.
Return type: | bool |
---|
Returns True if the object contains a successfully loaded file or resource, False otherwise.
Return type: | bool |
---|
Plays the sound file.
If another sound is playing, it will be interrupted.
Returns True on success, False otherwise. Note that in general it is possible to delete the object which is being asynchronously played any time after calling this function and the sound would continue playing, however this currently doesn’t work under Windows for sound objects loaded from memory data.
The possible values for flags are:
The static form is shorthand for this code:
wx.Sound(filename).Play(flags)
Parameters: | flags – |
---|---|
Return type: | bool |
Plays the sound file.
If another sound is playing, it will be interrupted.
Returns True on success, False otherwise. Note that in general it is possible to delete the object which is being asynchronously played any time after calling this function and the sound would continue playing, however this currently doesn’t work under Windows for sound objects loaded from memory data.
The possible values for flags are:
The static form is shorthand for this code:
wx.Sound(filename).Play(flags)
Parameters: |
|
---|---|
Return type: | bool |
If a sound is played, this function stops it.
Return type: | int |
---|