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

Author Topic: Best way to use Sound?  (Read 3302 times)

0 Members and 2 Guests are viewing this topic.

freesoul

  • Newbie
  • *
  • Posts: 19
    • View Profile
Best way to use Sound?
« on: September 22, 2012, 11:42:42 pm »
I have no problem with usage of sf::Music since I will use a single ambiental music for my game.

But I have doubts with the usage of sf::Sound.

I will need shot sounds and maybe other little sounds too, but what's better, a single Sound instance which plays these little sounds when is needed -stopping the previous one if is necessary- or an instance for each type of sound: shot, attack, bird, ....

Ah btw, when I run my program, even if I dont declare any sound, any music or anything that relies to audio, I hear a continuous BEEE in my speakers :S

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Best way to use Sound?
« Reply #1 on: September 23, 2012, 01:09:46 pm »
I will need shot sounds and maybe other little sounds too, but what's better, a single Sound instance which plays these little sounds when is needed -stopping the previous one if is necessary- or an instance for each type of sound: shot, attack, bird, ....
It depends on what you want to do. If there can be multiple sounds at once, then use multiple objects, otherwise one instance should be enough.

Ah btw, when I run my program, even if I dont declare any sound, any music or anything that relies to audio, I hear a continuous BEEE in my speakers :S
I guess that 'BEEE' is just a high pitched humming, right?
Some graphics card can produce such strange noises (somehow) when they are at their limits.
Try to use window.setFramerateLimit(60); or similar.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Best way to use Sound?
« Reply #2 on: September 28, 2012, 04:58:11 am »
Some graphics card can produce such strange noises (somehow) when they are at their limits.

Including when the audio cable is ungrounded (as most 1/4" or 1/8" audio cables are) and located near a power cable/source. This is called a ground-fault loop.
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.