Up until now there was a delay between direction instructions words, e.g. “within” “800” “meters” “turn right”. Each word was contained in a separate mp3 file in order to maximize flexibility in direction variations. Problem was that there was big delay between words that sometimes led to cases where the instructions were almost irrelevant as you already passed the target point they were aiming at.
I spent the weekend in finding the root cause and trying to solve this issue. Turns out that WP7 has hard times decoding MP3 files and even worse is that you cannot pre-load/decode MP3 file before playing it.
I tried all kind of tricks in order to ‘concatenated words’ with no success:
– Use XNA SoundEffect class won’t work as it only decodes WAV files.
– I’m using MediaElement in order to play MP3, why not instantiate several such objects and play them one by one? because WP7 doesn’t allow several instances to exist – only one is allowed.
– Use playlist (client side playlist) – playlist aren’t supported in WP7.
The main issue here is that I wanted to keep the sound files in MP3 format since Waze downloads the sound files on demand from the server and I no control over the format of the d/l files. This is not quite true as I bring the hebrew and english sound files as part of the XAP file and copy them to isolatedstorage on the first time you run Waze in order to save redundant downloading time and data. So if I go with WAV format, which sould decode faster and probably solve the lagging I will lose the support for other languages’ audio.
I took the chance and converted all MP3 files to WAV files and went for a ride. Guess what? problem solved!