×

Discussion Board

Results 1 to 2 of 2

Thread: Midi annoyances

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    18

    Midi annoyances

    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?..

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    27

    Repeating the Same Sound Consistantly

    1. Check if the music is playing, if it is - stop it!

    Make sure ALL of your Player objects are stopped, remember only one Player object can be started at any given time.

    2. Rewind the play cursor by calling setMediaTime(0) on the player.

    This seems to be a key step. I think the emulator rewinds automatically while the actual phone doesn't.

    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.

    I haven't found this to be necessary but it shouldn't hurt.

    4. Call start() on the player to play the music

    Once I created and called a stopMusic method which did steps 1 and 2 before I called any Player start methods all my sounds started working consistently.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×