Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: DotNET question: managing playing multiple sounds  (Read 2990 times)

0 Members and 1 Guest are viewing this topic.

JohnStabler

  • Newbie
  • *
  • Posts: 8
    • View Profile
DotNET question: managing playing multiple sounds
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
DotNET question: managing playing multiple sounds
« Reply #1 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.
Laurent Gomila - SFML developer

JohnStabler

  • Newbie
  • *
  • Posts: 8
    • View Profile
DotNET question: managing playing multiple sounds
« Reply #2 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
DotNET question: managing playing multiple sounds
« Reply #3 on: January 31, 2012, 06:14:56 pm »
Yes.
Laurent Gomila - SFML developer