×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Russia, Bryansk
    Posts
    90

    MobileMedia API general question

    Does anybody have a good working example of using subj for playing MIDIs? I hove troubles with it %(

    My app has some sounds loaded from MIDI files. I need to stop them sometimes before I play another ones. And after that some sounds stops to play at all - that is I don't hear them anymore all along the app's work. Please help.

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Russia, Bryansk
    Posts
    90
    I use this code:

    Player curSound=null;
    boolean sound; // true if app uses sound

    void startPlayer(Player p){
    curSound=p;
    try{
    curSound.start();
    }
    catch (Exception e){};
    }

    public void playSound(Player p,boolean stop){
    if (sound){
    if (stop){
    if (curSound!=null){
    try{
    curSound.stop();
    }catch (Exception e){};
    }
    startPlayer(p);
    }
    else{
    if (curSound!=null){
    if (curSound.getState()!=Player.STARTED)
    startPlayer(p);
    }
    else{
    startPlayer(p);
    }

    }

    }
    }

    playSound(somePLayer,true) is called if I want to stop current Player and playSound(somePLayer,false) if I do not want to stop it.

    Is it somethong wrong with the code?

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Russia, Bryansk
    Posts
    90
    I've found that no exception is thrown - the Player just stops playing and that's all %(
    I've tried to setLoopCount(1) and setMediaTime(0) - nothing helps %(

Posting Permissions

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