I setup my SoundPool, and load a sound resource as this in onCreate():
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
soundId = soundPool.load(this, R.raw.edible_underwear, 1);
And then I try to play this sound twice in a onClick(), one slow mostly in left speaker, and one fast mostly in the right speaker:
soundPool.play...
Android's soundpool.play [documentation][1] says "The playback rate allows the application to vary the playback rate (pitch) of the sound. A value of 1.0 means play back at the original frequency. A value of 2.0 means play back twice as fast, and a value of 0.5 means playback at half speed.".
However, when I set the rate to 1.49f, I hea...
I am unable to use the following to code to play multiple sounds/beeps simultaneously. In my onclicklistener I have added ... public void onClick(View v) { mSoundManager.playSound(1); mSoundManager.playSound(2); } ... But this plays only one sound at a time, sound with index 1 followed by sound with index 2.
How can I play atleast 2 ...
I tried using the load function of the SoundPool that takes a FileDescriptor, because I wanted to be able to set the offset and length. The File is not stored in the Ressources but a file on the storage card. Even though neither the load nor the play function of the SoundPool throw any Exception or print anything to the console, the soun...
Occasionally when I have a lot going on in my app, and I am playing a number of sounds using SoundPool, my app just completely freezes. Looking at the logs, I see this:
I/AudioHardwareMSM72XX( 56): AudioHardware pcm playback is going to standby.
My app must then be force closed and restarted. Does anyone know what may be causing t...
This question is related to this one.
I managed to modify my code to use SoundPool instead of AudioManager. Know it works more or less.
public class Sound {
private static boolean sound = true;
private static final int EAT_SOUND = 1;
private static final int SHORT_EAT_SOUND = 2;
private static final int EAT_CHERRY_SOU...
I'm allowing the user to push buttons to play sounds via a SoundPool. Is it possible to record whatever the SoundPool is playing so that the user can record a sequence of sounds?
...
I made a SoundManager class that uses SoundPool functions in order to loop a specific sound, however I can't figure out why it isn't playing a sound.
public class SoundManager {
private SoundPool mSoundPool;
private HashMap<Integer, Integer> mSoundPoolMap;
private AudioManager mAudioManager;
private Context mContext;
public Soun...
hi, friends,
i found these code may case memory leak on android 2.1
SoundPool soundPool = new SoundPool(10, 7, 0);
...
...
soundPool = null;
every time after the execution, the MAT pluging tells that two String objects of "android:unnamed_thread" are added to the heap of the process. is that an issue?
...
Quick note: I'm using the SoundPool class
http://developer.android.com/reference/android/media/SoundPool.html
What I have here is a simple button that plays a looped sound while it's pressed. It works great. However, sounds.autoPause(); wasn't introduced until API 8 and I really need something that is cupcake compatible (API 3) So i wa...
Hi, I have a soundpool object and several sounds, but once created I can't change the sounds playback in anyway, such as number of loops, volume, stopping, etc.
Declaration code:
public SoundPool sounds;
public HashMap<Integer, Integer> soundmap = new HashMap<Integer, Integer>();
static final public int UFO=3;
static final public int P...
Is there a reliable way to prevent truncating of sounds in soundpool? I have had some success with the sleep() function between sounds, but they still sometimes miss the last bit of sound before starting another sound. My app plays short sounds in sequence.
Jerry
...
Tried both soundpool and mediaplayer but cant quite manage to get sound files to play back correctly in sequence without overlap.. Need to be able to playback three randomly selected audio files in sequence without overlap. Any examples of using soundpool to play back audio sequentially? would be very much appreciated.. seems like such ...
When I click, the following code leads the two sounds to be played not simultaneously, but sequentially. Why are they not played simultaneously?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mytextview=(TextView) findViewById(R.id.textview);
...
I've got an app on the Android Market and have been using the SoundPool classes for the sound effects. I've noticed that, of all the parts of the Android API, this seems to have caused me the most problems. For example:
HTC Desire has problems playing WAV files (this causes it to lock up randomly). Using .ogg files fixes this
On the Dr...
I have a custom class called "Sound" with SoundPool, I want to implement the loading complete listener so that my activity can play an intro sound and display the "start" button once loading is complete.
How would I go about implementing the listener and then testing for the complete status from my activity to make sure everything is lo...