tags:

views:

36

answers:

1

Hi,

I wrote an iPhone app some time ago that creates sound programatically. It uses an AudioQueue to generate sound. With the AudioQueue, I can register for a callback whenever the system needs sound, and respond by filling a buffer with raw audio data. The buffers are small, so the sound can respond to user inputs with reasonably low latency.

I'd like to do a similar app on Android, but I'm not sure how. The MediaPlayer and SoundPool classes seems to be for playing canned media from files, which is not what I need. The JetPlayer appears to be some sort of MIDI playback engine.

Is there an equivalent to AudioQueue in the Android Java API? Do I have to use native code to accomplish what I want?

Thanks.

A: 

With the AudioQueue, I can register for a callback whenever the system needs sound, and respond by filling a buffer with raw audio data.

The closest analogy to this in Android is AudioTrack. Rather than the callback (pull) mechanism you are using, AudioTrack is more of a push model, where you keep writing to the track (presumably in a background thread) using blocking calls.

CommonsWare
Cool, that sounds like exactly what I need. Thanks.
Frank LaRosa