есть 2 скрипта
1 скрипт отслеживает громкость звука в микрофоне
сама переменная получается в $mciError
2 код запись звука самого.
как объединить эти скрипты что бы записывалось когда громче n значения, и останавливалось когда после m значения.Мои знания не позволили сделать обращаюсь к форуму.Заранее спасибо.
1 скрипт отслеживает громкость звука в микрофоне
Код:
#Include <string.au3>
#include <GUIConstants.au3>
#include <misc.au3>
#include <GUIConstantsEx.au3>
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 1)
$dot = False
$bg = 0x222222
$graph = 0xFFFFFF
$run = True
Dim $lpszDevice
Dim $lpszDeviceID
Dim $lpszOpenFlags
Dim $lpszRequest
Dim $lpszFlags
Dim $lpszCommand
Dim $lpszReturnString
Dim $cchReturn
Dim $mciError
$lpszDevice = "new type waveaudio"
$lpszOpenFlags = "alias mywave"
$lpszFlags = ""
$lpszCommand = StringFormat("open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags)
$lpszReturnString = _StringRepeat(" ", 100)
$cchReturn = StringLen($lpszReturnString)
$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);
If $mciError[0] <> 0 Then _mciShowError($mciError[0])
$lpszDeviceID = "mywave"
$lpszRequest = "level"
$lpszFlags = ""
$lpszCommand = StringFormat("status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags);
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 105, 183, 193, 115, -1)
$Progress1 = GUICtrlCreateProgress(9, 8, 39, 169)
GUICtrlSetColor(-1,0x0)
GUICtrlSetbkColor(-1,0x00FF00)
$Progress2 = GUICtrlCreateProgress(57, 8, 39, 169)
GUICtrlSetBkColor(-1,0x0)
GUICtrlSetColor(-1,0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$run = True
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
If $run = True Then
$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);
If $mciError[0] <> 0 Then _mciShowError($mciError[0])
$mciError = (100*$mciError[2])/100
If $mciError > 100 Then $mciError = 150
GUICtrlSetData($Progress1,$mciError)
GUICtrlSetData($Progress2,$mciError)
EndIf
WEnd
сама переменная получается в $mciError
2 код запись звука самого.
Код:
$filename="my1.wav"
func _startwav()
mciSendString("close all")
mciSendString("open new type waveaudio alias capture")
mciSendString("set capture bitspersample 16") ; 8, etc.
mciSendString("set capture samplespersec 22050") ; 44100, etc...
mciSendString("set capture channels 1") ; or 2
mciSendString("record capture")
EndFunc
; keep recording for 5 seconds
func _stopwav()
; stop and save recording to $filename
mciSendString("stop capture")
mciSendString('save capture "' & $filename & '" wait')
mciSendString("close capture")
EndFunc
;===============================================================================
; Description: Send Windows Media Control Interface (MCI) string
; Parameter(s): MCI command string. See command reference at:
; http://msdn.microsoft.com/en-us/library/ms710815(VS.85).aspx
; Requirement(s): None
; Return Value(s): on success = 1, on fail = 0 and @error set to 1
;===============================================================================
Func mciSendString($s)
DllCall("winmm.dll", "int", "mciSendString", "str", $s, "str", "", "int", 65534, "hwnd", 0)
If @error Then
SetError(1)
Return 0
Else
Return 1
EndIf
EndFunc
как объединить эти скрипты что бы записывалось когда громче n значения, и останавливалось когда после m значения.Мои знания не позволили сделать обращаюсь к форуму.Заранее спасибо.