Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:58:22+00:00 2026-05-26T18:58:22+00:00

I am having the following problem when playing sounds on the blackberry: The first

  • 0

I am having the following problem when playing sounds on the blackberry:

  • The first time a sound is played, the app hangs for ~500 ms (not when the player is created, just when the sound is actually played)
  • There is a delay between the call and the sound being played

I have tested on a physical device in addition to the simulator. On the simulator, there must a bug, because it takes seconds before the sounds start (I have heard this is a problem with the simulator, so…).

I also have tested .wav vs .mp3 files, and it gives pretty much the same result.

Here is the code I use to load a player:

            stream = new Object().getClass().getResourceAsStream(fileName);
            result = javax.microedition.media.Manager.createPlayer(stream, fileName.endsWith(".wav")?"audio/x-wav":"audio/mpeg");
            if (prefetch) {
                result.prefetch();
            }

I then store the player reference, that I use later to play the sound with the following code:

            javax.microedition.media.Player player = (javax.microedition.media.Player)resources[soundId];
            if (player != null) {
                    //#debug
                    System.out.println("Player state: " + player.getState());
                    if (player.getState() != javax.microedition.media.Player.STARTED) {
                        player.setLoopCount(loopCount);
                        player.start();   
                    }
            }

I am positive the delay is due to the sound playing because I have a switch to turn it off and the delays goes away when I do that. Is there something I am doing wrong?

Update

Nothing worked, so I ended up changing the sounds to midi files which are handled better. If any one finds a solution, I would still like to hear it however.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:58:23+00:00Added an answer on May 26, 2026 at 6:58 pm

    There is no good solution to the problem, but here is how to mitigate it:

    • Create a separate thread to play the sounds (that is the thread that will call .start() on the Players, since that is the function that hangs)
    • If the frame rate of your game is too high and in consequence you are using 100% of the CPU, the media player will not get enough time to prepare the buffer between frames, so it will take a long time to run. Lower the frame rate a little to help.
    • At the Developer Conference, RIM showed code for a Wave Mixer that should fix the problem by keeping a player open while mixing incoming sound files into the stream. However they have not yet released the code.
    • On OS 7, under high cpu load, the midi files mess up with the frame rate, so avoid it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying generics for the first time and am having a problem. I have
am having the following problem: In my app I am creating a temporary object,
I'm having following problem. I should convert a control to a certain type, this
I'm having the following problem. I created a application context file for spring.net. The
I'm having the following problem and wondered whether anyone could see why this is
I have been having the following problem, i think it's probably due to the
I'm having the following problem using the Visual Studio 2010 Team System Beta 1:
I've been having the following problem with my GoDaddy's server. I am using JSPs
I'm having the following problem: When I got two labels into each other: <Label
I'm having the following problem when using GWT and request factory. I am working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.