spatialization integrated in soundnode

This commit is contained in:
Lendemor 2017-09-04 19:54:29 +02:00
parent 73eb0d20ab
commit 73010a52e1
5 changed files with 17 additions and 1 deletions

View File

@ -26,3 +26,8 @@ void MusicNode::stop()
if(m_valid)
m_music.stop();
}
void MusicNode::setPlayingOffset(int offset)
{
m_music.setPlayingOffset(sf::seconds(offset));
}

View File

@ -16,7 +16,6 @@ public:
void pause();
void stop();
void setPlayingOffset(int offset);
};
#endif // MUSICNODE_H

View File

@ -11,6 +11,7 @@
#include "scenetree.h"
#include "lightnode.h"
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#define DEFAULT_ROTATION_SPEED 0.001f
#define TRIGGER_VALUE 15
@ -297,6 +298,8 @@ void PlayerCharacterNode::update()
m_rigidBody->setLinearVelocity(newVelocity);
}
m_playerLightNode->update();
glm::vec3 p = this->getEyePosition();
sf::Listener::setPosition(p.x,p.y,p.z);
}
void PlayerCharacterNode::toggleNoClip()

View File

@ -38,3 +38,10 @@ void SoundNode::stop()
if(m_valid)
m_sound.stop();
}
void SoundNode::setPosition(glm::vec3 pos,bool relative)
{
m_sound.setPosition(pos.x,pos.y,pos.z);
m_sound.setRelativeToListener(relative);
}

View File

@ -3,6 +3,7 @@
#include "scene/scenenode.h"
#include "SFML/Audio.hpp"
#include "glm/vec3.hpp"
class SoundNode : public SceneNode
{
@ -15,6 +16,7 @@ public:
void play();
void pause();
void stop();
void setPosition(glm::vec3 pos, bool relative);
};
#endif // SOUNDNODE_H