Quote: "my defy played the sound file 1250 times while my nexus 10 played it 1000 times. "
That's really odd, but could be sync descrepancy. I'd be curious to know how many times it was supposed to play (i.e. number of program loops vs. sound loops)
I don't delete the sound at all I just let it keep stopping it and use a timer variable to stop stopping it.
So you could do this:
timerNow# = timer()
//stopping the sound
dTime# = timeNow# - soundTime#
abitraryRetryStopSeconds# = 2.0
if dTime# > soundDuration# and dTime# < soundDuration# + abitraryRetryStopSeconds#
if GetSoundExists(soundA) = 1
StopSound(soundA)
endif
endif
Then when you play the sound just make sure to set it's soundTime# variable to when it was initiated. You could also get more fancy and make a type for your sound objects that has variables for the start time, duration, if it is playing, how many times it has been stopped, etc. Make it global and then just make your own PlaySound function and StopSound function to wrap it up neatly.
However, this is a convoluted system and StopSound or GetSoundsPlaying needs to be more reliable.