play sound while the wheel spins only
Blitz3D Forums/Blitz3D Programming/play sound while the wheel spins only
| ||
I am finishing my slots game. I am having trouble playing a soundclip of music ONLY while the wheels are spinning. The wheels spin using a flag: wheelsarespinning = true (or false) during the main game loop. If I create a sub while wend loop nothing happens on screen. possibly I have created it wrongly. I tried stopchannel and channelplay etc. No joy. Has anyone else had this problem? |
| ||
assuming you have already loaded the sound (ie wheelspinsound=loadsound("something.wav") outside of your main loop then on the first frame that the wheels start spinning, or when the user pulls the slot machine arm do this: wheelspinchannel=playsound(wheelspinsound) then when the wheels stop spinning run the command if soundplaying(wheelspinchannel)<>0 then stopchannel(wheelspinchannel) |
| ||
Here's how I'd do it: Make your spinning sound a seamless audio loop, at a constant pitch. When you play the sound, control its volume and speed to match the speed of the spinning wheels. Using the SoundPitch command, you can control the speed of the sound---which causes the pitch to change. |
| ||
Both ideas are great... gonna try them both tonight! What you might be interested in knowing is it is my version of the "Lone Ranger Theme" (from Will Tell Overture) for my slot machine. {Edit:: Matty it is Channelplaying(soundchannel) but never mind... it works... my wife nearly swallowed her gum when I asked her to test it she laughed too hard!!! It is kind of a chipmunk version of the Lone Ranger theme... ;) RZ |
| ||
You let your wife chew gum ??? Next you'll be giving her the vote !! ;-) |
| ||
Never!!! Oink oink oink... ;) |