The strangest thing. When the animation is playing I hear my sound effect clear but when I don't have the animation playing the sound effect breaks. Here is the code:
private void Feedback(boolean success)
{
Log.d(TAG, "Feedback");
if(success)
{
PlayCreatureSound();
ShowAnimatedCreature();
}
else
{
PlayFailedSound();
}
}
private void PlayCreatureSound()
{
Log.d(TAG, "PlayCreatureSound");
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
float curVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
float maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
float leftVolume = curVolume/maxVolume;
float rightVolume = curVolume/maxVolume;
spCreatureVoice.play(iCreatureVoicesId[lastCreature.ordinal()], leftVolume, rightVolume, 1, 0, 1);
}
private void PlayFailedSound()
{
Log.d(TAG, "PlayFailedSound");
spCreatureVoice.stop(iCreatureVoicesId[FeedbackCreature.FC_COUNT.ordinal()]);
AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
float curVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
float maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
float leftVolume = curVolume/maxVolume;
float rightVolume = curVolume/maxVolume;
spCreatureVoice.play(iCreatureVoicesId[FeedbackCreature.FC_COUNT.ordinal()], leftVolume, rightVolume, 1, 0, 1);
}
private void ShowAnimatedCreature()
{
Log.d(TAG, "ShowAnimatedCreature");
// show the creature
ibtnShapes[lastTargetLocation].setImageBitmap(bmCreatures[lastCreature.ordinal()]);
// animate
ibtnShapes[lastTargetLocation].startAnimation(rotate[0]);
}
I already tried: 1. switching files 2. using MediaPlayer 3. removing "spCreatureVoice.stop(..." 4. changing priority