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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - er4zox

Pages: [1]
1
Audio / Need help with audio spatialization
« on: February 17, 2015, 01:35:38 pm »
Hey guys, why does the sound play from the right speaker only when the listener is "above" the sound.
The listener has the same X/Y pos as the sound.

Thanks for the help guys!

Code:
(click to show/hide)

2
Audio / [SOLVED] Doesn't play a Mono.wav
« on: February 05, 2015, 06:14:40 pm »
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;
}
 

3
General / RectangleShape in a vector
« on: July 26, 2013, 07:56:32 pm »
Hello guys !

I have a vector inside a class:
std::vector<sf::RectangleShape*> pShapes;
sf::RectangleShape * p;

If I add something to the vector I do
p = new sf::RectangleShape;
pShapes.push_back(p);

Now the problem:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
        {
                for (int i = 0; i < pShapes.size(); ++i)
        {
                                target.draw(pShapes[i],states);
                }
        }

It gives me this error:


I searched for this problem but didn't find anything.

Thanks for your help!

Greetings
Er4zoX

Pages: [1]
anything