Skip to content

fix: stop() takes too much time #312

@filiph

Description

@filiph

Description

I keep seeing a log with “stop() takes too much time for handle" when running my flutter_soloud-using game.

I wanted to provide a failing test but I've been busy so I'll at least file this bug.

I've tracked the problem to something like this. I get the problem when:

  • playing a lot of “single channel” sounds - new sounds replace preceding sounds
    • I'm doing this programatically (NOT using Soloud's voice feature). This is because I want to fade out the preceding sound while the new sound is playing.
  • I don’t ignore the future returned by `SoLoud.stop(handle)`
  • I spam starting the new sounds

I’m pretty sure there’s a bug. Some sound handles get through the cracks and their voiceEndedCompleters[handle]?.complete() never gets called.

Steps To Reproduce

I wish I had a better repro, but here's how I can do it in the giant_robot project (which @alnitak has access to):

  • open the game
  • wait until SFX are loaded (this takes a while in debug mode)
  • start moving the mouse pointer up and down the menu, so that it produces a bunch of "bleep" sounds in quick succession

Expected Behavior

All voiceEndedCompleters are completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions