Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2010

    Cool Playing multiple sounds at the same time (MMAPI)

    Hello coders,

    I'm making a simple game and I'd like to be able to play multiple sounds at once. Let's say, a laser, an explosion and an engine boost all happen at the same moment, each with their own sound effect.

    I've tried simply starting multiple Player objects one after the other, and have had mixed success. On an N95, I can play two mp3 sounds at once, but as soon as I start playing a third, one of the others abruptly stops.

            InputStream in = getClass().getResourceAsStream("/laser.mp3");
            try {
                p = Manager.createPlayer(in, "audio/mpeg");
            } catch (Exception ex) {
    On less well specified handsets (e.g. 2700 classic), I can only play one mp3 sound at a given moment. It seems that on any handset I can also play a midi file without affecting the currently playing mp3 sound effects.

    So my question is, how do people normally deal with sound effects in games? As the mixer capability of most handsets is so limited, what work-arounds do people employ? Does anyone know of a third-party sound mixer class? Playing more than one (or two) sound effects at once is hardly an unusual thing to want to do so I expect someone will have come up against this before :-)


  2. #2
    Registered User
    Join Date
    Jul 2010

    Re: Playing multiple sounds at the same time (MMAPI)

    My "solution" was to give each sound effect a "priorty" level, and allow high-priority sound effects to interrupt low-priority ones e.g. a whoosh sound is very low priority and may be usurped half-way through by a louder sound, such as a bang, but the whoosh should never interrupt the bang as that would sound wrong. It's not a great solution, but nobody seems to have any other ideas...

    Anyway, this approach was working okay until I decided to add a soundtrack. Obviously mp3s were out of the question, so I've resorted to midi files, which are adequate, and the system seems happy to mix midis with mp3s on the fly.


    When starting a new mp3 sound effect playing while the midi is playing, there is occasional cracking, skipping and popping, and it sounds awful.

    Has anyone got any tips for achieving smooth audio playback, with midis and mp3s simultaneously? I'd really appreciate some tips for this...

Similar Threads

  1. Playing system sounds
    By ojve in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2010-03-11, 18:25
  2. Playing sounds on 3220
    By olivier.dahon in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2006-07-07, 16:22
  3. Playing System sounds
    By rambler82 in forum Symbian
    Replies: 4
    Last Post: 2006-07-07, 13:27
  4. Lost Sounds on MMAPI
    By renegade007 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-10-21, 13:08
  5. Playing sounds = need some toons
    By melas21 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2003-08-26, 07:56

Posting Permissions

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