找回密码
 加入
搜索
查看: 8392|回复: 11

[系统综合] au3如何把录音控制的音量调到最大

  [复制链接]
发表于 2010-5-16 13:57:27 | 显示全部楼层 |阅读模式
本帖最后由 qq490405 于 2010-7-13 09:23 编辑

如是说,麦克风的音量太小了,怎么样用AU3来实现调动音量大小
发表于 2010-5-17 00:12:21 | 显示全部楼层
本帖最后由 lynfr8 于 2010-5-17 00:43 编辑

解压附件,得到volumeline.exe
运行
RunWait(@ComSpec & ' /c "' & @ScriptDir & '\volumeline.exe" GET:ALL > audiotemp.txt', @ScriptDir, @SW_HIDE)
产生一个文档audiotemp.txt
内容如图:

获取到主要参数(例如红框部分)


例子:

1.将红框3麦克风音量调为最大100,代码格式为
RunWait("volumeline.exe SET:" & $MixerId & ":" & $GroupId & ":" & $ControlId & " VOLUME:<0-100>", @ScriptDir, @SW_HIDE)
即:
RunWait("volumeline.exe SET:" & '0' & ":" & '0' & ":" & '10' & " VOLUME:100", @ScriptDir, @SW_HIDE)

2.麦克风静音,代码格式为
VolumeLine.exe SET:<MixerId>:<GroupId>:<ControlId> MUTE:<ON|OFF>
即:
RunWait("volumeline.exe SET:" & '0' & ":" & '0' & ":" & '10' & " MUTE:ON", @ScriptDir, @SW_HIDE)

3.恢复非静音:
RunWait("volumeline.exe SET:" & '0' & ":" & '0' & ":" & '10' & " MUTE:OFF", @ScriptDir, @SW_HIDE)

其他功能未测试,自行研究吧



官网传送门(缺钱的兄弟就到这里拿吧):
http://www.autoitscript.com/forum/index.php?showtopic=63631&st=0&p=478945&hl=microphone%20&fromsearch=1&#entry478945

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 1金钱 +25 收起 理由
afan + 25

查看全部评分

发表于 2010-5-17 00:32:19 | 显示全部楼层
下载了,也运行了,但是并没有出现你所说的audiodevices.txt这个文件。。。。
发表于 2010-5-17 00:44:41 | 显示全部楼层
下载了,也运行了,但是并没有出现你所说的audiodevices.txt这个文件。。。。
离我远点 发表于 2010-5-17 00:32



已修改,请阅2搂原帖开头部分
发表于 2010-5-17 09:36:41 | 显示全部楼层
呵呵好东西要收藏。。
发表于 2010-5-17 10:12:57 | 显示全部楼层
感谢了,拿下以后用...
发表于 2010-5-17 10:13:07 | 显示全部楼层
感谢了,拿下以后用......
发表于 2010-5-17 23:00:55 | 显示全部楼层
好强啊,谢谢分享出来
学习下
发表于 2010-6-23 22:01:53 | 显示全部楼层
回复 4# lynfr8


    AC97声卡选择不能选择录音设备。select:on这个参数貌似是没有
发表于 2010-6-23 22:03:12 | 显示全部楼层
回复 4# lynfr8


   解决了 后边不带参数就OK了
