Unfortunately I am rather confident that all my play's have matching stops, and my loads have matching unloads.
I have managed to create my bug quite quickly at least, if I just quickly jump between a couple of levels continually until it has loaded/unloaded 500 or so samples that seems to break it. After that point no more new sounds appear to want to load - no errors - they just never load. Things I have tried to night to remedy this include: 1. Do not allow a sound to be unloaded sooner than five seconds after it was loaded (if it is requested to be unloaded sooner than five seconds it simply gets put on a queue and processed when five seconds is up. 2. Do not allow more than one unload (at all, across all SFX) to unload within a five second internal. I pulled the five second value out of the air, but it seemed like a reasonable time for my very short samples to be loaded/unloaded - anyway, the net result is the bug is still present. I can't think of what to try next, except to try and narrow down if there is a particular number of loads/unloads that causes this bug, and potentially trying to put together a cut down sample that displays it. The way it looks right now, the cut down sample could be extremely simple, as in: loop 500 times: id = load( xyz ); unload( id ) id = load( xyz ); sleep( 10_seconds ); play( xyz ); It feels like the play call right at the bottom should exhibit the problem, as I say, I might have to see if I can repro this in a simple sample... Steve On Jan 25, 3:28 pm, darrinps <[email protected]> wrote: > I have a sound based application on the market and use SoundPool. > > Long story short, it is quirky to say the least and only likes small > sound files. I have been able to play sounds over and over (as in a > loop) and change sounds though without issue once I matched up loading > and unloading correctly. > > I don't have the code on me right now but can get it to you later. For > now though, keep the files small, and unloading matched, and it should > work. > > On Jan 24, 7:45 pm, Steve <[email protected]> wrote: > > > > > > > > > Hi there, > > > I am using a SoundPool to control the SFX in my game, which is > > targeted at Android 1.6 devices. Initially, I am able to do everything > > I wish to do, but after sometime of playing the game (can be a few > > minutes, can be more than thirty minutes), I am no longer able to play > > sounds, and instead am seeing messages in my log such as: > > > SoundPool - sample 440 not READY > > > The thing is, these samples never become ready - in fact from this > > moment on, no sound effects ever appear to be ready - it is almost as > > if the thread that handles the loading gets stuck and then no more > > sounds can load. > > > Any sounds that are loaded for the duration of the game can still be > > played and function correctly, but sounds that get loaded per level > > will no longer work from this point on. > > > I have a session of my game running now that is exhibiting this > > problem, and some statistics I have are: > > > - I have made 516 calls to load > > - I have made 513 calls to unload (I have three sounds that are > > resident, all the other loads/unloads are as I have gone in and out of > > many levels) > > - I have made 1547 play calls > > - I have made 1547 stop calls > > > I have spent some time debugging this now, and have ensured all load > > and unloads match up, and the same for play/stop calls, but I am not > > really sure what I can do next now. My only fallback I could code up > > is to destroy the sound pool from time to time, and reload the > > resident sounds - it isn't a clean solution, but I am at a loss as to > > what else I can do. It feels like the problem is more likely to crop > > up when loading/unloading lots of SFX in succession, I am not sure if > > it could be a race case to do with a resource not quite being in a > > loaded state, and not quite being in an unloaded state - of course > > this whole situation is made a lot worse by the fact I don't have a > > sensible method of querying when a sound is actually loaded in Android > > 1.6. > > > Someone out there must have a largish game on Android 1.6, using the > > SoundPool successfully? Can anyone help? > > > Many thanks, > > > Steve -- 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

