Thread Tools Display Modes
06-04-11, 03:34 AM   #1
tobindax
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 53
Thumbs up Volume control (20% -> 80%)

This sounds simple but bizarrely google doesn't give any easy results.

I need a macro that once hit it gives audio to 80%. (global audio) When hit again it gives 20%.

It can be two macros, it doesn't matter.



Is there such a command at all?
  Reply With Quote
06-04-11, 04:13 AM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
You could make a macro that checks your current volume level first, but that might be a little too complicated.

I use this:

Code:
SlashCmdList.VOLUME = function(val)
	SetCVar("Sound_MasterVolume", val)
end
SLASH_VOLUME1 = "/vol"
So you can type /vol <number>, or just make a macro with the volume you want.
  Reply With Quote
06-04-11, 05:20 AM   #3
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by tobindax View Post
I need a macro that once hit it gives audio to 80%. (global audio) When hit again it gives 20%.
I would use a macro with a global variable eg.
Code:
/run local MV = GetCVar("Sound_MasterVolume") if MV == "0.2" then SetCVar("Sound_MasterVolume", 0.8) elseif MV == "0.8" then SetCVar("Sound_MasterVolume", 0.2) else SetCVar("Sound_MasterVolume", 0.8) end
This will check for the actual MasterVolume variable and will set it to
80% if it is at 20%
20% if it is at 80%
80% if it is at any other value
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 06-04-11 at 05:24 AM.
  Reply With Quote
06-04-11, 06:16 AM   #4
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
does this also work? (provided it's already at 0.2 or 0.8)
Code:
/run local a="Sound_MasterVolume"SetCVar(a,1-GetCVar(a))
  Reply With Quote
06-04-11, 09:44 AM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Ketho View Post
does this also work? (provided it's already at 0.2 or 0.8)
Code:
/run local a="Sound_MasterVolume"SetCVar(a,1-GetCVar(a))
With a script that short, I'd even forgo creating a new variable each time it's pressed.
Code:
/run SetCVar("Sound_MasterVolume",1-GetCVar("Sound_MasterVolume"))
To make sure your volume is at 0.2 (or 0.8) before running the above macro...
Code:
/run SetCVar("Sound_MasterVolume", 0.2)

/edit: Ketho's script works because .2 + .8 = 1 If you want other values (that don't add up to 1), then you'd need a different script.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Volume control (20% -> 80%)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off