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

Author Topic: A lot of sf::Sounds  (Read 5772 times)

0 Members and 1 Guest are viewing this topic.

Gregory

  • Newbie
  • *
  • Posts: 41
    • View Profile
A lot of sf::Sounds
« on: October 16, 2010, 03:47:26 am »
hey guys! in my top down view game, for the enemys's shoot sound i have one "main" sf::SoundBuffer and each enemy have sf::Sound but some times when the enemy shoot his soud dont play

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A lot of sf::Sounds
« Reply #1 on: October 16, 2010, 09:22:05 am »
There's a maximum number of sf::Sound allowed, so you should reuse sound instances instead of creating new ones.
Laurent Gomila - SFML developer

Gregory

  • Newbie
  • *
  • Posts: 41
    • View Profile
A lot of sf::Sounds
« Reply #2 on: October 16, 2010, 07:18:38 pm »
i'm thinking in put in a variable the times i need to play the sound and in the end of the frame  i use some 10 sf::Sounds and play it the times that is in the list

fieryrage

  • Newbie
  • *
  • Posts: 2
    • View Profile
A lot of sf::Sounds
« Reply #3 on: January 26, 2011, 07:18:19 am »
Quote from: "Laurent"
There's a maximum number of sf::Sound allowed, so you should reuse sound instances instead of creating new ones.


I just joined this forum and was about to make a new post until I found this thread. What is the maximum number of sf::Sound allowed?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A lot of sf::Sounds
« Reply #4 on: January 26, 2011, 07:38:20 am »
Quote
What is the maximum number of sf::Sound allowed?

This is implementation dependent, but if yours is OpenAL-Soft (which should be, on all platforms supported by SFML), then it's probably 512.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
A lot of sf::Sounds
« Reply #5 on: January 26, 2011, 08:10:40 am »
Just wondering what happens if we create and then destroy sound instances, can it then create a new one? Like, we create 512 sound objects and destroy 2. Does that mean we can create 2 new ones? Or should we create a pool similar to a thread/task pool?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A lot of sf::Sounds
« Reply #6 on: January 26, 2011, 08:18:04 am »
Yes, when you destroy a sound instance it frees a slot and you can create a new one. You don't have to manage a pool.
Laurent Gomila - SFML developer