SFML community forums

Bindings - other languages => DotNet => Topic started by: JohnStabler on January 31, 2012, 05:07:49 pm

Title: DotNET question: managing playing multiple sounds
Post by: JohnStabler on January 31, 2012, 05:07:49 pm
What would be the best way of handling multiple Sound objects? For instance, if I have a laser sound effect that is triggered twice in quick succession, the second call to the Play method on the sound causes it to stop and then play from the beginning. I'd want both sounds to be playing at the same time.

Is there any problem with creating a Sound object instance on the fly and then immediately playing it? Will I need to keep a reference to the sound to keep it playing?
Title: DotNET question: managing playing multiple sounds
Post by: Laurent on January 31, 2012, 05:58:12 pm
Quote
Will I need to keep a reference to the sound to keep it playing?

Yep, of course.
Title: DotNET question: managing playing multiple sounds
Post by: JohnStabler on January 31, 2012, 06:08:55 pm
I guess i'll just have to maintain a collection of sounds that are playing and then prune it every so often of sounds that have finished?
Title: DotNET question: managing playing multiple sounds
Post by: Laurent on January 31, 2012, 06:14:56 pm
Yes.