PDA

View Full Version : Control volume with slider


djones1010
02-28-2009, 09:24 PM
I am currently working the Options page of my project.
I am having some trouble controlling the volume with a slider.
The desired result I want is to increase and decrease in volume and with each movement of the tick and have the sound play back with the change value for volume.

Could someone help me or give me a few hints?

Thanks

DBurks2818
03-01-2009, 06:28 PM
Here's something my team made for our game:

song = viz.add('[insert song].mp3')
song.play()
song.volume(1.0)

viz.clearcolor(0.5,0.5,1)

def myslider(obj, pos):
song.volume(0.8*pos)

viz.callback(viz.SLIDER_EVENT,myslider)

I couldn't quite get it at first either, but it turned out to be pretty simple.