Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Performance #14

Closed
luanpotter opened this issue Apr 27, 2018 · 1 comment
Closed

Improve Performance #14

luanpotter opened this issue Apr 27, 2018 · 1 comment

Comments

@luanpotter
Copy link
Member

As per discussed here, there is a performance impact when playing sounds at a really fast rate (like 2 per second). We need to take a look at what's causing this.

@luanpotter
Copy link
Member Author

This was fixed on 0.7.0. Now you can change the releaseMode to STOP in order for it to not be release. Then you can load the asset once with setUrl and then use resume to play as needed (this fixes @matejthetree problem with performance on the first sound played on flame), using something like this:

    // setup
    AudioPlayer player = new AudioPlayer();
    player.setReleaseMode(ReleaseMode.STOP); // this will not release the player when finished
    player.setUrl('...url...'); // this will prepare the player and leave it ready

    // play
    player.resume(); // instantly plays the sound

    // dispose (after game/stage finishes)
    player.release();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant