View Single Post
  #1  
Old 02-28-2008, 03:48 AM
Robbos Robbos is offline
Member
 
Join Date: Feb 2008
Posts: 1
Question On click Sound Play Problems

Hi i am also a university student on the same project as "Psirus" (who recently joined) and have run into a problem similar to his but cannot seem to find the solution within the help he was given.

I wish to make a set of spheres all emit sound but the sound be muted until they are clicked and effectively "activated"

I have managed to get an error message on click (which means my onpick command is obviously working (YAY)), and can remove the error message by adding the relevant variable at the end, but the sound does still not play.

Hopefully someone can shed some light.. Heres my code... Thanks in advance

import viz
viz.STEREO
viz.go()
#smallballs
sball1 = viz.add('sb1.wrl')
##sball2 = viz.add('sb1.wrl')
##sball3 = viz.add('sb1.wrl')
##sball4 = viz.add('sb1.wrl')
##sball5 = viz.add('sb1.wrl')
##sball6 = viz.add('sb1.wrl')

These are commented out until i can get one working

#making music play when click on a sphere
def soundToggle1(sball1):
sball1.active = not sball1.active
if sball1.active:
sball1.audio.volume(1)
else:
sball1.audio.volume(0)
########active sound on click
sball1.audio = viz.addAudio('sound1.wav',loop=True,volume=0.0)
sball1.active = False
vizact.onpick(sball1,soundToggle1,sball1)

The bit in red is the bit that can remove the error message but does nothing.
Reply With Quote