Lot's of people have posted regarding playback of midi files on the series 60 hand sets. I can't seem to find a water proof solution to the problem of playing a midi file.
I've tried all sorts of things to have the midi file play on the phone, and I've managed to have them playing once but I've never managed to play a midi file once it has been stopped. Also there's a lot of things that need to be specified within the documentation in ordet to give a clear overview of how it actually works.
What I gather is this. For loading a midi file you need to:
1. open the stream
2. create the player using the manager
3. realize the stream
4. wait for the stream to be realized (i.e. wait untill the player goes into the realized state). I'm doing this because someone pointed out that the stream might not actually load before the stream is closed if closing is done emidiately after realize() is called.
5. close the stream.
Now, if I call prefetch() and start() on the player now, the midi file will actually play. But I rather wait untill i actually need the music to play. Knowing this it should be able to make usefull "playMusic" function.
1. Check if the music is playing, if it is - stop it!
2. Rewind the play cursor by calling setMediaTime(0) on the player.
3. I gather that I'd need to call prefetch() now, since the midi data should be processed for a couple of frame of playback.
4. Call start() on the player to play the music.
I've tried all of this a million times, doing small revisions here and there, but nothing seems to work. Either the phone simply stops responding or no music is heard.
Has anyone had any success with playing midi files in a usefull maner?..