Relayer
Joined: 24 Nov 2008 Posts: 68
|
Posted: Wed Jan 06, 2010 3:51 pm Post subject: Fun: Sound effects for meetings |
|
|
I like to do unexpected things in meetings to liven things up at times. Sound effects like a game show BUZZZZ can be hilarious if your timing is right. I wanted a quick way to launch into an app that would let me play any wav file in a directory with minimal keystrokes while controlling the volume. Again, timing is everything, right? So, I wrote this script. Enjoy.
It launches into a directory you choose as default but allows navigation to other directories. Escape will terminate a long playing file if it needs to be killed early.
-Relayer
| Code: | #SingleInstance Force
#NoEnv
EffectsPath = C:\utilities\WAV
initVol = 4
Gui: ;build gui based on files in a directory
Gui, Font, s8 w700
Gui, Add, Edit, x16 y17 w140 h20 , %EffectsPath%
Gui, Add, Button, gBrowse x156 y17 w60 h20 , Browse
Gui, Add, Edit, y17 w40
Gui, Add, UpDown, Group vVol gVol xp Range1-10, %initVol%
Gui, Add, Radio, vRadVol gRadVol y17, 1
Gui, Add, Radio, gRadVol y17, 2
Gui, Add, Radio, gRadVol y17, 3
Gui, Add, Radio, gRadVol Checked y17, 4
Gui, Add, Radio, gRadVol y17, 5
Gui, Add, Radio, gRadVol y17, 6
Gui, Add, Radio, gRadVol y17, 7
Gui, Add, Radio, gRadVol y17, 8
Gui, Add, Radio, gRadVol y17, 9
Gui, Add, Radio, gRadVol y17, 10
Loop, %EffectsPath%\*.wav
if (A_Index = 1)
Gui, Add, Button, gPlayIt x16 section, %A_LoopFileName% ;make this a section
else
{
if(mod(A_Index,25) = 1)
Gui, Add, Button, gPlayIt ys , %A_LoopFileName%
else
Gui, Add, Button, gPlayIt , %A_LoopFileName%
}
Gui, Show
Return
PlayIt:
Gui, Submit, NoHide
;msgbox, %A_Gui% `n %A_GuiControl% `n %A_GuiEvent% `n %A_EventInfo%
wav = %EffectsPath%\%A_GuiControl%
SoundGet, mastermute, Master, Mute
;msgbox, %mastermute%
SoundGet, mastervol, Master, Volume
SoundGet, wavemute, Wave, Mute
SoundGet, wavevol, Wave, Volume
SoundSet, (10 * Vol), Master, Volume ;temporary volume handled in 10 rough steps (adequate for meetings, hehehe!)
SoundSet, (10 * Vol), Wave, Volume
SoundSet, Off, Master, Mute
SoundSet, Off, Wave, Mute
SoundPlay, %wav%, Wait
if mastermute = On
SoundSet, 1, Master, Mute
SoundSet, mastervol, Master, Volume
if wavemute = On
SoundSet, 1, Wave, Mute
SoundSet, wavevol, Wave, Volume
Return
Escape:: ;esc will terminate a playing sound
SoundPlay, Nonexistent.wav
Return
GuiClose:
ExitApp
Browse:
FileSelectFolder, EffectsPath, C:\utilities\WAV
Gui, Submit
initVol = %Vol%
Gui, Destroy
GoSub, Gui
Return
Vol:
Gui, Submit, NoHide
initVol = %Vol%
junk := initVol+1 ;found using spy that radio button number is +1 my volume index
;msgbox, %junk%
GuiControl, , Button%junk% , 1
Return
RadVol:
Gui, Submit, NoHide
initVol = %RadVol%
GuiControl, ,Vol , %RadVol%
Return
|
|
|