Megaton
27-10-2007 13:34:07
Hi there.
I'm trying to use plib to play some sound effects but I ran into a problem. I can play a sound if I call playSample before I start calling update() in the main loop. If I call playSample after the first call to update(), then I don't hear any sound.
Perhaps I am doing this wrong?
Here is a modified version of the Demo_Sound.py that ships with Python Ogre 1.1. I am trying to get it to play a sound a few seconds into the main loop. But in this example I only hear the sound once, from the first call to playSample.
Any help would be appreciated
I'm trying to use plib to play some sound effects but I ran into a problem. I can play a sound if I call playSample before I start calling update() in the main loop. If I call playSample after the first call to update(), then I don't hear any sound.
Perhaps I am doing this wrong?
Here is a modified version of the Demo_Sound.py that ships with Python Ogre 1.1. I am trying to get it to play a sound a few seconds into the main loop. But in this example I only hear the sound once, from the first call to playSample.
import ogre.addons.plib as plib
import time
sched = plib.slScheduler ( 8000 )
mixer = plib.smMixer ( "/dev/mixer" )
mixer.setMasterVolume ( 50 )
sched.setSafetyMargin ( 0.128 )
s1 = plib.slSample ( 'wheeee.ub', sched )
s2 = plib.slSample ( 'zzap.wav', sched )
s1.adjustVolume ( 10.0 )
print dir(sched)
sched.playSample ( s1 ) # Only play this once
tim = 0
while ( 1 ):
tim+=1
time.sleep ( 1 / 30 ) ## simulate 30 frames per second
sched.update ()
if tim == 300000:
print "A few seconds later, play another sound"
sched.playSample(s1)
Any help would be appreciated
