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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:33:28+00:00 2026-06-17T21:33:28+00:00

when using soundPool my first sound loops the rest throw status 12 here is

  • 0

when using soundPool my first sound loops the rest throw status 12
here is the code

public SoundPool soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 100);
public HashMap<Integer, Integer> soundsMap;

public int playSound(int sound, int loop) {
   if (curs != sound)
   {
   curs = sound;   
       AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
       float streamVolumeCurrent = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
       float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
       float volume = streamVolumeCurrent / streamVolumeMax;  
       return soundPool.play(soundsMap.get(sound), volume, volume, 1, loop, 1);

     }else
   {
       return 0;
   }
 }

it only happens when I set loop to -1
they are very small files.

  • 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-06-17T21:33:28+00:00Added an answer on June 17, 2026 at 9:33 pm

    Try to use small size files, with .ogg formate(recommanded), I also added a sleep of 1 sec to make it buffer. outofmemory basically comes if it is not buffered and tried to play

    new Thread() {
                public void run() {
    
                    try {
                        sleep(900);
                        mSoundManager.playSound(1);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                };
            }.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
Using this code, the following execution yields strange results: C 100 R W The
I have a problem. When I try to play sound using Soundpool there is
I have button that plays sound using soundpool. I want to open my application
Quick note: I'm using the SoundPool class http://developer.android.com/reference/android/media/SoundPool.html What I have here is a
Using Play 2.1-RC1 I can't write simple test. Here's the action code: def echoTestTagFromXml
I am encountering problems with playing looping sounds using SoundPool and .OGG files. I
Using CI for the first time and i'm smashing my head with this seemingly
I'm using a SoundPool to play sounds for my Android app. All of the
I am playing audio through my app using the sound pool, do I need

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.