本文介绍了音频输出电平为值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用VB代码在vmeter中找到输出声级。你可以帮助我得到相同的...
以下代码用于查找输入声级(麦克风声级)。但我想找到输出声级(扬声器电话)。请帮我解决。
代码:
I want to find output sound level in the vmeter using VB code. can you please help me to get the same..
The below code is used to find the inpput sound level (mic sound level). But i want to find the output sound level (speaker phone). Please help me to get resolved.
Code:
#Include <string.au3> ; for _StringRepeat function
#Include <guiconstants.au3> ; GUI !
Dim $lpszDevice ; Identifier of an MCI device or device driver.
Dim $lpszDeviceID ; Identifier of an MCI device.
; This identifier or alias is assigned when the device is opened.
Dim $lpszOpenFlags ; Flag that identifies what to initialize.
Dim $lpszRequest ; Flag for requesting status information. See table on the web page mentioned above.
Dim $lpszFlags ; Can be "wait", "notify", or both.
; For digital-video and VCR devices, "test" can also be specified.
Dim $lpszCommand ; mciCommand string to send.
Dim $lpszReturnString ; information will be returned into this string. Reserve enough space!
Dim $cchReturn ; Length of returnstring
Dim $mciError ; mci error code
$lpszDevice = "new type waveaudio"
$lpszOpenFlags = "alias mywave" ; For all possible flags, see table on web page mentioned above.
$lpszFlags = ""
$lpszCommand = StringFormat( "open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags );
$lpszReturnString = _StringRepeat( " ", 100 ) ; Information will return in this string
$cchReturn = StringLen($lpszReturnString)
; Size, in characters, of the return buffer specified
; by the lpszReturnString parameter.
$mciError = _mciSendString( $lpszCommand, $lpszReturnString, $cchReturn, 0);
if $mciError[0] <> 0 then _mciShowError($mcierror[0])
$lpszDeviceID = "mywave"
$lpszRequest = "level" ; Returns the current PCM audio sample value.
; See table on web page mentioned above.
$lpszFlags = ""
$lpszCommand= StringFormat( "status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags );
GUICreate("MCI wave level test",200,130) ; This will create a centered dialog box
$VolumeLabel=GUICtrlCreateLabel ("Initializing..." , 14, 8, 200, 20)
$ProgressBar = GUICtrlCreateProgress (14,25,180,20)
$ExitButton =GUICtrlCreateButton (" Exit ",80,60)
GUISetState () ; Display the dialog
While 1
$mciError = _mciSendString( $lpszCommand, $lpszReturnString, $cchReturn, 0);
if $mciError[0] <> 0 then _mciShowError($mcierror[0])
GUICtrlSetData ($VolumeLabel, "Current wave level is: " & $mcierror[2])
GUICtrlSetData ($ProgressBar,$mcierror[2])
$msg = GUIGetMsg()
Select
case $msg = $Exitbutton
Exit
case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
Wend
GUIDelete()
exit
Func _mciSendString( $lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback)
Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0)
EndFunc
Func _mciShowError($mcierror)
Dim $errStr ; Error message
$errStr=_StringRepeat( " ", 100 ) ; Reserve some space for the error message
$Result=DllCall("winmm.dll","long", "mciGetErrorStringA", "long", $mcierror, "string", $errStr, "long", StringLen($errStr))
MsgBox (0,"MCI test", "MCI Error Number " & $mcierror & ":" & $Result[2] )
EndFunc</guiconstants.au3></string.au3>
推荐答案
这篇关于音频输出电平为值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!