Panda3D Manual: Manipulating Sounds
Looping a SoundTo cause a sound to loop (i.e., cause it to repeat once it is finished playing) do the following:
mySound.setLoop(True)
To stop a sound from looping pass False in the setLoopfunction.
mySound.setLoop(False)
Sounds can also be looped for a certain number of times:
mySound.setLoopCount(n)
Where 'n' can be any positive integer. 0 will cause a sound to loop forever. 1 will cause a sound to play only once. >1 will cause a sound to loop that many times. NOTE Setting a sound's loop count will automatically set a sound's loop flag to 0 or >1 will automatically Notes on Looping Sounds SeamlesslyLooping a sound seamlessly should be as simple as loading the sound, then calling
So the easiest way to get a reliable looping sound is to use wav files, and to use Cueing TimeThere are
mySound.length()
will return the length of a sound file in seconds.
mySound.getTime()
will get the current time the 'playback head' of a sound is at in seconds.
mySound.setTime(n)
will set the 'playhead head' of a sound to n (where is seconds). NOTE Sounds will start playing IMMEDIATELY after the command is issued, and calling Changing Playback SpeedTo change a sound's playback speed, use:
mySound.setPlayRate(n)
Where Negative numbers will play a sound backwards. Passing the value 0 will pause the sound. You can also get a sound's play rate with:
mySound.getPlayRate()
© Carnegie Mellon University 2010 |