;;; 2006 GavinQuinn mxTitle= Mx Volume Control v0.2 #NoTrayIcon #SingleInstance, force FileInstall, mxVolume.ini, %A_ScriptDir%\mxVolume.ini, 0 FileInstall, mxVolume.html, %A_ScriptDir%\mxVolume.html, 0 FileInstall, mxVolume.gif, %A_ScriptDir%\mxVolume.gif, 0 FileInstall, blistering.gif, %A_ScriptDir%\blistering.gif, 0 FileInstall, blisteringsoft.css, %A_ScriptDir%\blisteringsoft.css, 0 FileInstall, Soundcard Info.ahk, %A_ScriptDir%\Soundcard Info.ahk, 0 mxIni=%A_ScriptDir%\mxVolume.ini iniRead, mxdb, %mxIni%, settings, Debug iniRead, mxSwitch, %mxIni%, settings, Switch iniRead, mxFunction, %mxIni%, settings, Function iniRead, mxToggle, %mxIni%, settings, Toggle iniRead, mxPox, %mxIni%, settings, WinPosAcross If mxPox not between 0 and %A_ScreenWidth% { mxPox=100 } iniRead, mxPoy, %mxIni%, settings, WinPosDown If mxPoy not between 0 and %A_ScreenHeight% { mxPoy=100 } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iniRead, mxCdAudio, %mxIni%, settings, CdAudioApp IfNotExist %mxCdAudio% { mxCdAudio=%A_WinDir%\CdPlayer.exe } iniRead, mxHard, %mxIni%, settings, HardInfo IfNotExist %mxHard% { mxHard=%A_ScriptDir%\Soundc~1.ahk } iniRead, mxHelp, %mxIni%, settings, Help IfNotExist %mxHelp% { mxHelp=%A_ScriptDir%\mxvolume.html } iniRead, mxMix1, %mxIni%, settings, Mixer1 IfNotExist %mxMix1% { mxMix1=%A_WinDir%\SndVol32.exe } iniRead, mxMix2, %mxIni%, settings, Mixer2 IfNotExist %mxMix2% { mxMix2=%A_WinDir%\SndVol32.exe /Record } iniRead, mxPhone, %mxIni%, settings, PhoneApp IfNotExist %mxPhone% { mxPhone=%A_WinDir%\Dialer.exe } iniRead, mxWavApp, %mxIni%, settings, WaveApp IfNotExist %mxWavApp% { mxWavApp=%A_WinDir%\Sndrec32.exe } iniRead, mxWavAppt, %mxIni%, settings, WaveAppTitle IfNotExist %mxWavAppt% { mxWavAppt=Sndrec32.exe } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Gosub, mxGet Gui, Font, Bold Gui, Color, 111111 ;--------------------------------------- Gui, Add, Text,section x22 y22 gmxSet v111 cLime, %mx1t% Gui, Add, Text, cLime h33 w30 Gui, Add, UpDown, gmxState v1, %mx1x% Gui, Add, Checkbox, gmxState v11 checked%mx1y% yp+35 xp+15 Gui, Add, Text,ys gmxSet v222 cRed, %mx2t% Gui, Add, Text, cRed h33 w30 Gui, Add, UpDown, gmxState v2, %mx2x% Gui, Add, Checkbox, gmxState v22 checked%mx2y% yp+35 xp+15 Gui, Add, Text,ys gmxAnswer cAqua, %mx3t% Gui, Add, Text, cAqua h33 w30 Gui, Add, UpDown, gmxState v3, %mx3x% Gui, Add, Checkbox, gmxState v33 checked%mx3y% yp+35 xp+15 Gui, Add, Text,ys gmxRecord v444 cAqua, %mx4t% Gui, Add, Text, cAqua h33 w30 Gui, Add, UpDown, gmxState v4, %mx4x% Gui, Add, Checkbox, gmxState v44 checked%mx4y% yp+35 xp+15 Gui, Add, Text, ys gmxCdAudio v555 cTeal, %mx5t% Gui, Add, Text, cTeal h33 w30 Gui, Add, UpDown, gmxState v5, %mx5x% Gui, Add, Checkbox, gmxState v55 checked%mx5y% yp+35 xp+15 Gui, Add, Text, ys gmxSet v666 cPurple, %mx6t% Gui, Add, Text, cPurple h33 w30 Gui, Add, UpDown, gmxState v6, %mx6x% Gui, Add, Checkbox, gmxState v66 checked%mx6y% yp+35 xp+15 Gui, Add, Text, ys gmxSet v777 cOlive, %mx7t% Gui, Add, Text, cOlive h33 w30 Gui, Add, UpDown, gmxState v7, %mx7x% Gui, Add, Checkbox, gmxState v77 checked%mx7y% yp+35 xp+15 Gui, Add, Text, ys gmxSet v888 cGreen, %mx8t% Gui, Add, Text, cGreen h33 w30 Gui, Add, UpDown, gmxState v8, %mx8x% Gui, Add, Checkbox, gmxState v88 checked%mx8y% yp+35 xp+15 Gui, Add, Text, ys xp+20 yp-62.5 gmxSet v999 cGreen, %mx9t% Gui, Add, Text, cGreen Right h33 Gui, Add, UpDown, Left gmxState v9, %mx9x% ;--------------------------------------- Gui, Add, Text, ys xp+60 gmxSet vAAA cLime, %mxAt% Gui, Add, Text, cLime h33 w30 Gui, Add, UpDown, gmxState vA, %mxAx% Gui, Add, Checkbox, gmxState vAA checked%mxAy% yp+35 xp+15 Gui, Add, Text, ys gmxSet vBBB cRed, %mxBt% Gui, Add, Text, cRed h33 w30 Gui, Add, UpDown, gmxState vB, %mxBx% Gui, Add, Checkbox, left gmxState vBB checked%mxBy% yp+35 xp+15 ;--------------------------------------- Gui, Add, Text, xp+38 yp-66 gmxHelp cYellow, ? Gui, Add, Text, xp-2 yp+22 gmxFresh cLime, @ Gui, Add, Text, xp+2 yp+22 gmxMixer1 cGreen, < Gui, Add, Text, xp yp+22 gmxMixer2 cRed, # Gui, Add, GroupBox, cBlue x6 y6 w504 h100, Upstairs Gui, Add, GroupBox, cPurple x514 y6 w110 h100, Downstairs ;--------------------------------------- Gui, Font, norm Gui, Show, x%mxPox% y%mxPoy%, %mxTitle% Return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2ButtonDone: 2GuiClose: 2GuiEscape: tooltip, Gui, 1: -Disabled If mxdb = 1 { MsgBox, Close Gui 2 } Gui, 2:Destroy Return mxExit: GuiEscape: GuiClose: Gosub, mxPos ExitApp mxDecode: StringRight, mxS, A_GuiControl, 1 mxDecode2: a0:=mx%mxS%t a1:=mx%mxS%f Loop, parse, mxFunction, | { If A_LoopField = %a1% { b1=%A_Index% } } a2:=mx%mxS%n a3:=mx%mxS%s Loop, parse, mxSwitch, | { If A_LoopField = %a3% { b3=%A_Index% } } a4:=mx%mxS%g Loop, parse, mxToggle, | { If A_LoopField = %a4% { b4=%A_Index% } } a5:=mx%mxS%d If mxdb = 1 { Tooltip, mxS=%mxS% a0=%a0% a1=%a1% a2=%a2% a3=%a3% a4=%a4% a5=%a5% } Return mxMute: If %mxx%=0 { %mxx%=1 } Else { If %mxx%=1 { %mxx%=0 } } Return mxOn1Off0: If mxx = On { mxx=1 } If mxx = Off { mxx=0 } Return mxPos: WinGetPos, mxPox, mxPoy, , , %mxTitle% iniWrite, %mxPox%, %mxIni%, settings, WinPosAcross iniWrite, %mxPoy%, %mxIni%, settings, WinPosDown Return mxSave: 2ButtonSave: Gosub mxDecode2 a0:=mx%mxS%t a1:=mx%mxS%f a2:=mx%mxS%n a3:=mx%mxS%s a4:=mx%mxS%g a5:=mx%mxS%d If mxdb = 1 { Tooltip, mxS=%mxS% a0=%a0% a1=%a1% a2=%a2% a3=%a3% a4=%a4% a5=%a5% } iniWrite, %a0%, %mxIni%, %mxS%, Title iniWrite, %a1%, %mxIni%, %mxS%, Function iniWrite, %a2%, %mxIni%, %mxS%, FNum iniWrite, %a3%, %mxIni%, %mxS%, Switch iniWrite, %a4%, %mxIni%, %mxS%, Toggle iniWrite, %a5%, %mxIni%, %mxS%, Dev Return mxSet: Gui, 1: +Disabled Gosub mxDecode Gui, 2:Font, Bold cYellow Gui, 2:Color, 111111, ControlColor Gui, 2:Color, 111111, WindowColor Gui, 2:Add, Text, gmxIniFile,Title Gui, 2:Add, Edit, ys xp+48 w76 gmxSett, %a0% Gui, 2:Add, Button, xp+78 yp+1 h20, Save Gui, 2:Add, Button, xp+44 yp-1 h22 w156 default, Done Gui, 2:Add, Text, xs gmxHardInfo,Device Gui, 2:Add, DropDownList, xp+48 r4 w30 gmxSetd choose%a5%, 1|2|3|4 Gui, 2:Add, DropDownList, xp+30 r11 w92 gmxSetf choose%b1%, %mxFunction% Gui, 2:Add, DropDownList, xp+92 w64 gmxSets choose%b3%, %mxSwitch% Gui, 2:Add, DropDownList, xp+64 r7 w34 gmxSetn choose%a2%, %A_Space%|2|3|4|5|6|7|8 Gui, 2:Add, DropDownList, xp+34 w56 gmxSetg choose%b4%, %mxToggle% Gui, 2:Show, , Configurator Gui, 2:Font, norm Gui, 2: +AlwaysOnTop Return mxSetd: GuiControl, 1:, %a5%, %A_GuiControl% a5=%A_GuiControl% mx%mxS%d=%a5% Return mxSetf: GuiControl, 1:, %a1%, %A_GuiControl% a1=%A_GuiControl% mx%mxS%f=%a1% Return mxSetg: GuiControl, 1:, %a4%, %A_GuiControl% a4=%A_GuiControl% mx%mxS%g=%a4% Return mxSetn: GuiControl, 1:, %a2%, %A_GuiControl% a2=%A_GuiControl% mx%mxS%n=%a2% Return mxSets: GuiControl, 1:, %a3%, %A_GuiControl% a3=%A_GuiControl% mx%mxS%s=%a3% Return mxSett: a6=%A_GuiControl% SetTitleMatchMode, 2 GuiControl, 1:, %a0%, %a6% If mxdb = 1 { Tooltip, GuiCtrl=%A_GuiControl% `nmxa6=%a6% `nmx?t=mx%mxS%t `na0=%a0% `na1=%a1% `na2=%a2% `na3=%a3% `na4=%a4% `na5=%a5% } a0=%A_GuiControl% mx%mxS%t=%a0% a6= Return mxState: StringLen, a0, A_GuiControl If a0 = 1 { mxS=%A_GuiControl% } Else { StringRight, mxS, A_GuiControl, 1 } a1:=mx%mxS%f a2:=mx%mxS%n a5:=mx%mxS%d If a0 = 1 { a3:=mx%mxS%s a6:=%mxS% SoundSet, %a6%, %a1%`:%a2%, %a3%, %a5% } Else { a3:=mx%mxS%g a6=1%mxS% mxx=mx%mxS%y Gosub mxMute a7:=mx%mxS%y SoundSet, %a7%, %a1%`:%a2%, %a3%, %a5% } If mxdb = 1 { Tooltip, aa=%aa% `nmxS=%mxS% `na3=%a3% `na6=%a6% `na7=%a7% } a0= a1= a2= a3= a5= a6= a7= Return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mxAnswer: Run, %mxPhone% %mxPhopt% mxFresh: Gosub, mxPos Reload Return mxHardInfo: Gosub SndCrd ;Run, %mxHard% Return mxHelp: Run, %mxHelp% Return mxCdAudio: Run, %mxCdAudio% Return mxIniFile: Run, %mxIni% Return mxRecord: Run, %mxWavApp% Return mxMixer1: Run, %mxMix1% Return mxMixer2: Run, %mxMix2% Return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mxGet: Cyc=1 Loop, 11 { iniRead, mx%Cyc%d, %mxIni%, %Cyc%, Dev If mx%Cyc%d = { mx%Cyc%d=1 } iniRead, mx%Cyc%f, %mxIni%, %Cyc%, Function If mx%Cyc%f = { mx%Cyc%f=Master } iniRead, mx%Cyc%n, %mxIni%, %Cyc%, FNum If mx%Cyc%n= { mx%Cyc%n= } iniRead, mx%Cyc%s, %mxIni%, %Cyc%, Switch If mx%Cyc%s= { mx%Cyc%s=Volume } iniRead, mx%Cyc%g, %mxIni%, %Cyc%, Toggle If mx%Cyc%g= { mx%Cyc%g=0 } iniRead, mx%Cyc%t, %mxIni%, %Cyc%, Title If mx%Cyc%t = ERROR { mx%Cyc%t=mx%Cyc%f } a0:=mx%Cyc%t a1:=mx%Cyc%f a2:=mx%Cyc%n a3:=mx%Cyc%s a4:=mx%Cyc%g a5:=mx%Cyc%d SoundGet, mx%Cyc%x, %a1%`:%a2%, %a3%, %a5% a6:=mx%Cyc%x SoundGet, mx%Cyc%y, %a1%`:%a2%, %a4%, %a5% a7:=mx%Cyc%y mxx=%a7% Gosub mxOn1Off0 mx%Cyc%y=%mxx% ;a8:=mx%Cyc%y ;tooltip, mx%Cyc%y %a7% %mxx% %a8% If mxdb = 1 { Msgbox, %a0% `n%a1%:%a2% %a3% ,%a5% `n%a1%:%a2% %a4% ,%a5% `n%a6% `n%a7% } a0= a1= a2= a3= a4= a5= a6= a7= a8= If Cyc < 9 { Cyc++ } Else { If Cyc = A { Cyc=B } If Cyc = 9 { Cyc=A } } } Return SndCrd: ; SOUNDCARD ANALYSIS ; Use the following script to discover your soundcard's capabilities (component types and control types). ; This script requires v1.0.36+ because it uses a ListView. SetBatchLines -1 SplashTextOn,,, Gathering Soundcard Info... ; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness. ; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER, ; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX, ; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME ControlTypes = VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000, 0x10010000,0x10020000,0x10020001,0x10030000,0x20010000,0x21010000,0x30040000,0x30020000,0x30030000,0x30050000,0x40020000,0x50030000,0x70010000,0x70010001,0x71010000,0x71010001,0x60030000,0x61030000 ComponentTypes = MASTER,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A ; Create a ListView and prepare for the main loop: Gui, 3:Add, Listview, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer LV_ModifyCol(4, "Integer") SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two. Loop ; For each mixer number that exists in the system, query its capabilities. { CurrMixer := A_Index SoundGet, Setting,,, %CurrMixer% if ErrorLevel = Can't Open Specified Mixer ; Any error other than this indicates that the mixer exists. break ; For each component type that exists in this mixer, query its instances and control types: Loop, parse, ComponentTypes, `, { CurrComponent := A_LoopField ; First check if this component type even exists in the mixer: SoundGet, Setting, %CurrComponent%,, %CurrMixer% if ErrorLevel = Mixer Doesn't Support This Component Type continue ; Start a new iteration to move on to the next component type. Loop ; For each instance of this component type, query its control types. { CurrInstance := A_Index ; First check if this instance of this instance even exists in the mixer: SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer% ; Checking for both of the following errors allows this script to run on older versions: if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type break ; No more instances of this component type. ; Get the current setting of each control type that exists in this instance of this component: Loop, parse, ControlTypes, `, { CurrControl := A_LoopField SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer% ; Checking for both of the following errors allows this script to run on older versions: if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type continue if ErrorLevel ; Some other error, which is unexpected so show it in the results. Setting := ErrorLevel ComponentString := CurrComponent if CurrInstance > 1 ComponentString = %ComponentString%:%CurrInstance% LV_Add("", ComponentString, CurrControl, Setting, CurrMixer) } ; For each control type. } ; For each component instance. } ; For each component type. } ; For each mixer. Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents. LV_ModifyCol(A_Index, "AutoHdr") SplashTextOff Gui, 3:Show return ;GuiClose: ;ExitApp