Ich hab ein kleines Programm geschrieben, welches das Audio eine Mikrofones aufnehmen und über einen Stream wieder ausgegeben werden soll... Leider tut sich garnichts
Ich hoffe ihr könnt mir helfen.
Spoiler anzeigen
#include "udf\Bass.au3"
#include <GuiComboBoxEx.au3>
#include <GUIConstants.au3>
#include <array.au3>
Opt("GUIOnEventMode", 1)
_BASS_Startup("udf\Bass.dll")
$iRecFreq = 44100
$iRecChannel = 2
$iRecBit = 16
global $aktDevice=[-1,""],$AudioOutHandle,$aktInDevice=[-1,""],$AudioInHandle
_BASS_RecordInit(-1)
_BASS_Init(0, -1, $iRecFreq, 0, "")
$Form1=GuiCreate("MikrozuLautsprecher",500,500)
$AudioOutCombo=_GUICtrlComboBoxEx_Create($Form1,"",10,10,300)
GUICtrlSetOnEvent(_GUICtrlComboBoxEx_GetComboControl($AudioOutCombo),"_setOutDevice")
$AudioInCombo=_GUICtrlComboBoxEx_Create($Form1,"",10,40,300)
GUICtrlSetOnEvent(_GUICtrlComboBoxEx_GetComboControl($AudioInCombo),"_setInDevice")
;$Form1_ctrl_input=GUICtrlCreateCombo("",5,8,200,20)
GUISetOnEvent($GUI_EVENT_CLOSE, 'Close')
GUISetState(@SW_SHOW,$Form1)
aktOutDevices()
aktInDevices()
_start()
while sleep(10)
WEnd
Func _start()
$AudioOutHandle=_BASS_StreamCreate(44100, 2, 0)
$AudioInHandle=_BASS_RecordStart(44100, 2, 0, "RecProc")
EndFunc
Func Close()
_BASS_ChannelStop($AudioOutHandle)
_BASS_FREE()
Exit
EndFunc
Func _RecProc($handle, $buffer, $length, $user)
_BASS_StreamPutData($AudioOutHandle,$buffer,$length)
EndFunc
Func aktInDevices()
$i=0
While 1
$device=_BASS_RecordGetDeviceInfo($i)
;_ArrayDisplay($device)
if $device=0 then
ExitLoop
endif
_GUICtrlComboBoxEx_AddString($AudioInCombo,$device[0])
$i+=1
WEnd
EndFunc
Func _setInDevice()
Local $sText
$nr=_GUICtrlComboBoxEx_GetCurSel($AudioInCombo)
_GUICtrlComboBoxEx_GetItemText($AudioInCombo,$nr,$sText)
$aktInDevice[0]=$nr
$aktInDevice[1]=$sText
$device=_BASS_RecordGetDeviceInfo($nr+1)
if $device[2]<4 then
_BASS_RecordInit($nr+1)
endif
_BASS_RecordSetDevice($aktInDevice[0]+1);$AudioInHandle,
EndFunc
Func _setOutDevice()
Local $sText
$nr=_GUICtrlComboBoxEx_GetCurSel($AudioOutCombo)
_GUICtrlComboBoxEx_GetItemText($AudioOutCombo,$nr,$sText)
$aktDevice[0]=$nr
$aktDevice[1]=$sText
$device=_BASS_GetDeviceInfo($nr+1)
if $device[2]<4 then
_BASS_Init(0, $nr+1, $iRecFreq, 0, "")
endif
_BASS_ChannelSetDevice($AudioOutHandle,$aktDevice[0]+1)
EndFunc
Func aktOutDevices()
$i=0
While 1
$device=_BASS_GetDeviceInfo($i)
if $device=0 then
ExitLoop
endif
if $device[0]<>"No Sound" then
_GUICtrlComboBoxEx_AddString($AudioOutCombo,$device[0])
endif
$i+=1
WEnd
EndFunc
PS: Natürlich kenne ich die "Abhören" Funktion von Windows, wo man das Mikro direkt in den Lautsprecher schicken kann, ich möchte nur vorher das Audio noch bearbeiten, weshalb ich es selbst machen möchte/muss.
(Hauptsächlich die Lautstärke erhöhen, da mein Mikrofon selbst wenn es (in Windows) auf volle Lautstärke eingestellt ist noch sehr leise ist.)