I'm trying to get it so that I can play a loaded Sound file multiple times (for example, playing a bullet firing sound quickly), but calling sound_obj.play(Mixer.Default) seems to block it script execution until it finishes. Is there a way to play sound objects asynchronously?
Sound#play() shouldn't block. The
music module in particular specifically relies on it
not blocking, so it's kind of weird if it is for you.
That said, a single
Sound can only have one instance playing at a time - calling
play() on it again will just restart it:
Sound#play([mixer]);
Begins or resumes sound playback. When called with no `mixer` argument,
Sound#play() will resume playback for a paused sound. Otherwise, the sound
is started from the beginning on the specified mixer.
I should probably implement a SoundEffect API like Sphere 1.6. Something to think about for the next miniSphere version, I guess. :)
I think that might have been the issue then. Though it seems to have issues if it restarts it repeatedly .