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 6375379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:36:27+00:00 2026-05-25T01:36:27+00:00

After some Googling it appears this is a common problem but I have yet

  • 0

After some Googling it appears this is a common problem but I have yet to find an actual solution. I haven’t tested on an actual device, but the emulator is cutting off my sound clips at around 80% done. I am playing back .wav files.

Does anyone know a programmatic solution to these problems?

edit:

    public void play(Context context){
    if (soundPlayer != null){
        soundPlayer.release();
    }

    int rId = 0;

    switch(aIndex){
        case 0: rId = R.raw.c0; break;
        case 1: rId = R.raw.c1; break;
        case 2: rId = R.raw.c2; break;
        case 3: rId = R.raw.c3; break;
        case 4: rId = R.raw.c4; break;
        case 5: rId = R.raw.c5; break;
        case 6: rId = R.raw.c6; break;
        case 7: rId = R.raw.c7; break;
        case 8: rId = R.raw.c8; break;
        case 9: rId = R.raw.c9; break;
        case 10: rId = R.raw.c10; break;
        case 11: rId = R.raw.c11; break;
        case 12: rId = R.raw.c12; break;
        case 13: rId = R.raw.c13; break;
        case 14: rId = R.raw.v14; break;
        case 15: rId = R.raw.v15; break;
        case 16: rId = R.raw.v16; break;
        case 17: rId = R.raw.v17; break;
        case 18: rId = R.raw.v18; break;
        case 19: rId = R.raw.v19; break;
        case 20: rId = R.raw.v20; break;
        case 21: rId = R.raw.v21; break;
        case 22: rId = R.raw.v22; break;
        case 23: rId = R.raw.v23; break;

        default: rId = R.raw.error; break;
    }

    soundPlayer = MediaPlayer.create(context, rId);
    if (soundPlayer != null){
        soundPlayer.start();
    }
}
  • 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-25T01:36:28+00:00Added an answer on May 25, 2026 at 1:36 am

    Well for starters, I would try to make sure MediaPlayer.create() function is called prior to the start(). If it’s a game, load the sounds when they start a new game (creating a new media player for each sound). The reason why is because the create function will effectively load the sound file there and then, ready for smooth playback when you call start. If you load the file every time before running it, not only are you doing more work than you need to, but it may have undesired effects on the emulator. I’m not sure if you’ve noticed, but the emulator isn’t exact the quickest tool out the shed compared to virtually any actual physical device. As a result, what I think may be happening is the emulator is ‘playing’ the sound and thinks that it is complete before the sound actually plays, mainly due to the emulator’s slow speed.

    Try it out on an actual device and I think you won’t have any problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inspired by this discussion , after some googling I wasn't able to find an
I did some googling to try to answer this question but even after that
After some googling and stackoverflow surfing, i didn't find any description of my problem,
I have never worked on jquery but after some googling and learning I have
After googling a bit I have found some tips about how to get online
After some find and replace refactoring I ended up with this gem: const class
Earlier I asked this question ( and after some googling I read Using your
After some googling-fu on making subscript text in crystal report, I found this ,
I need to (un)zip some files and after some googling I haven't found any
So I just got asked this at an interview today and after some googling

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.