Skip to content

SoundEffectInstance reuse causing InstancePlayLimitException #7648

@HarriOrri

Description

@HarriOrri

I've been having issues when I stop and start a SoundEffectInstance quicker than the length of that sound. The following code snippet is sometimes called repeatedly for a while every 0.5s while the sound is 1s long:

AttackSound?.Stop(); AttackSound?.Play();

Essentially I want to cancel the previous SoundEffectInstance and stop it from playing, then restart it from the start. However, when I do this the SoundEffectInstancePool slowly fills up the list to 256 of that SoundEffectInstance, causing it to throw an InstancePlayLimitException at me. This only happens when the time between calls to the previous code snippet is shorter than the sound effect itself and it's called repeatedly for a while.

What version of MonoGame does the bug occur on:

  • MonoGame 3.8

What operating system are you using:

  • Windows and Mac

What MonoGame platform are you using:

  • DesktopGL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions