SFML community forums

Help => Audio => Topic started by: freesoul on September 22, 2012, 11:42:42 pm

Title: Best way to use Sound?
Post by: freesoul 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
Title: Re: Best way to use Sound?
Post by: eXpl0it3r 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.
Title: Re: Best way to use Sound?
Post by: Qix 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.