Bump.  Is SoundPool just broken?

On Feb 27, 11:30 pm, BJP <[email protected]> wrote:
> I'm having a problem where SoundPool crashes, but gives no
> programmatic indication that is has crashed.  After it crashes, it
> will not play any more sounds until the application is reloaded
> (exiting via back button then restarting is not sufficient).  LogCat
> gives me these error messages:
>
> AudioFlinger: no more track names availlable [sic]
> AudioTrack: AudioFlinger could not create track, status: -12
> SoundPool: Error creating AudioTrack
>
> Yet, despite these errors, SoundPool.play() still returns a positive
> integer that increments for each new play request which, according to
> the documentation, indicates that there was not an error.  Someone
> else started an Issue for this 
> problem:http://code.google.com/p/android/issues/detail?id=13453
>
> ...however, there have been no responses.  The code below is a
> minimalist Activity to consistently recreate this issue.  Just create
> a new Android project, set the ID of the LinearLayout to main_bg, set
> the ID of the TextView to main_tv, and add a sound file named ding to
> res/raw.  The sound file needs to be long enough to click on the
> screen four times before the first sound completes; mine is a 1.7-
> second 22050 Hz mono MP3 @ 96kbps.  After a brief pause, the fifth
> click will generate the error messages above via LogCat.  Or, you can
> just click a bunch of times until sounds stop playing.
>
> I have tested the error messages to occur on a T-Mobile G1 running
> Android 1.6 and a DroidX running Android 2.2, but they do not occur on
> a 1.6 emulator, a 2.1 emulator, or a 2.2 emulator.
>
> Does anyone know how to fix this problem, or is SoundPool just
> worthless for coincident sound effects?
>
> public class SoundTestActivity extends Activity implements
> OnClickListener {
>    private  SoundPool mSoundPool;
>    private  HashMap<Integer, Integer> mSoundPoolMap;
>    private  int index = 0;
>
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>       super.onCreate(savedInstanceState);
>       setContentView(R.layout.main);
>
> findViewById(R.id.main_bg).setOnClickListener((OnClickListener)this);
>
>       initSounds();
>       mSoundPoolMap.put(index,
> mSoundPool.load(getApplicationContext(), R.raw.ding, 1));
>    }
>
>    public void initSounds() {
>       mSoundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
>       mSoundPoolMap = new HashMap<Integer, Integer>();
>    }
>
>    @Override
>    public void onClick(View v) {
>       int result = mSoundPool.play(mSoundPoolMap.get(index), 0.99f,
> 0.99f, 1, 0, 1f);
>
> ((TextView)findViewById(R.id.main_tv)).setText(Integer.toString(result));
>    }
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to