@echo off
echo 百汇阳光研发 企业服务QQ：800094555
echo 2013-7-17
if not "%~1"=="p" start /min cmd.exe /c %0 p&exit
::检测Micu声卡是否插上
set micuID=
set weizhi=
set micu=HKLM\SYSTEM\CurrentControlSet\services\micu\Enum /v 0
for /f "tokens=1* delims=Z" %%i in ('reg query %micu%') do set "weizhi=%%j"
set "micuID=%weizhi:~1%"
for /f "tokens=* delims= " %%i in ("%micuID%") do set "micuID=%%i"
if not %micuID:~0,3%==USB msg %username% "请插上micu声卡后重新运行"&&exit
msg %username% /time:3  "Micu 通道切换中..."
rem echo "%micuID%"


reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\02_00" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_00\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\02_01" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_01\02_03" /v Flags /t REG_DWORD /d 1 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_02\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\00_03\02_03" /v Flags /t REG_DWORD /d 1 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\02_02" /v Flags /t REG_DWORD /d 1 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_00\02_03" /v Flags /t REG_DWORD /d 0 /f>nul



reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\00_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\00_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\02_00" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\02_01" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\02_02" /v Flags /t REG_DWORD /d 0 /f>nul
reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%micuID%\Device Parameters\Mixer\05_01\02_03" /v Flags /t REG_DWORD /d 1 /f>nul


::检测micu驱动安装位置
set micudrvPath=
set micuweizhi=
if exist %windir%\SysWOW64 (
	set micudrive=HKLM\SOFTWARE\Wow6432Node\IconGlobal\micu\Drivers\Setup /v InstallPath
) else (
	set micudrive=HKLM\SOFTWARE\IconGlobal\micu\Drivers\Setup /v InstallPath 
)
for /f "tokens=1* delims=Z" %%i in ('reg query %micudrive%') do set "micuweizhi=%%j"
set "micudrvPath=%micuweizhi:~1%"
for /f "tokens=* delims= " %%i in ("%micudrvPath%") do set "micudrvPath=%%i"
rem echo "%micudrvPath%"
call "%micuDrvPath%\micusvc.exe" -stop
call "%micuDrvPath%\micusvc.exe" -start
msg %username% /time:2 "通道切换完毕"
