PDA

View Full Version : 3D sound problem?


shahramy
05-28-2010, 08:44 AM
hi
I have used 3D sound attached in one of my node and I want play sound when I press specific key. it`s done but while i hold down the key. the sound does not play sequentially and it plays with a little interval and its not good for me.
has any body idea ?

Jeff
05-28-2010, 09:51 AM
So you want to play a looping sound when a key is pressed? If so, look at the following:
import viz
viz.go()

ball = viz.add('ball.wrl',pos = [0,2,8])

sound = ball.playsound('boing!.wav', viz.PAUSE)

#play and pause looping sound with keypresses
vizact.onkeydown('1',sound.play,viz.LOOP)
vizact.onkeydown('2',sound.pause)