Android – why is my soundpool muted?
I set up my soundpool and load sound resources in oncreate():
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
soundId = soundPool.load(this, R.raw.edible_underwear, 1);
Then I try to play such a sound twice in onclick(), one slowly on the left speaker and one mainly on the right speaker:
soundPool.play(soundId, 0.9f, 0.1f, 0, -1, 0.7f);
soundPool.play(soundId, 0.1f, 0.1f, 0, -1, 1.5f);
I can't hear it. I've fiddled with quantity, priority and rate. It hasn't helped so far. Did I miss something obvious
resolvent:
It turns out that soundpool has two errors / limitations
>Volume from 0.0F to 1.0F is not included. 1.0F and 0.0F are muted, so you must limit the volume to 0.99f. @ H_ 403_ 23 @ > loading a sample into a soundpool that is not suitable for RAM will not cause an exception to be thrown, nor will it return a soundid that can check the failure. Therefore, you must check your log and pray to the Android gods that your sample is suitable for the target device