Hey guys, I wanted to experiment with spatialized sounds but I'm already stuck on playing a normal Mono file.
I know that spatialized sounds have to be mono, but it doesn't even play the mono sound. However, it does play the sound rendered in stereo. I really dont know why this happens.
Is there anything special I have to care for while rendering a mono file so SFML can use it?
The 2 sounds (Mono/Sterero) are attached.
Thanks for your help!
Greetings
Er4zoX
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(500, 500), "SFML works!");
sf::SoundBuffer sb_Sound;
sf::Sound snd_Sound;
sb_Sound.loadFromFile("SFMLSoundTestMono.wav"); // Sound in Mono
//sb_Sound.loadFromFile("SFMLSoundTest.wav"); // Sound in Stereo
snd_Sound.setBuffer(sb_Sound);
sf::RectangleShape shape;
shape.setSize(sf::Vector2f(50.0f,50.0f));
shape.setPosition(200,200);
snd_Sound.setLoop(true);
snd_Sound.play();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}