发表于 2024-9-11 17:23:31 | 显示全部楼层
; adapted from DanyFirex and xMatz code #include <GuiConstants.au3> #include <Constants.au3>  Global Const $S_OK = 0 Global Enum $eRender, $eCapture Global Enum $eConsole, $eMultimedia, $eCommunications  Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = "EnumAudioEndpoints hresult(dword;dword;ptr*);" & _     "GetDefaultAudioEndpoint hresult(dword;dword;ptr*);" & _     "GetDevice hresult(wstr;ptr*);" & _     "RegisterEndpointNotificationCallback hresult(ptr);" & _     "UnregisterEndpointNotificationCallback hresult(ptr);"  Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = "Activate hresult(clsid;dword;variant*;ptr*);" & _     "OpenPropertyStore hresult(dword;ptr*);" & _     "GetId hresult(ptr*);" & _     "GetState hresult(dword*);"  Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $tagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _     "GetMeteringChannelCount hresult(dword*);" & _     "GetChannelsPeakValues hresult(dword;float*);" & _     "QueryHardwareSupport hresult(dword*);"  Global $oAudioMeterInformation = _MicVolObject() If Not IsObj($oAudioMeterInformation) Then Exit MsgBox ($MB_SYSTEMMODAL,"Error","Unable to mic audio meter")  Global $hGUI = GUICreate("", 80, 300, -1, -1, $WS_BORDER + $WS_POPUP) Global $hControl = GUICtrlCreateProgress(20, 20, 40, 260, $PBS_VERTICAL)  AdlibRegister("_LevelMeter", 45)  GUISetState()  While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd AdlibUnRegister()  Func _LevelMeter()   Local $iPeak   If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then     $iCurrentRead = 100 * $iPeak     GUICtrlSetData($hControl, $iCurrentRead)     If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF)   EndIf EndFunc   ;==>_LevelMeter  Func _MicVolObject()   Local Const $CLSCTX_INPROC_SERVER = 0x1    Local $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator)   If @error Then Return SetError(1, 0, 0)    Local $pDefaultDevice   $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eCapture, $eConsole, $pDefaultDevice)   If Not $pDefaultDevice Then Return SetError(2, 0, 0)    Local $oDefaultDevice = ObjCreateInterface($pDefaultDevice, $sIID_IMMDevice, $tagIMMDevice)   If Not IsObj($oDefaultDevice) Then Return SetError(3, 0, 0)    Local $pAudioMeterInformation   $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_INPROC_SERVER, 0, $pAudioMeterInformation)   If Not $pAudioMeterInformation Then Return SetError(4, 0, 0)   Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc   ;==>_MicVolObject; adapted from DanyFirex and xMatz code #include <GuiConstants.au3> #include <Constants.au3>  Global Const $S_OK = 0 Global Enum $eRender, $eCapture Global Enum $eConsole, $eMultimedia, $eCommunications  Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = "EnumAudioEndpoints hresult(dword;dword;ptr*);" & _     "GetDefaultAudioEndpoint hresult(dword;dword;ptr*);" & _     "GetDevice hresult(wstr;ptr*);" & _     "RegisterEndpointNotificationCallback hresult(ptr);" & _     "UnregisterEndpointNotificationCallback hresult(ptr);"  Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = "Activate hresult(clsid;dword;variant*;ptr*);" & _     "OpenPropertyStore hresult(dword;ptr*);" & _     "GetId hresult(ptr*);" & _     "GetState hresult(dword*);"  Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $tagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _     "GetMeteringChannelCount hresult(dword*);" & _     "GetChannelsPeakValues hresult(dword;float*);" & _     "QueryHardwareSupport hresult(dword*);"  Global $oAudioMeterInformation = _MicVolObject() If Not IsObj($oAudioMeterInformation) Then Exit MsgBox ($MB_SYSTEMMODAL,"Error","Unable to mic audio meter")  Global $hGUI = GUICreate("", 80, 300, -1, -1, $WS_BORDER + $WS_POPUP) Global $hControl = GUICtrlCreateProgress(20, 20, 40, 260, $PBS_VERTICAL)  AdlibRegister("_LevelMeter", 45)  GUISetState()  While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd AdlibUnRegister()  Func _LevelMeter()   Local $iPeak   If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then     $iCurrentRead = 100 * $iPeak     GUICtrlSetData($hControl, $iCurrentRead)     If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF)   EndIf EndFunc   ;==>_LevelMeter  Func _MicVolObject()   Local Const $CLSCTX_INPROC_SERVER = 0x1    Local $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator)   If @error Then Return SetError(1, 0, 0)    Local $pDefaultDevice   $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eCapture, $eConsole, $pDefaultDevice)   If Not $pDefaultDevice Then Return SetError(2, 0, 0)    Local $oDefaultDevice = ObjCreateInterface($pDefaultDevice, $sIID_IMMDevice, $tagIMMDevice)   If Not IsObj($oDefaultDevice) Then Return SetError(3, 0, 0)    Local $pAudioMeterInformation   $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_INPROC_SERVER, 0, $pAudioMeterInformation)   If Not $pAudioMeterInformation Then Return SetError(4, 0, 0)   Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc   ;==>_MicVolObject; adapted from DanyFirex and xMatz code #include <GuiConstants.au3> #include <Constants.au3>  Global Const $S_OK = 0 Global Enum $eRender, $eCapture Global Enum $eConsole, $eMultimedia, $eCommunications  Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = "EnumAudioEndpoints hresult(dword;dword;ptr*);" & _     "GetDefaultAudioEndpoint hresult(dword;dword;ptr*);" & _     "GetDevice hresult(wstr;ptr*);" & _     "RegisterEndpointNotificationCallback hresult(ptr);" & _     "UnregisterEndpointNotificationCallback hresult(ptr);"  Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = "Activate hresult(clsid;dword;variant*;ptr*);" & _     "OpenPropertyStore hresult(dword;ptr*);" & _     "GetId hresult(ptr*);" & _     "GetState hresult(dword*);"  Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $tagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _     "GetMeteringChannelCount hresult(dword*);" & _     "GetChannelsPeakValues hresult(dword;float*);" & _     "QueryHardwareSupport hresult(dword*);"  Global $oAudioMeterInformation = _MicVolObject() If Not IsObj($oAudioMeterInformation) Then Exit MsgBox ($MB_SYSTEMMODAL,"Error","Unable to mic audio meter")  Global $hGUI = GUICreate("", 80, 300, -1, -1, $WS_BORDER + $WS_POPUP) Global $hControl = GUICtrlCreateProgress(20, 20, 40, 260, $PBS_VERTICAL)  AdlibRegister("_LevelMeter", 45)  GUISetState()  While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd AdlibUnRegister()  Func _LevelMeter()   Local $iPeak   If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then     $iCurrentRead = 100 * $iPeak     GUICtrlSetData($hControl, $iCurrentRead)     If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF)   EndIf EndFunc   ;==>_LevelMeter  Func _MicVolObject()   Local Const $CLSCTX_INPROC_SERVER = 0x1    Local $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator)   If @error Then Return SetError(1, 0, 0)    Local $pDefaultDevice   $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eCapture, $eConsole, $pDefaultDevice)   If Not $pDefaultDevice Then Return SetError(2, 0, 0)    Local $oDefaultDevice = ObjCreateInterface($pDefaultDevice, $sIID_IMMDevice, $tagIMMDevice)   If Not IsObj($oDefaultDevice) Then Return SetError(3, 0, 0)    Local $pAudioMeterInformation   $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_INPROC_SERVER, 0, $pAudioMeterInformation)   If Not $pAudioMeterInformation Then Return SetError(4, 0, 0)   Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc   ;==>_MicVolObject
发表于 2024-9-13 12:05:55 | 显示全部楼层
学习了,au3果然无所不能!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-22 01:10 , Processed in 0.080081 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表