Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Pass the Parcel - Randomly turn on and off windows sound

by Melly (Hermit)
on Jan 31, 2010 at 10:16 UTC ( #820563=CUFP: print w/ replies, xml ) Need Help??

I needed a quick way to randomly turn the sound on and off for a game of pass the parcel...

use strict; use Win32::Sound; # the params are the lower and upper range - #i.e. what is the least and most possible seconds for either the music +/silence stage? my $min = $ARGV[0]; my $max = $ARGV[1]; my $sound = Win32::Sound::Volume(); while(1){ sleep int((rand($max-$min)+0.5)+$min); Win32::Sound::Volume() ? (Win32::Sound::Volume(0)) : (Win32::Sound:: +Volume($sound)); } __END__ 4, 9 seem okay params
map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm (at) cursingmaggot (stop) co (stop) uk

Comment on Pass the Parcel - Randomly turn on and off windows sound
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://820563]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2015-07-05 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls