Parsix Posted Thursday at 08:30 AM Posted Thursday at 08:30 AM How can I show specific microphone activity in the progress bar? I found the following, but it doesn't work unless the recording tab is open in the control panel.
Solution Danyfirex Posted 7 hours ago Solution Posted 7 hours ago Hello, You need to do some changes to initialize a Client/CaptureClient expandcollapse popup#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 Const $sIID_IAudioClient = "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}" Global Const $tagIAudioClient = "Initialize hresult(dword;dword;int64;int64;ptr;ptr);" & _ "GetBufferSize hresult();" & _ "GetStreamLatency hresult();" & _ "GetCurrentPadding hresult(dword*);" & _ "IsFormatSupported hresult();" & _ "GetMixFormat hresult(ptr*);" & _ "GetDevicePeriod hresult();" & _ "Start hresult();" & _ "Stop hresult();" & _ "Reset hresult();" & _ "SetEventHandle hresult();" & _ "GetService hresult(clsid;ptr*);" Global Const $IID_IAudioCaptureClient = "{C8ADBD64-E71E-48A0-A4DE-185C395CD317}" Global Const $tagIAudioCaptureClient = _ "GetBuffer hresult(ptr*;uint*;uint*;int64*;int64*);" & _ "ReleaseBuffer hresult(uint);" & _ "GetNextPacketSize hresult(uint*);" Global $g_oAudioCaptureClient = 0 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 Local $iPacketLength $g_oAudioCaptureClient.GetNextPacketSize($iPacketLength) If $iPacketLength > 0 Then If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then $iCurrentRead = 100 * $iPeak GUICtrlSetData($hControl, $iCurrentRead) If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF) EndIf EndIf EndFunc ;==>_LevelMeter Func _MicVolObject() Local Const $CLSCTX_INPROC_SERVER = 0x1 Local Const $CLSCTX_INPROC_HANDLER = 0x2 Local Const $CLSCTX_LOCAL_SERVER = 0x4 Local Const $CLSCTX_ALL = BitOR($CLSCTX_INPROC_SERVER, $CLSCTX_INPROC_HANDLER, $CLSCTX_LOCAL_SERVER) 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 $pAudioClient $oDefaultDevice.Activate($sIID_IAudioClient, $CLSCTX_ALL, 0, $pAudioClient) Local $oAudioClient = ObjCreateInterface($pAudioClient, $sIID_IAudioClient, $tagIAudioClient) If Not IsObj($oAudioClient) Then Return SetError(4, 0, 0) Local $pWFX $oAudioClient.GetMixFormat($pWFX) Global $tWAVEFORMATEX = DllStructCreate("ushort wFormatTag;ushort nChannels;dword nSamplesPerSec;" & _ "dword nAvgBytesPerSec;ushort nBlockAlign;ushort wBitsPerSample;" & _ "ushort cbSize", $pWFX) ;~ ConsoleWrite($tWAVEFORMATEX.cbSize & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wFormatTag & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nChannels & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nSamplesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nAvgBytesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nBlockAlign & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wBitsPerSample & @CRLF) $oAudioClient.Initialize(0, 0, 10000000, 0, $pWFX, 0) Local $pAudioCaptureClient $oAudioClient.GetService($IID_IAudioCaptureClient, $pAudioCaptureClient) Local $oAudioCaptureClient = ObjCreateInterface($pAudioCaptureClient, $IID_IAudioCaptureClient, $tagIAudioCaptureClient) If Not IsObj($oAudioCaptureClient) Then Return SetError(5, 0, 0) $g_oAudioCaptureClient = $oAudioCaptureClient $oAudioClient.Start() Local $pAudioMeterInformation $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_ALL, 0, $pAudioMeterInformation) If Not $pAudioMeterInformation Then Return SetError(6, 0, 0) Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc ;==>_MicVolObject Saludos Parsix 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Parsix Posted 7 hours ago Author Posted 7 hours ago (edited) 9 minutes ago, Danyfirex said: Hello, You need to do some changes to initialize a Client/CaptureClient expandcollapse popup#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 Const $sIID_IAudioClient = "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}" Global Const $tagIAudioClient = "Initialize hresult(dword;dword;int64;int64;ptr;ptr);" & _ "GetBufferSize hresult();" & _ "GetStreamLatency hresult();" & _ "GetCurrentPadding hresult(dword*);" & _ "IsFormatSupported hresult();" & _ "GetMixFormat hresult(ptr*);" & _ "GetDevicePeriod hresult();" & _ "Start hresult();" & _ "Stop hresult();" & _ "Reset hresult();" & _ "SetEventHandle hresult();" & _ "GetService hresult(clsid;ptr*);" Global Const $IID_IAudioCaptureClient = "{C8ADBD64-E71E-48A0-A4DE-185C395CD317}" Global Const $tagIAudioCaptureClient = _ "GetBuffer hresult(ptr*;uint*;uint*;int64*;int64*);" & _ "ReleaseBuffer hresult(uint);" & _ "GetNextPacketSize hresult(uint*);" Global $g_oAudioCaptureClient = 0 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 Local $iPacketLength $g_oAudioCaptureClient.GetNextPacketSize($iPacketLength) If $iPacketLength > 0 Then If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then $iCurrentRead = 100 * $iPeak GUICtrlSetData($hControl, $iCurrentRead) If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF) EndIf EndIf EndFunc ;==>_LevelMeter Func _MicVolObject() Local Const $CLSCTX_INPROC_SERVER = 0x1 Local Const $CLSCTX_INPROC_HANDLER = 0x2 Local Const $CLSCTX_LOCAL_SERVER = 0x4 Local Const $CLSCTX_ALL = BitOR($CLSCTX_INPROC_SERVER, $CLSCTX_INPROC_HANDLER, $CLSCTX_LOCAL_SERVER) 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 $pAudioClient $oDefaultDevice.Activate($sIID_IAudioClient, $CLSCTX_ALL, 0, $pAudioClient) Local $oAudioClient = ObjCreateInterface($pAudioClient, $sIID_IAudioClient, $tagIAudioClient) If Not IsObj($oAudioClient) Then Return SetError(4, 0, 0) Local $pWFX $oAudioClient.GetMixFormat($pWFX) Global $tWAVEFORMATEX = DllStructCreate("ushort wFormatTag;ushort nChannels;dword nSamplesPerSec;" & _ "dword nAvgBytesPerSec;ushort nBlockAlign;ushort wBitsPerSample;" & _ "ushort cbSize", $pWFX) ;~ ConsoleWrite($tWAVEFORMATEX.cbSize & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wFormatTag & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nChannels & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nSamplesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nAvgBytesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nBlockAlign & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wBitsPerSample & @CRLF) $oAudioClient.Initialize(0, 0, 10000000, 0, $pWFX, 0) Local $pAudioCaptureClient $oAudioClient.GetService($IID_IAudioCaptureClient, $pAudioCaptureClient) Local $oAudioCaptureClient = ObjCreateInterface($pAudioCaptureClient, $IID_IAudioCaptureClient, $tagIAudioCaptureClient) If Not IsObj($oAudioCaptureClient) Then Return SetError(5, 0, 0) $g_oAudioCaptureClient = $oAudioCaptureClient $oAudioClient.Start() Local $pAudioMeterInformation $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_ALL, 0, $pAudioMeterInformation) If Not $pAudioMeterInformation Then Return SetError(6, 0, 0) Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc ;==>_MicVolObject Saludos thank you, how to get device list and select a specificated device? Edited 7 hours ago by Parsix
Danyfirex Posted 7 hours ago Posted 7 hours ago Enum all devices with EnumAudioEndpoints get each IMMDevice use OpenPropertyStore to get FriendlyName and use that device instance that matches what you want. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Danyfirex Posted 6 hours ago Posted 6 hours ago just for fun. clean de code (if you want) 🤣 expandcollapse popup#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 $IID_IMMDeviceCollection = "{0BD7A1BE-7A1A-44DB-8397-CC5392387B5E}" Global Const $tagIMMDeviceCollection = "GetCount hresult(uint*);" & _ "Item hresult(uint;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 Const $sIID_IAudioClient = "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}" Global Const $tagIAudioClient = "Initialize hresult(dword;dword;int64;int64;ptr;ptr);" & _ "GetBufferSize hresult();" & _ "GetStreamLatency hresult();" & _ "GetCurrentPadding hresult(dword*);" & _ "IsFormatSupported hresult();" & _ "GetMixFormat hresult(ptr*);" & _ "GetDevicePeriod hresult();" & _ "Start hresult();" & _ "Stop hresult();" & _ "Reset hresult();" & _ "SetEventHandle hresult();" & _ "GetService hresult(clsid;ptr*);" Global Const $IID_IAudioCaptureClient = "{C8ADBD64-E71E-48A0-A4DE-185C395CD317}" Global Const $tagIAudioCaptureClient = _ "GetBuffer hresult(ptr*;uint*;uint*;int64*;int64*);" & _ "ReleaseBuffer hresult(uint);" & _ "GetNextPacketSize hresult(uint*);" Global Const $IID_IPropertyStore = "{886d8eeb-8cf2-4446-8d02-cdba1dbdcf99}" Global Const $tagIPropertyStore = "GetCount hresult(dword*);" & _ "GetAt hresult(dword;ptr*);" & _ "GetValue hresult(struct*;variant*);" & _ "SetValue hresult(struct*;variant);" & _ "Commit hresult();" Global Const $sPKEY_Device_FriendlyName = "{a45c254e-df1c-4efd-8020-67d146a850e0} 14" Global $g_oAudioCaptureClient = 0 Global $oAudioMeterInformation = _MicVolObject("Microphone (Logi USB Headset)") 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 Local $iPacketLength $g_oAudioCaptureClient.GetNextPacketSize($iPacketLength) If $iPacketLength > 0 Then If $oAudioMeterInformation.GetPeakValue($iPeak) = $S_OK Then $iCurrentRead = 100 * $iPeak GUICtrlSetData($hControl, $iCurrentRead) If $iCurrentRead Then ConsoleWrite($iCurrentRead & @CRLF) EndIf EndIf EndFunc ;==>_LevelMeter Func _MicVolObject($sDeviceName = Default) Local Const $CLSCTX_INPROC_SERVER = 0x1 Local Const $CLSCTX_INPROC_HANDLER = 0x2 Local Const $CLSCTX_LOCAL_SERVER = 0x4 Local Const $STGM_READ = 0 Local Const $DEVICE_STATE_ACTIVE = 0x00000001 Local Const $CLSCTX_ALL = BitOR($CLSCTX_INPROC_SERVER, $CLSCTX_INPROC_HANDLER, $CLSCTX_LOCAL_SERVER) Local $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator) If @error Then Return SetError(1, 0, 0) Local $pDefaultDevice Local $oDefaultDevice If $sDeviceName = Default Then $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eCapture, $eConsole, $pDefaultDevice) $oDefaultDevice = ObjCreateInterface($pDefaultDevice, $sIID_IMMDevice, $tagIMMDevice) If Not IsObj($oDefaultDevice) Then Return SetError(3, 0, 0) If Not $pDefaultDevice Then Return SetError(2, 0, 0) Local $pProps $oDefaultDevice.OpenPropertyStore($STGM_READ, $pProps) $oProps = ObjCreateInterface($pProps, $IID_IPropertyStore, $tagIPropertyStore) ; Collect FriendlyName property Local $tPKEY_Device_FriendlyName = _WinAPI_PKEYFromString($sPKEY_Device_FriendlyName) Local $sName $oProps.GetValue($tPKEY_Device_FriendlyName, $sName) ConsoleWrite(">USING DEFAULT DEVICE: " & $sName & @CRLF) Else Local $pCollection $oMMDeviceEnumerator.EnumAudioEndpoints($eCapture, $DEVICE_STATE_ACTIVE, $pCollection) Local $oCollection = ObjCreateInterface($pCollection, $IID_IMMDeviceCollection, $tagIMMDeviceCollection) Local $iCount $oCollection.GetCount($iCount) ConsoleWrite("Number of Capture Devices: " & $iCount & @CRLF) Local $bMatched = False Local $pDevice Local $oDevice Local $oDefaultDevice For $i = 0 To $iCount - 1 ;~ Item at "i" index is audio endpoint device $oCollection.Item($i, $pDevice) $oDevice = ObjCreateInterface($pDevice, $sIID_IMMDevice, $tagIMMDevice) Local $pProps $oDevice.OpenPropertyStore($STGM_READ, $pProps) $oProps = ObjCreateInterface($pProps, $IID_IPropertyStore, $tagIPropertyStore) ; Collect FriendlyName property Local $tPKEY_Device_FriendlyName = _WinAPI_PKEYFromString($sPKEY_Device_FriendlyName) Local $sName $oProps.GetValue($tPKEY_Device_FriendlyName, $sName) ConsoleWrite($sName & @CRLF) If $sName = $sDeviceName Then $oDefaultDevice = $oDevice $bMatched = True ExitLoop EndIf Next EndIf If $sDeviceName <> Default Then If Not $bMatched Then ConsoleWrite("!NOT FOUND DEVICE: " & $sDeviceName & @CRLF) Return SetError(8, 0, 0) EndIf ConsoleWrite(">USING SELECTED DEVICE: " & $sName & @CRLF) EndIf Local $pAudioClient $oDefaultDevice.Activate($sIID_IAudioClient, $CLSCTX_ALL, 0, $pAudioClient) Local $oAudioClient = ObjCreateInterface($pAudioClient, $sIID_IAudioClient, $tagIAudioClient) If Not IsObj($oAudioClient) Then Return SetError(4, 0, 0) Local $pWFX $oAudioClient.GetMixFormat($pWFX) Global $tWAVEFORMATEX = DllStructCreate("ushort wFormatTag;ushort nChannels;dword nSamplesPerSec;" & _ "dword nAvgBytesPerSec;ushort nBlockAlign;ushort wBitsPerSample;" & _ "ushort cbSize", $pWFX) ;~ ConsoleWrite($tWAVEFORMATEX.cbSize & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wFormatTag & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nChannels & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nSamplesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nAvgBytesPerSec & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.nBlockAlign & @CRLF) ;~ ConsoleWrite($tWAVEFORMATEX.wBitsPerSample & @CRLF) $oAudioClient.Initialize(0, 0, 10000000, 0, $pWFX, 0) Local $pAudioCaptureClient $oAudioClient.GetService($IID_IAudioCaptureClient, $pAudioCaptureClient) Local $oAudioCaptureClient = ObjCreateInterface($pAudioCaptureClient, $IID_IAudioCaptureClient, $tagIAudioCaptureClient) If Not IsObj($oAudioCaptureClient) Then Return SetError(5, 0, 0) $g_oAudioCaptureClient = $oAudioCaptureClient $oAudioClient.Start() Local $pAudioMeterInformation $oDefaultDevice.Activate($sIID_IAudioMeterInformation, $CLSCTX_ALL, 0, $pAudioMeterInformation) If Not $pAudioMeterInformation Then Return SetError(6, 0, 0) Return ObjCreateInterface($pAudioMeterInformation, $sIID_IAudioMeterInformation, $tagIAudioMeterInformation) EndFunc ;==>_MicVolObject Func _WinAPI_PKEYFromString($sPKEY, $pID = Default) Local $tPKEY = DllStructCreate("byte GUID[16]; dword PID;") DllCall("propsys.dll", "long", "PSPropertyKeyFromString", "wstr", $sPKEY, "struct*", $tPKEY) If $pID <> Default Then DllStructSetData($tPKEY, "PID", $pID) Return $tPKEY EndFunc ;==>_WinAPI_PKEYFromString Saludos Parsix 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Parsix Posted 6 hours ago Author Posted 6 hours ago @Danyfirex It was exactly what I needed, thank you very much. May the best be with you always.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now