i'm working on a user event based real time sound synth. app. that should work with raw audio, using a ring buffer that constantly feeds the data to the blackberry player and loops the sound until some user event happens. Since the player doesn't support raw audio i'm sending a WAV header (with modified media length so the player doesn't stop when the end of a sample is reached) when the player starts and before i'm sending the actual audio data. Currently i can play a custom generated sine tone but i'm facing a major problem when trying to change the sample (resample the sine at a new frequency and send it to the player) at real time. The idea was, since i can't modify the readpointer of the player, to flush the player buffer with StreamingBufferControl.flush(), to reset the player and when he requests the new data to send him the new samples, but that didn't work out at all. I've tried debugging the player to see what exactly is happening after a flush and the result was:

- After calling flush() a com.rim.flush Event is sent from the player
- The player plays the old sample for a couple of seconds
- Buffers are set to 0 and the player requests 4 times the new sample
- Now the player starts playing the new sample

Could someone please explain to me how the bb player works or give me some ideas to how i can work around this problem.

I still don't understand why the player is requesting 4 times the data. Is it possible that the player has multiple buffers to play the audio without any delays, so that when a flush occurs it plays the data from all buffers first before reseting them?

PS: multiple players didn't work out, the delay time starting the new player and buffering the data took to long.