I'm trying to write simple app to play everything from microphone, but no data seems to arrive snd_in.
AppTitle("sndapp (c) nawi")
format = snd_format_choose(0,0,"sndapp (c) nawi",0)
If Not format Then RuntimeError "Could not create audio format"
block_size = snd_format_bps(format)
Print "Block size:" + block_size
snd_in = snd_in_open(format, block_size, 3)
If Not snd_in Then RuntimeError "Could not open audio-in!"
snd_out = snd_out_open(format)
If Not snd_out Then RuntimeError "Could not open audio-out!"
buffer_in = CreateBank(block_size)
;main loop
Repeat
;Mic
If(snd_in_readavail(snd_in) >= block_size)
Print "data in the mic!"
snd_in_read(snd_in, buffer_in, block_size)
If(snd_in_readavail(snd_in) > block_size)
snd_in_flush(snd_in)
EndIf
snd_out_write(snd_out, buffer_in, 0, block_size)
EndIf
Until KeyHit(1)
|