:: ---- :: :: 'ControlVAC.cmd' is a Batch file to start a Virtual Audio Cable setup :: - by Nick @ FoolishIT.com [Foolish IT LLC] :: - Last Modified 2016-08-04 @ 9:11pm ET :: - Official Download: https://download.foolishit.com/Scripts/ControlVAC.cmd.txt :: :: First-Time Usage Configuration Requirements :: :: 1. Configure the Virtual Audio Cable Control Panel with 4 virtual audio cables :: * Under 'Driver parameters' set 'Cables' to 4, then click the 'Set' button. :: * Under 'Worker threads' set both drop down boxes to 'Auto' :: * Click the 'Restart Audio Engine' button below. :: * Highlight each 'Cable' that appears in the lower white window then: :: - Connected Source Lines (top right) = Line (only) :: - Check 'Volume control' under that :: - Uncheck 'Enable spk pin' under that :: - Check 'Enable channel mixing' to the left :: - Uncheck 'Use PortCls' under that :: - In 'Stream Buffer' (ms) to the right, select 'Auto' (this uses lowest buffer allowed by hardware) :: - Click 'Set' button below that to save (before highlighting a different cable to make the changes for that!) :: * Click the 'Restart Audio Engine' button again. :: :: 2. Configure Windows Default Audio Devices: :: * Set 'Recording' to 'Line 1 (Virtual Audio Cable)' :: * Set 'Playback' to 'Line 2 (Virtual Audio Cable)' :: :: 3. Configure Meeting App: (e.g. RingCentral Meetings/Google Hangouts/etc.) :: * Set 'Speaker' to 'Line 3 (Virtual Audio Cable)' :: * Set 'Mic' to 'Line 1 (Virtual Audio Cable)' :: :: 3a. (Optional) Configure Green Screen App Audio Recording Device: (e.g. SparkoCam in Settings > Recording) :: * Set 'Audio Device' to 'Line 4 (Virtual Audio Cable)' :: :: 3. Set Variables in the block below: :: * These are unique to your system audio devices! :: * VAC will only accept the first 31 characters of the name of the audio device, so here you must duplicate the names exactly as :: they appear in the VAC 'Audio Repeater MME' > Wave in/out drop down boxes (not in device manager) and with NO trailing spaces. :: * UNCOMMENT 'YouWereHere=1' AT THE BEGINNING OF THE VARIABLE SET BLOCK (remove the '::' from the start of the line) :: :: Notes: :: :: - To execute this batch file, you must first rename 'ControlVAC.cmd.txt' to 'ControlVAC.cmd' if not done already :: AND YOU MUST COMPLETE THE CONFIGURATION STEPS ABOVE! :: :: - Run 'ControlVAC.cmd help' to show command line parameter usage and examples. :: :: - Requires admin permissions (e.g. right-click then select 'Run as Administrator' from Explorer when UAC is enabled.) :: :: - Simplicity (and fewer Audio Repeater processes) would beg piping virtual cables through other virtual cables, but this :: introduces a good bit of latency in my testing... :: :: ---- @echo off set "Me=%~0" set "HelpFile=%~dp0\%~n0 - Help.txt" :: -----< BEGIN VARIABLE SET BLOCK >---------------------------------------------------------------------------- :: the line below 'set EndPause=1' will pause at the end forcing you to press any key to terminate the batch file :: add '::' before 'set EndPause=1' to remove this behavior, terminating the cmd.exe window instantly :: (this setting is ignored entirely when using command line parameters, which always terminate instantly!) set EndPause=1 :: physical system audio devices (Speakers, Boom/Desk Mic, etc.) - comment the two lines below when not using external speakers/boom mic set "BoomMic=Microphone (4- AT2020 USB" set "Speakers=Speakers (Realtek High Definiti" :: physical system audio devices (1st Headset) - comment the two lines below if not including a headset set "HeadMic1=Headset Microphone (Sennheiser" set "HeadEar1=Headset Earphone (Sennheiser SD" :: physical system audio devices (1st Headset) - uncomment and set the two lines below when using two headsets set "HeadMic2=Headset Microphone (3- Sennheis" set "HeadEar2=Headset Earphone (3- Sennheiser" :: uncomment the line '::set YouWereHere=1' below to use this batch file! (remove the '::' from the beginning of the line) :: aren't you glad you read this far?! most everything else probably just needs a glance, maybe just the paths directly below, :: assuming you followed the instructions above without variation, and possibly the VAC settings below depending on how powerful :: your system is, BUT EVERYTHING ABOVE HERE ABSOLUTELY REQUIRES YOUR MODIFICATION!!! (it is very specific to my hardware!) ::set YouWereHere=1 :: default audio devices for Windows (Virtual Audio Cable, these shouldn't need to change) set "WinMic=Line 1 (Virtual Audio Cable)" set "WinSpkrs=Line 2 (Virtual Audio Cable)" :: audio outputs for meeting and recording apps (Virtual Audio Cable, these shouldn't need to change) set "MeetingOut=Line 3 (Virtual Audio Cable)" set "RecMix=Line 4 (Virtual Audio Cable)" :: path\filename variables for Virtual Audio Cable (these should NOT need modification) set "AudioDir=C:\Program Files\Virtual Audio Cable" set "VacCpExe=vcctlpan.exe" set "VacArExe=audiorepeater.exe" set "AudioCtl=%AudioDir%\%VacCpExe%" set "AudioRpt=%AudioDir%\%VacArExe%" :: VAC Audio Repeater settings for Meeting -> Speakers, Headsets, and Recording Mix set "Meet2SpkArgs=/BufferMs:100 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Meet2SpkChnl=5.1 surround" set "Meet2HeadArgs=/BufferMs:100 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Meet2HeadChnl=stereo" set "Meet2RecArgs=/BufferMs:100 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Meet2RecChnl=5.1 surround" :: VAC Audio Repeater settings for Mic -> Meeting and Recording Mix (to reduce latency for better lip sync!) set "Mic2MeetArgs=/BufferMs:100 /Buffers:12 /SamplingRate:96000 /BitsPerSample:16" set "Mic2MeetChnl=mono" set "Mic2RecArgs=/BufferMs:100 /Buffers:12 /SamplingRate:96000 /BitsPerSample:16" set "Mic2RecChnl=mono" :: VAC Audio Repeater settings for Windows Audio -> Speakers, Headsets, Meeting, and Recording Mix (sounds like garbage otherwise!) set "Win2SpkArgs=/BufferMs:500 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Win2SpkChnl=5.1 surround" set "Win2HeadArgs=/BufferMs:500 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Win2HeadChnl=stereo" set "Win2MeetArgs=/BufferMs:500 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Win2MeetChnl=5.1 surround" set "Win2RecArgs=/BufferMs:500 /Buffers:12 /SamplingRate:192000 /BitsPerSample:16" set "Win2RecChnl=5.1 surround" :: window names to identify the various VAC Audio Repeaters set "NameW2M=Windows Audio to Meeting" set "NameW2R=Windows Audio to Recording Mix" set "NameM2R=Meeting to Recording Mix" set "NameE2M=Boom Mic to Meeting" set "NameM2E=Meeting to Speakers" set "NameE2R=Boom Mic to Recording Mix" set "NameW2E=Windows Audio to Speakers" set "NameH12M=Headset-1 Mic to Meeting" set "NameM2H1=Headset-1 Meeting to Ear" set "NameH12R=Headset-1 Mic to Recording Mix" set "NameW2H1=Headset-1 Windows Audio to Ear" set "NameH22M=Headset-2 Mic to Meeting" set "NameM2H2=Headset-2 Meeting to Ear" set "NameH22R=Headset-2 Mic to Recording Mix" set "NameW2H2=Headset-2 Windows Audio to Ear" :: -----< END VARIABLE SET BLOCK >------------------------------------------------------------------------------ :: this block occurs before checking for admin permissions so help text can display without admin permissions. if not defined YouWereHere goto :CfgFail set PrintFile= if /i "[%1]" EQU "[help]" goto :ShowArgs if /i "[%1]" EQU "[printhelp]" ( set PrintFile=True goto :ShowArgs ) :: check for admin permissions, returns errorlevel 0 on success (has admin) :: 'fsutil dirty query %systemdrive% >nul 2>&1' only works in XP and above (but NOT in WinPE, use 'net session >nul 2>&1' there) :: but 'net session >nul 2>&1' fails if the 'server' service is not started (e.g. in safe mode, or just broken) but should work :: in WinPE, and also like 'fsutil...' it returns errorlevel 0 on success, but also errorlevel 2 if 'server' service is not started fsutil dirty query %systemdrive% >nul 2>&1 :: fail if not errorlevel 0 (success) if %errorlevel% NEQ 0 goto :PermFail :GetArgs :: skip processing of command line parameters if none passed if [%1] EQU [] goto :SkipArgs :: pass 'StartCP' to start the VAC Control Panel if /i "[%1]" EQU "[StartCP]" call :StartCP :: pass 'StopCP' to terminate the VAC Control Panel if /i "[%1]" EQU "[StopCP]" call :StopCP :: pass 'StopARs' to terminate all VAC Audio Repeaters if /i "[%1]" EQU "[StopARs]" call :StopARs :: pass 'StartMic' to start a desk/boom mic if /i "[%1]" EQU "[StartMic]" call :StartMic :: pass 'StopMic' to stop a desk/boom mic if /i "[%1]" EQU "[StopMic]" call :StopMic :: pass 'StartSpk' to start speakers (excluding Windows audio) if /i "[%1]" EQU "[StartSpk]" call :StartSpk :: pass 'StopSpk' to stop speakers (excluding Windows audio) if /i "[%1]" EQU "[StopSpk]" call :StopSpk :: pass 'StartExt' to start meeting output to both a desk/boom mic and speakers (excluding Windows audio) if /i "[%1]" EQU "[StartExt]" call :StartExt :: pass 'StopExt' to stop meeting output to both a desk/boom mic and speakers (excluding Windows audio) if /i "[%1]" EQU "[StopExt]" call :StopExt :: pass 'StartHS' to start defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StartHS]" call :StartHS :: pass 'StopHS' to stop defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StopHS]" call :StopHS :: pass 'StartH1' to start defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StartH1]" call :StartH1 :: pass 'StopH1' to stop defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StopH1]" call :StopH1 :: pass 'StartH2' to start defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StartH2]" call :StartH2 :: pass 'StopH2' to stop defined headsets (excluding Windows audio) if /i "[%1]" EQU "[StopH2]" call :StopH2 :: pass 'StopMHS' to stop only the mic on all defined headsets if /i "[%1]" EQU "[StopMHS]" call :StopMHS :: pass 'StopMH1' to stop only the mic on headset x (where x = the last character) if /i "[%1]" EQU "[StopMH1]" call :StopMH1 :: pass 'StopMH2' to stop only the mic on headset x (where x = the last character) if /i "[%1]" EQU "[StopMH2]" call :StopMH2 :: pass 'StartW2S' to start Windows audio output to the speakers if /i "[%1]" EQU "[StartW2S]" call :StartW2S :: pass 'StopW2S' to stop Windows audio output to the speakers if /i "[%1]" EQU "[StopW2S]" call :StopW2S :: pass 'StartW2HS' to start Windows audio output to all defined headsets if /i "[%1]" EQU "[StartW2HS]" call :StrtW2HS :: pass 'StopW2HS' to stop Windows audio output to all defined headsets if /i "[%1]" EQU "[StopW2HS]" call :StopW2HS :: pass 'StartW2H1' to start Windows audio output to headset x (where x = the last character) if /i "[%1]" EQU "[StartW2H1]" call :StrtW2H1 :: pass 'StopW2H1' to stop Windows audio output to headset x (where x = the last character) if /i "[%1]" EQU "[StopW2H1]" call :StopW2H1 :: pass 'StartW2H2' to start Windows audio output to headset x (where x = the last character) if /i "[%1]" EQU "[StartW2H2]" call :StrtW2H2 :: pass 'StopW2H2' to stop Windows audio output to headset x (where x = the last character) if /i "[%1]" EQU "[StopW2H2]" call :StopW2H2 :: pass 'StartW2M' to start Windows audio output to the meeting/recording mix and all defined headsets :: this will always stop the external mic/speakers and start all defined headsets! if /i "[%1]" EQU "[StartW2M]" call :StartW2M :: pass 'StopW2M' to stop Windows audio output to the meeting/recording mix if /i "[%1]" EQU "[StopW2M]" call :StopW2M :: 'shift' to the next command line parameter shift :: if there are any subsequent command line parameters, loop back to :GetArgs if [%1] NEQ [] ( goto :GetArgs ) else ( goto :eof ) :SkipArgs :: no command line parameters; setup VAC with Control Panel and default audio devices :: (includes user prompt when both external mic/speakers and headset devices defined) :: start VAC Control Panel call :StartCP :: setup default audio devices call :SetDev :: Meeting -> Recording Mix call :StartRec :: all done! goto :EndMsg :SetDev :: setup default audio devices :: skip choice of external speakers/boom mic or headset if no boom mic defined if not defined BoomMic ( call :Boom goto :eof ) :: skip choice of external speakers/boom mic or headset if no headsets defined if not defined HeadMic1 ( if not defined HeadMic2 ( call :Headsets goto :eof ) ) :: get user choice title ControlVAC - Choose operating mode: echo.&echo Press 'Enter' to use headset(s) or ... echo type 'b' then press 'Enter' to use a boom mic/external speakers instead. set /p RunBoom= :: set response variables from choice; in the 'if...' statement, '/i' is case insensitive for the 'b' user response if /i "[%RunBoom%]" EQU "[b]" ( call :Boom ) else ( call :Headsets ) goto :eof :EndMsg :: all done, so exit without pause if the EndPause variable is defined (to what it doesn't matter) if not defined EndPause goto :eof :: show usage message title ControlVAC - Completed! (Press any key to exit...) cls&echo. echo --------&echo Usage: &echo -------- echo. echo Ensure your Windows default audio devices are configured to use: echo. echo 'Recording' Microphone: '%WinMic%' echo 'Playback' Speakers: '%WinSpkrs%' echo. echo Configure the meeting app to use: echo. echo Microphone: '%WinMic%' echo Speakers: '%MeetingOut%' echo. if defined RecMix ( echo Optionally ensure that any separate audio recording app is configured record from: echo. echo Audio Device: '%RecMix%' echo. ) pause>nul goto :eof :StartCP :: start VAC Control Panel if not already running tasklist /fi "imagename eq %VacCpExe%" 2>NUL | find /i /n "%VacCpExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioCtl%" goto :eof :StopCP :: terminate the VAC Control Panel tasklist /fi "imagename eq %VacCpExe%" 2>NUL | find /i /n "%VacCpExe%">NUL if %errorlevel% EQU 0 taskkill /f /im %VacCpExe% goto :eof :StopARs :: terminate all VAC Audio Repeaters tasklist /fi "imagename eq %VacArExe%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 taskkill /f /im %VacArExe% goto :eof :StartRec :: start Recording Mix (excluding Windows audio!) if not defined RecMix goto :eof :: Meeting -> Recording Mix tasklist /fi "windowtitle eq %NameM2R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%MeetingOut%" /Output:"%RecMix%" /WindowName:"%NameM2R%" /AutoStart /ChanCfg:"%Meet2RecChnl%" %Meet2RecArgs% goto :eof :Boom :: Speakers <- Meeting call :StartSpk :: Mic -> Meeting :: Mic -> Recording Mix call :StartMic :: Windows Audio -> Speakers call :StartW2S :: exit sub goto :eof :Headsets :: Headset(s) Ear <- Meeting :: Headset(s) Mic -> Meeting :: Headset(s) Mic -> Recording Mix call :StartHS :: Windows Audio -> Headset(s) call :StrtW2HS :: exit sub goto :eof :StartExt :: start external mic/speakers (excluding Windows audio!) call :StartMic call :StartSpk goto :eof :StopExt :: stop external mic/speakers call :StopMic call :StopSpk goto :eof :StartMic :: start external mic if not defined BoomMic goto :eof :: Mic -> Meeting tasklist /fi "windowtitle eq %NameE2M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%BoomMic%" /Output:"%WinMic%" /WindowName:"%NameE2M%" /AutoStart /ChanCfg:"%Mic2MeetChnl%" %Mic2MeetArgs% :: Mic -> Recording Mix tasklist /fi "windowtitle eq %NameE2R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined RecMix start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%BoomMic%" /Output:"%RecMix%" /WindowName:"%NameE2R%" /AutoStart /ChanCfg:"%Mic2RecChnl%" %Mic2RecArgs% goto :eof :StopMic :: stop external mic :: Mic -> Meeting tasklist /fi "windowtitle eq %NameE2M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameE2M%" :: Mic -> Recording Mix tasklist /fi "windowtitle eq %NameE2R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameE2R%" goto :eof :StartSpk :: start external speakers (excluding Windows audio!) :: Speakers <- Meeting tasklist /fi "windowtitle eq %NameM2E%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined Speakers start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%MeetingOut%" /Output:"%Speakers%" /WindowName:"%NameM2E%" /AutoStart /ChanCfg:"%Meet2SpkChnl%" %Meet2SpkArgs% goto :eof :StopSpk :: stop external speakers :: Speakers <- Meeting tasklist /fi "windowtitle eq %NameM2E%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameM2E%" goto :eof :StartHS :: start all headsets (excluding Windows audio!) call :StartH1 call :StartH2 goto :eof :StartH1 :: start Headset-1 only (excluding Windows audio!) if not defined HeadMic1 goto :eof :: Headset-1 Ear <- Meeting tasklist /fi "windowtitle eq %NameM2H1%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%MeetingOut%" /Output:"%HeadEar1%" /WindowName:"%NameM2H1%" /AutoStart /ChanCfg:"%Meet2HeadChnl%" %Meet2HeadArgs% :: Headset-1 Mic -> Meeting tasklist /fi "windowtitle eq %NameH12M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%HeadMic1%" /Output:"%WinMic%" /WindowName:"%NameH12M%" /AutoStart /ChanCfg:"%Mic2MeetChnl%" %Mic2MeetArgs% :: Headset-1 Mic -> Recording Mix tasklist /fi "windowtitle eq %NameH12R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined RecMix start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%HeadMic1%" /Output:"%RecMix%" /WindowName:"%NameH12R%" /AutoStart /ChanCfg:"%Mic2RecChnl%" %Mic2RecArgs% goto :eof :StartH2 :: start Headset-2 only (excluding Windows audio!) if not defined HeadMic2 goto :eof :: Headset-2 Ear <- Meeting tasklist /fi "windowtitle eq %NameM2H2%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%MeetingOut%" /Output:"%HeadEar2%" /WindowName:"%NameM2H2%" /AutoStart /ChanCfg:"%Meet2HeadChnl%" %Meet2HeadArgs% :: Headset-2 Mic -> Meeting tasklist /fi "windowtitle eq %NameH22M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%HeadMic2%" /Output:"%WinMic%" /WindowName:"%NameH22M%" /AutoStart /ChanCfg:"%Mic2MeetChnl%" %Mic2MeetArgs% :: Headset-2 Mic -> Recording Mix tasklist /fi "windowtitle eq %NameH22R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined RecMix start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%HeadMic2%" /Output:"%RecMix%" /WindowName:"%NameH22R%" /AutoStart /ChanCfg:"%Mic2RecChnl%" %Mic2RecArgs% goto :eof :StopHS :: start all headsets call :StopH1 call :StopH2 goto :eof :StopH1 :: stop Headset-1 only call :StopMH1 :: Headset-1 Ear <- Meeting tasklist /fi "windowtitle eq %NameM2H1%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameM2H1%" goto :eof :StopH2 :: stop Headset-2 only call :StopMH2 :: Headset-2 Ear <- Meeting tasklist /fi "windowtitle eq %NameM2H2%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameM2H2%" goto :eof :StopMHS :: stop only mic for all headsets call :StopMH1 call :StopMH2 goto :eof :StopMH1 :: stop Headset-1 mic only :: Headset-1 Mic -> Meeting tasklist /fi "windowtitle eq %NameH12M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameH12M%" :: Headset-1 Mic -> Recording Mix tasklist /fi "windowtitle eq %NameH12R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameH12R%" goto :eof :StopMH2 :: stop Headset-2 mic only :: Headset-2 Mic -> Meeting tasklist /fi "windowtitle eq %NameH22M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameH22M%" :: Headset-2 Mic -> Recording Mix tasklist /fi "windowtitle eq %NameH22R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameH22R%" goto :eof :StartW2S :: Windows Audio -> Speakers tasklist /fi "windowtitle eq %NameW2E%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined Speakers start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%WinSpkrs%" /Output:"%Speakers%" /WindowName:"%NameW2E%" /AutoStart /ChanCfg:"%Win2SpkChnl%" %Win2SpkArgs% goto :eof :StopW2S :: Windows Audio -> Speakers tasklist /fi "windowtitle eq %NameW2E%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameW2E%" goto :eof :StrtW2HS :: Windows Audio -> All Headset(s) call :StrtW2H1 call :StrtW2H2 goto :eof :StrtW2H1 :: Windows Audio -> Headset-1 Ear tasklist /fi "windowtitle eq %NameW2H1%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined HeadMic1 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%WinSpkrs%" /Output:"%HeadEar1%" /WindowName:"%NameW2H1%" /AutoStart /ChanCfg:"%Win2HeadChnl%" %Win2HeadArgs% goto :eof :StrtW2H2 :: Windows Audio -> Headset-2 Ear tasklist /fi "windowtitle eq %NameW2H2%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined HeadMic2 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%WinSpkrs%" /Output:"%HeadEar2%" /WindowName:"%NameW2H2%" /AutoStart /ChanCfg:"%Win2HeadChnl%" %Win2HeadArgs% goto :eof :StopW2HS call :StopW2H1 call :StopW2H2 goto :eof :StopW2H1 :: Windows Audio -> Headset-1 Ear tasklist /fi "windowtitle eq %NameW2H1%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameW2H1%" goto :eof :StopW2H2 :: Windows Audio -> Headset-2 Ear tasklist /fi "windowtitle eq %NameW2H2%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameW2H2%" goto :eof :StartW2M :: kill external mic/speakers and Windows Audio -> Speakers * never use Windows audio output to external speakers here! call :StopExt call :StopW2S :: ensure headsets are active and give audio call :StartHS call :StrtW2HS :: Windows Audio -> Recording Mix tasklist /fi "windowtitle eq %NameW2R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 if defined RecMix start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%WinSpkrs%" /Output:"%RecMix%" /WindowName:"%NameW2R%" /AutoStart /ChanCfg:"%Win2RecChnl%" %Win2RecArgs% :: Windows Audio -> Meeting tasklist /fi "windowtitle eq %NameW2M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% NEQ 0 start "" /d "%AudioDir%" "%AudioRpt%" /Input:"%WinSpkrs%" /Output:"%WinMic%" /WindowName:"%NameW2M%" /AutoStart /ChanCfg:"%Win2MeetChnl%" %Win2MeetArgs% goto :eof :StopW2M :: kill Windows Audio -> Recording Mix tasklist /fi "windowtitle eq %NameW2R%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameW2R%" :: kill Windows Audio -> Meeting tasklist /fi "windowtitle eq %NameW2M%" 2>NUL | find /i /n "%VacArExe%">NUL if %errorlevel% EQU 0 start "" /d "%AudioDir%" "%AudioRpt%" /CloseInstance:"%NameW2M%" goto :eof :CfgFail title ControlVAC -- NOT Configured! (Press any key to configure...) call :WhoAmI echo --------------------------------- &echo ControlVAC is NOT Configured! &echo --------------------------------- echo. echo * This batch file is not configured! echo. echo * You must complete the configuration steps listed in the top of this batch file, including echo setting the appropriate variables for your specific audio devices in the 'VARIABLE SET BLOCK' echo found below the instructions! echo. echo * Press 'Enter' to edit this batch file now...&echo. pause>nul start "" notepad "%me%" goto :eof :PermFail title ControlVAC -- Fail! (Press any key to exit...) call :WhoAmI echo -------------------- &echo ControlVAC Fail! &echo -------------------- echo. echo * This batch file requires Admin permissions! echo (Right-click batch file and 'Run as Administrator') echo. echo * Type 'h' then press 'Enter' to view the help screen. echo * Type 'p' then press 'Enter' to print the help file. echo * Press 'Enter' to exit now...&echo. set /p GetHelp= if /i "[%GetHelp%]" EQU "[h]" goto :ShowArgs if /i "[%GetHelp%]" EQU "[p]" goto :PrintArgs goto :eof :ShowArgs if /i "[%PrintFile%]" NEQ "[True]" cls&title ControlVAC -- Help [1/4] General and Optional Arguments for Program Control call :WhoAmI echo ------------------- &echo ControlVAC Help &echo ------------------- &echo. echo * ControlVAC.cmd requires admin permissions to run. echo. echo * You must first complete the configuration steps listed in the top of this batch file, including echo setting the appropriate variables for your specific audio devices in the 'VARIABLE SET BLOCK' echo found below the instructions! echo. echo * ControlVAC.cmd can accept optional arguments to control it's behavior, which can be passed on echo as a 'Command Line Parameter' or used within a Windows Shortcut (LNK file) or similar. echo. echo ------------------------------------------ &echo Optional Arguments for Program Control &echo ------------------------------------------ &echo. echo * StartCP - Start the Virtual Audio Cable Control Panel echo * StopCP - Terminate the Virtual Audio Cable Control Panel echo * StopARs - Terminate all Virtual Audio Cable Audio Repeaters (Stops ALL Input/Output!) echo. if /i "[%PrintFile%]" NEQ "[True]" ( echo.&echo Press any key for more...&pause>nul cls&title ControlVAC -- Help [2/4] Optional Arguments for Meeting Input/Output ) echo ----------------------------------------------- &echo Optional Arguments for Meeting Input/Output &echo ----------------------------------------------- &echo. echo NOTES: 1. All speaker/headset options here include meeting output only, NOT Windows audio output! echo 2. For headsets, you may replace 'HS' with 'H1' or 'H2' to specify only that defined headset! echo. echo * StartExt - Start speakers and the desk/boom mic for all meeting I/O and as Windows default echo * StopExt - Stop speakers and the desk/boom mic for all meeting I/O and as Windows default echo. echo * StartMic - Start the desk/boom mic output to meeting and use as Windows default echo * StopMic - Stop the desk/boom mic output to meeting and use as Windows default echo. echo * StartSpk - Start meeting output to speakers echo * StopSpk - Stop meeting output to speakers echo. echo * StartHS - Start defined headsets for all meeting input/output (with mic as Windows default) echo * StopHS - Stop defined headsets for all meeting input/output (with mic as Windows default) echo. echo * StopMHS - Stop only the mic on all defined headsets echo ** There is no 'StartMHS' argument, instead use 'StartHS' to start all echo headset functionality, including the mic echo. if /i "[%PrintFile%]" NEQ "[True]" ( echo.&echo Press any key for more...&pause>nul cls&title ControlVAC -- Help [3/4] Optional Arguments for Windows Audio Output ) echo ----------------------------------------------- &echo Optional Arguments for Windows Audio Output &echo ----------------------------------------------- &echo. echo NOTES: 1. All speaker/headset options here include Windows audio output only, NOT meeting Input/Output! echo 2. For headsets, you may replace 'HS' with 'H1' or 'H2' to specify only that defined headset! echo. echo * StartW2S - Start Windows audio output to speakers echo * StopW2S - Stop Windows audio output to speakers echo. echo * StartW2HS - Start Windows audio output to all defined headsets echo * StopW2HS - Stop Windows audio output to all defined headsets echo. echo * StartW2M - Start Windows audio output to the meeting/recording mix and headsets echo ** Prior to execution, this will always stop the mic and speakers and start any defined echo headsets before routing Windows audio output to the meeting/recording mix! echo. echo * StopW2M - Stop Windows audio output to the meeting/recording mix echo. if /i "[%PrintFile%]" NEQ "[True]" ( echo.&echo Press any key for more...&pause>nul cls&title ControlVAC -- Help [4/4] Argument Usage Notes and Examples ) echo ------------------------------------- &echo Argument Usage Notes and Examples &echo ------------------------------------- &echo. echo NOTES: 1. Multiple arguments are accepted with one call to this batch file, separated echo by a single space character, and run sequentially in the order specified. echo. echo 2. Do NOT use a preceding forward slash or hyphen before any arguments! echo (e.g. ControlVAC.cmd -Arg or ControlVAC.cmd /Arg) echo. echo Ex: ControlVAC.cmd StartCP StartExt StartW2S echo. echo - Start VAC Control Panel first, then use both speakers and a desk/boom mic for echo meeting input/output, and finally route Windows audio to the speakers. echo. echo Ex: ControlVAC.cmd StopExt StartHS StartW2S echo. echo - Stop both speakers and a desk/boom mic for meeting input/output, then start echo all defined headsets for meeting input/output, and finally route Windows audio echo to the speakers. echo. echo Ex: ControlVAC.cmd StopARs StopCP echo. echo - Terminate all Audio Repeaters first, then terminate the VAC Control Panel. echo. set EndHelp= if /i "[%PrintFile%]" NEQ "[True]" ( echo * Type 'h' then press 'Enter' to view the arguments screen again. echo * Type 'p' then press 'Enter' to print this help screen to file. echo * Press 'Enter' to exit now...&echo. set /p EndHelp= ) else ( echo ------------ &echo End Help &echo ------------ &echo. ) if /i "[%EndHelp%]" EQU "[h]" goto :ShowArgs if /i "[%EndHelp%]" EQU "[p]" goto :PrintArgs goto :eof :PrintArgs if exist "%HelpFile%" del /q "%HelpFile%" call "%Me%" printhelp >> "%HelpFile%" 2>&1 start "" notepad "%HelpFile%" goto :eof :WhoAmI echo. echo 'ControlVAC.cmd' is a Batch file to start a Virtual Audio Cable setup echo - by Nick @ FoolishIT.com [Foolish IT LLC] echo - Last Modified 2016-08-04 @ 9:11pm ET echo - Official Download: https://download.foolishit.com/Scripts/ControlVAC.cmd.txt echo. goto :eof