Hi All,

I have two problems with SoundPool.
1.) My game which is published on the Market use the SoundPool. Last
week this app created an Error Message:

DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x4001d988 self=0xcca0
  | sysTid=12821 nice=0 sched=0/0 cgrp=default handle=-1345017816
  at android.os.BinderProxy.transact(Native Method)
  at android.media.IAudioService$Stub
$Proxy.adjustSuggestedStreamVolume(IAudioService.java:551)
  at
android.media.AudioManager.adjustSuggestedStreamVolume(AudioManager.java:
448)
  at
com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:
1145)
  at com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchKeyEvent(PhoneWindow.java:1682)
  at
android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:
2471)
  at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4627)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)

"SoundPool" prio=5 tid=8 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x45446880 self=0x11d250
  | sysTid=12827 nice=0 sched=0/0 cgrp=default handle=1173312
  at dalvik.system.NativeStart.run(Native Method)

"SoundPoolThread" prio=5 tid=7 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x4541be68 self=0x12a598
  | sysTid=12828 nice=0 sched=0/0 cgrp=default handle=1197032
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #2" prio=5 tid=6 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x45419530 self=0x1312e8
  | sysTid=12826 nice=0 sched=0/0 cgrp=default handle=1245456
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=5 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x45414620 self=0x12ff08
  | sysTid=12825 nice=0 sched=0/0 cgrp=default handle=1244872
  at dalvik.system.NativeStart.run(Native Method)

"Compiler" daemon prio=5 tid=4 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x454132a0 self=0x11d918
  | sysTid=12824 nice=0 sched=0/0 cgrp=default handle=1344184
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
  | group="system" sCount=0 dsCount=0 s=N obj=0x454131e8 self=0x1480c0
  | sysTid=12823 nice=0 sched=0/0 cgrp=default handle=1339776
  at dalvik.system.NativeStart.run(Native Method)

"HeapWorker" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 s=N obj=0x43e68270 self=0x146fa0
  | sysTid=12822 nice=0 sched=0/0 cgrp=default handle=1196536
  at dalvik.system.NativeStart.run(Native Method)

The result is no sound. It is importand because this game build on the
recognition of sounds

I use the Sound Pool via SoundManager. The source is:

public class SoundManager {

        private  SoundPool mSoundPool;
        private  Map<Integer, Integer> mSoundPoolMap;
        private  AudioManager  mAudioManager;
        private  Context mContext;

        public void initSounds(Context theContext) {
            mContext = theContext;
            mSoundPool = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);
            mSoundPoolMap = new HashMap<Integer, Integer>();
            mAudioManager =
(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
        }

        public void addSound(int index, int SoundID)
        {
            mSoundPoolMap.put(index, mSoundPool.load(mContext, SoundID, 1));
        }

        public void playSound(int index)
        {
                float streamVolume =
mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
                streamVolume = streamVolume /
mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                    mSoundPool.play(mSoundPoolMap.get(index), streamVolume,
streamVolume, 1, 0, 1f);
        }

        public void stopSound(int index)
        {
                mSoundPool.pause(mSoundPoolMap.get(index));
            mSoundPool.stop(mSoundPoolMap.get(index));
        }
}

In the first time It would be fill the soundManager with sounds which
are mp3's
        soundManager.initSounds(mContext);
        soundManager.addSound(0, R.raw.bear);
        soundManager.addSound(1, R.raw.cat);
        soundManager.addSound(2, R.raw.dog);
        soundManager.addSound(3, R.raw.donkey);
        soundManager.addSound(4, R.raw.elephant);
...

and it would be called the following

                soundManager.playSound(element.x);
                soundManager.stopSound(element.x);

2.) after the soundManager.stopSound(element.x) not stopping the
sound.
     element.x is the same what I started with the
soundManager.playSound(element.x).

Can anybody help me what is wrong

Thx
BR

              Szuszu...

-- 
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