Doesn't seem to work...
Blitz3D Forums/Blitz3D Beginners Area/Doesn't seem to work...
| ||
I was looking through the help file today and I noticed the SoundPan and SoundVolume commands, so I thought I'd write a little demo to see how they work... Ok, here's the code: ;sound program main=LoadSound( "C:/3dgame/Synth3[1].wav" ) LoopSound main ;SoundPan main,0 ;SoundVolume main,0.5 PlaySound(main) Global pan=0 Global vol=0.5 While Not KeyHit(1) If KeyHit(203) Then pan=pan+0.3 If KeyHit(205) Then pan=pan-0.3 If KeyDown(200) Then vol=vol+0.3 If KeyDown(208) Then vol=vol-0.3 SoundPan main,pan SoundVolume main,vol Wend End This should make the sound go --> when I press --> and <-- when I press <--. It should a lso increase the volume when I press up, down when I....etc.etc. But it doesn't work. Simple as that. It just plays the sound in a loop, and that's it. Anyone? |
| ||
your 'pan' variable is an integter, so adding 0.3 won't do anything: in "pan+0.3" pan is converted to a float, and then it adds add 0.3, which once converted back to an integer (in oreder to affect it to 'pan' again) gives the same result. Do "Global pan#=0" (same for volume BTW). Simple :) |
| ||
Try this.....;sound program main=LoadSound( "main.wav" ) LoopSound main ;SoundPan main,0 ;SoundVolume main,0.5 channelwave=PlaySound(main) Global pan#=0 Global vol#=0.1 While Not KeyHit(1) If KeyDown(203) Then pan=pan+0.01 If KeyDown(205) Then pan=pan-0.01 If KeyDown(200) Then vol=vol+0.01 If KeyDown(208) Then vol=vol-0.01 ChannelPan channelwave,pan ChannelVolume channelwave,vol Wend End bolo loco |
| ||
Thanks a lot!! |