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

Author Topic: How many threads are created for multiple sf::Sound and/or sf::Music?  (Read 1987 times)

0 Members and 1 Guest are viewing this topic.

jwurzer

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
The tutorial page "Playing sounds and music" ( https://www.sfml-dev.org/tutorials/2.4/audio-sounds.php ) says that "Sounds (and music) are played in a separate thread."

Is there only one separate thread for all current used sf::Sound's and sf::Music's or create each sf::Sound and sf::Music its own thread?

Best regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How many threads are created for multiple sf::Sound and/or sf::Music?
« Reply #1 on: December 06, 2017, 08:41:47 pm »
There's (most likely, it's an internal detail of OpenAL Soft) a single thread for audio processing, plus one thread created by SFML for each sf::SoundStream (sf::Music).
Laurent Gomila - SFML developer

jwurzer

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: How many threads are created for multiple sf::Sound and/or sf::Music?
« Reply #2 on: December 06, 2017, 09:04:05 pm »
Thank you for the info!

This means that a instance of sf::Sound (which is no derivation of sf::SoundStream) with a sf::SoundBuffer creates no additional thread (only the thread(s) which already exist for audio processing are used to play sf::Sound). Is that correct?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: How many threads are created for multiple sf::Sound and/or sf::Music?
« Reply #3 on: December 06, 2017, 09:52:02 pm »
That is correct, yes.
Laurent Gomila - SFML developer