WARN/SoundPool sample 2 not READY

SoundPool works properly on Android 1.6 but when I run on 2.1 in the Emulator I am getting a "sample 2 not READY" error message everytime I try to play a sound.

How do I fix this?


Asked by: Stella877 | Posted: 20-01-2022






Answer 1

SoundPool on Android 2.0 and higher works only with OGG Vorbis files. If you're using MP3 or the like, they won't decode.

Answered by: Melissa219 | Posted: 21-02-2022



Answer 2

On my device just wait a few seconds for the audio stream to be ready.

Or use this, OnLoadCompleteListener: http://developer.android.com/reference/android/media/SoundPool.OnLoadCompleteListener.html

I can play ogg/wav/mp3...

SoundPool can create different decoders/players for each media type.

Answered by: Darcy797 | Posted: 21-02-2022



Answer 3

Here is the code

public void loadSound (String strSound, int stream) {
     boolean loaded = false;
     mSoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
            @Override
            public void onLoadComplete(SoundPool soundPool, int sampleId,
                    int status) {
                mSoundPool.play(stream, streamVolume, streamVolume, 1, LOOP_1_TIME, 1f);
            }
        });
    try {
          stream= mSoundPool.load(aMan.openFd(strSound), 1);
        } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

Answered by: Samantha890 | Posted: 21-02-2022



Similar questions





Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top