Jump to content

  • Log In with Google      Sign In   
  • Create Account


Problems with playing sounds using SoundPool


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 EasyCoder   Members   -  Reputation: 116

Like
0Likes
Like

Posted 13 February 2013 - 04:04 AM

In my Android game, I am playing short sound effects using AudioManager and SoundPool.

 

While this works fine on Samsung Galaxy Tab 10.1, when I ported the game to Samsung Galaxy SIII, I am experiencing strange lock-ups of the screen and crashes of the application with re-booting of the phone, when I am trying to play the sound from the SoundPool.

 

It behaves quite erratically and one of 4 things happen (in no particular order):

 

(1) Application starts as normal and all sounds play normally.

 

(2) Application crashes completely and mobile reboots.

 

(3) Application freezes shortly (3-5 seconds) upon trying to play the sound, then continues normally, but sounds don't work.

 

(4) Application starts as normal, but none of the sounds plays. *

 

* There is a strange twist to the 4th case. None of the sounds plays, but when I activate game background music (which plays via MediaPlayer, not via AudioManager/SoundPool) this somehow 'flushes down' the stuck sound effects which should play at the beginning of the game, and now they all catch-up and play at once. This 'flushing down' somehow returns everything back to normal and from this point on all the sound effects from the SoundPool play normally, as they should.

 

The error which I am getting is:

 

AudioTrack: obtainBuffer timed out (is the CPU pegged?) "CPU pegged" what the hell does it even mean ??? unsure.png

 

Note that the problems happen at the point in the game when I am attempting to play the sounds from the soundpool by SoundPool.play, not when I am loading them by SoundPool.load.

 

I tried just about everything and now I am at the end of my wits. Did anybody have the same problem? Any help is highly appreciated.

 

 



Sponsor:

#2 Sporniket   Members   -  Reputation: 329

Like
0Likes
Like

Posted 13 February 2013 - 04:54 AM

Does it happens after switching from apps to apps ? (home button, then home button again to go back). Anyways I take care to regenerate my soundpool for this case. But I never experienced case 2 (tested on Galaxy Note 2, Nexus One and Sony Ericsson Xperia mini pro).

 

CPU pegged :

http://soledadpenades.com/2009/08/25/is-the-cpu-pegged-and-friends/


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com


#3 EasyCoder   Members   -  Reputation: 116

Like
0Likes
Like

Posted 13 February 2013 - 09:01 AM

Does it happens after switching from apps to apps ?

 

It happens immediately after start of the app, when I attempt to play the first sound.



#4 EasyCoder   Members   -  Reputation: 116

Like
0Likes
Like

Posted 19 February 2013 - 04:18 PM

I have spent on this problem now over a week, took the whole class apart, modified, changed parameters, removed bits which I thought could cause the problem... No improvement. Re-sampled all sounds to the lowest sampling rate possible... No improvement either.

 

I am getting really fed up with this problem and starting to think I might dump the whole unreliable SoundPool and replace it with some other way of playing sounds...

 

Does anybody have any suggestions as to what is the best and most reliable way of playing sounds in Android? unsure.png (not music - short sound effects).



#5 Sporniket   Members   -  Reputation: 329

Like
0Likes
Like

Posted 20 February 2013 - 12:09 PM

Hum, you might compare how I used the SoundPool with your code here, maybe there is a difference somewhere that cause this erratic behavior.

 

Did you had the chance to try on another GS3 ?


Space Zig-Zag, a casual game of skill for Android by Sporniket-Studio.com





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS