I know there are already a lot of topics talking about sound latency problem, but none of it has really given a working solution, and most of these did not asked for such low latency.
So what I want is Simple, I want that in response to a user input, a sound is played with less latency as possible (less than 10ms should be good enough)
All of this while a background sound is playing, and I mix the different sounds from user input(because they can overlap each other) and the background sound together
I'm using CMdaAudioOutputStream to output sound (44100Hz Stereo)
It's working but the problem with it, is that it uses a huge buffer, so if I make the calls to WriteL() in MaoscBufferCopied I get Huge latency (about 500ms or something like that)
and I get this for any size of buffer I send with WriteL(), even if I send very small, it will eat a lot of small buffers very fast at first to fill it's buffer before it starts playing a sound.
In order to reduce latency, I did this :
I fill the buffer (call to WriteL) only when the remaining amount data that has been sent but not played yet is small enough (I use CMdaAudioOutputStream::Position() to get what have been played so far).
with this I can get around 130ms latency (which is too much for what I want to do),
but I can't get less than that, because it waits for a minimum of data to be received before it starts playing a sound,
It looks like it only plays block by block (blocks of about 80ms) , if you send one and half block, it'll only play the first block and not even try to play the remaining half-block until more have been received.
From what I've seen, this seems to be true on all devices.
I heard that it was because of a software layer adding extra buffering
I also heard that a way to bypass it is using directly CMMFDevSound :
while some says you'll get the same result with it:
but I can't even try because CMMFDevSound is not available under S60 5th :
so is there a way to bypass this annoying and useless "way too big" buffering ?
and don't tell me to go see the "mixer example" this one has a HUUUGE sound latency, about 1 sec.