Mikrophon auslesen
Übersicht

![]() |
VertexBetreff: Mikrophon auslesen |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: Strict
' ---------------------------------------------------------------------------------------------------------- Const WAVE_INVALIDFORMAT = $000 ' invalid forma Const WAVE_FORMAT_1M08 = $001 ' 11.025 kHz,Mono, 8-bit Const WAVE_FORMAT_1S08 = $002 ' 11.025 kHz,Stereo, 8-bit Const WAVE_FORMAT_1M16 = $004 ' 11.025 kHz,Mono, 16-bit Const WAVE_FORMAT_1S16 = $008 ' 11.025 kHz,Stereo,16-bit Const WAVE_FORMAT_2M08 = $010 ' 22.05 kHz,Mono, 8-bit Const WAVE_FORMAT_2S08 = $020 ' 22.05 kHz,Stereo, 8-bit Const WAVE_FORMAT_2M16 = $040 ' 22.05 kHz,Mono, 16-bit Const WAVE_FORMAT_2S16 = $080 ' 22.05 kHz,Stereo,16-bit Const WAVE_FORMAT_4M08 = $100 ' 44.1 kHz,Mono, 8-bit Const WAVE_FORMAT_4S08 = $200 ' 44.1 kHz,Stereo, 8-bit Const WAVE_FORMAT_4M16 = $400 ' 44.1 kHz,Mono, 16-bit Const WAVE_FORMAT_4S16 = $800 ' 44.1 kHz,Stereo,16-bit Const WAVE_FORMAT_PCM = $001 Const WHDR_DONE = $001 Const WHDR_PREPARED = $002 Const WHDR_BEGINLOOP = $004 Const WHDR_ENDLOOP = $008 Const WHDR_INQUEUE = $010 Extern "Win32" Function waveInGetDevCapsA(uDeviceID:Int, WaveInCapsPointer:Byte Ptr, WaveInCapsStructSize:Int) Function waveInOpen(WaveDeviceInputHandle:Byte Ptr, .. WhichDevice:Int, .. WaveFormatExPointer:Byte Ptr, .. CallBack:Byte Ptr, .. CallBackInstance:Byte Ptr, .. Flags:Int) Function waveInGetNumDevs() Function waveInClose(WaveDeviceInputHandle:Int) Function waveInStart(WaveDeviceInputHandle:Int) Function waveInReset(WaveDeviceInputHandle:Int) Function waveInStop(WaveDeviceInputHandle:Int) Function waveInAddBuffer(InputDeviceHandle:Int, WaveHdrPointer:Byte Ptr, WaveHdrStructSize:Int) Function waveInPrepareHeader(InputDeviceHandle:Int, WaveHdrPointer:Byte Ptr, WaveHdrStructSize:Int) Function waveInUnprepareHeader(InputDeviceHandle:Int, WaveHdrPointer:Byte Ptr, WaveHdrStructSize:Int) End Extern ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- Type TWaveHdr Field pData:Byte Ptr Field iBufferLength:Int Field iBytesRecorded:Int Field iUser:Int Field iFlags:Int Field iLoops:Int Field pNext:Int Field iReserved:Int End Type Local tWaveCaps:TBank Local bNumDevices:Byte Local iIndex:Byte Local bCharIndex:Byte Local bChar:Byte Local sProductName:String Local iDevice:Byte Local tWaveFmt:TBank Local iDevHandle:Int Local tWaveData:TBank Local tWaveHead:TWaveHdr ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- tWaveCaps = CreateBank(48) bNumDevices = waveInGetNumDevs() For iIndex = 0 To bNumDevices-1 waveInGetDevCapsA(iIndex, BankBuf(tWaveCaps), 48) If PeekInt(tWaveCaps, 40) | WAVE_FORMAT_1M08 Then For bCharIndex = 8 To 38 bChar = PeekByte(tWaveCaps, bCharIndex) If bChar = 0 Then Exit sProductName = sProductName+Chr(bChar) Next Print "("+(iIndex+1)+") "+sProductName; sProductName="" EndIf Next ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- Print "Select a device" iDevice = Asc(Input("Device "))-48 If (iDevice < 0) Or (iDevice > bNumDevices+1) Then Print "Index out of range" FlushMem ; WaitKey ; End EndIf ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- tWaveFmt = CreateBank(18) PokeShort tWaveFmt, 00, WAVE_FORMAT_PCM ' FormatTag PokeShort tWaveFmt, 02, 1 ' Channels PokeInt tWaveFmt, 04, 11025 ' SamplesPerSec PokeInt tWaveFmt, 08, 11025 ' AvgBytesPerSec | BlockAlign * SamplesPerSec PokeShort tWaveFmt, 12, 1 ' BlockAlign | (Channels * BitsPerSample) / 8 PokeShort tWaveFmt, 14, 8 ' BitsPerSample PokeShort tWaveFmt, 16, 0 ' ExtraDataSize waveInOpen Varptr iDevHandle, iDevice-1, BankBuf(tWaveFmt), Null, Null, 0 If iDevHandle = 0 Then Print "Can't open device!" FlushMem ; WaitKey ; End EndIf waveInStart(iDevHandle) tWaveData = CreateBank(512) tWaveHead = New TWaveHdr tWaveHead.pData = BankBuf(tWaveData) tWaveHead.iBufferLength = 512 waveInPrepareHeader iDevHandle, tWaveHead, 32 ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- Graphics 512, 256, 0, 0 While Not KeyDown(1) Cls waveInAddBuffer iDevHandle, tWaveHead, 32 For iIndex = 0 To 511 DrawLine iIndex, PeekByte(tWaveData, iIndex), iIndex, 0 Next Flip Wend ' ---------------------------------------------------------------------------------------------------------- ' ---------------------------------------------------------------------------------------------------------- waveInUnprepareHeader iDevHandle, tWaveHead, 32 waveInReset iDevHandle waveInClose iDevHandle FlushMem End ' ---------------------------------------------------------------------------------------------------------- Funktioniert noch nicht perfekt, aber egal ![]() mfg olli |
||
vertex.dreamfall.at | GitHub |
![]() |
IronstormErstklassiger Contest-Veranstalter |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hey vertex! Respekt ![]() Ist doch voll gut. zwar noch nicht perfekt aber ich kanns net besser. ![]() |
||
..:: blackbird design : blackbird photography : Futuro Verde : X-Commander ::..
MacBook | Intel Core 2 Duo 2,1 GHz | 2048 MB RAM | 80 GB HDD | Mac OS X 10.6.2 (Snow Leopard) | Adobe CS4 Design Premium |
Blitz_2D_Programmierer |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
funct bei mir net! | ||
NewSamurai |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Gibs sowas auch für BB3D?
Greez NewSamurai |
||
![]() |
Markus2 |
![]() Antworten mit Zitat ![]() |
---|---|---|
@NewSamurai
also ich hatte sowas mal mit nem geilen Effekt in 3D versehen (in BB3D) aber das läuft unter XP nicht mehr . Da zickt die API rum . |
||
NewSamurai |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
mmh ok danke
newsamurai |
||
![]() |
Geeecko |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich habe soeinen Code für BB3D.
Da habe ichj lange gebrauch um den zu schreiben ![]() |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
~GESCHLOSSEN~ Gaia, solltest Du weiter alte Threads mit solchen Leeraussagen pushen, gibt es eine Verwarnung. |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group