I'm looking for an example of code that samples signal from microphone and plays it on speakers. I need a solution that has a resonably constant delay on different platforms (PC, android, iphone). Delay around 1-2 s is ok for me, and I don't mind if it varies everytime the application starts.
I tried using SampleDataEvent.SAMPLE_DATA event on Sound and Microphpne classess. One event would put data into buffer the other would read data. But it seems impossible to provide constant delay, either the delay grows constantly or it gets lower to the point where I have less than 2048 samples to put out and Sound class stops generating SampleDataEvent.SAMPLE_DATA events.
I wan't to process each incoming frame so using setLoopBack(true) is not an option.
ps This is more a problem on Android devices than on PC. Althought when I start to resize application window on PC delay starts to grow also.
Please help.