Sound objects have the following functions:
[times=1, interval=0, callback=None]) |
Starts playback of an audio file from the beginning. Without the parameters times and interval it plays the audio file one time. times defines the number of times the audio file is played, the default being 1. If the audio file is played several times, interval gives the time interval between the subsequent plays in microseconds.
The optional callback is called when the playing starts and when the end of the
sound file is reached. The callback should take three parameters: the previous
state, the current state and the possible error code. The possible states given
as parameters to the callback are data items in the module audio
.
Other issues:
play(audio.KMdaRepeatForever)
will repeat the file forever.
stop
needs to be called explicitly prior to exit.
play
to a second Sound instance while another audio file is playing, stops the earlier audio file and starts to play the second Sound instance.
play
while a telephone call is ongoing plays the sound file to uplink. In some devices the sound file is also played to the device speaker.
play
when already playing or recording results in RuntimeError
. Calling stop
prior to play
will prevent this from happening.
) |
) |
record
while a telephone call is ongoing starts the recording of the telephone call.
record
when already playing or recording results in RuntimeError
. Calling stop
prior to record
will prevent this from happening.
) |
) |
ENotReady
EOpen
EPlaying
ERecording
) |
volume) |
Sets the volume. If the given volume is negative, then the volume is set to
zero which mutes the device. If the volume is greater than max_volume
,
then max_volume
is used.
) |
) |
microseconds) |
) |