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

Author Topic: How to manage audio with SFML?  (Read 3360 times)

0 Members and 1 Guest are viewing this topic.

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
How to manage audio with SFML?
« on: October 04, 2010, 09:39:48 pm »
Greetings,

I thought I would be able to play sounds that way :

sf::Music music;
music.OpenFromFile("../Data/Music/canary.wav");
music.Play();

If music is destroyed the sound will stop playing. What is a common technique for handling several sound entities and music playback in SFML? A separate thread for each sound and/or wrapping a sound class?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to manage audio with SFML?
« Reply #1 on: October 04, 2010, 10:14:43 pm »
Quote
If music is destroyed the sound will stop playing

If this is your only problem, then just keep the musics alive :)
You can use a global music manager if you don't want to bother with sf::Music instances in your code.
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
How to manage audio with SFML?
« Reply #2 on: October 04, 2010, 10:26:28 pm »
Hi Laurent,

Actually my real problem is to output audio from FFmpeg... honestly, I don't know where to start. Did you plan on extending this tutorial?

http://www.sfml-dev.org/wiki/fr/tutoriels/integrervideo

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to manage audio with SFML?
« Reply #3 on: October 04, 2010, 10:42:55 pm »
Quote
Actually my real problem is to output audio from FFmpeg... honestly, I don't know where to start. Did you plan on extending this tutorial?

I didn't write this tutorial. And I have no idea how to handle sound with FFmpeg, sorry.
Laurent Gomila - SFML developer