spatialization integrated in soundnode
This commit is contained in:
parent
73eb0d20ab
commit
73010a52e1
@ -26,3 +26,8 @@ void MusicNode::stop()
|
|||||||
if(m_valid)
|
if(m_valid)
|
||||||
m_music.stop();
|
m_music.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MusicNode::setPlayingOffset(int offset)
|
||||||
|
{
|
||||||
|
m_music.setPlayingOffset(sf::seconds(offset));
|
||||||
|
}
|
||||||
|
@ -16,7 +16,6 @@ public:
|
|||||||
void pause();
|
void pause();
|
||||||
void stop();
|
void stop();
|
||||||
void setPlayingOffset(int offset);
|
void setPlayingOffset(int offset);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MUSICNODE_H
|
#endif // MUSICNODE_H
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "scenetree.h"
|
#include "scenetree.h"
|
||||||
#include "lightnode.h"
|
#include "lightnode.h"
|
||||||
#include <SFML/System.hpp>
|
#include <SFML/System.hpp>
|
||||||
|
#include <SFML/Audio.hpp>
|
||||||
|
|
||||||
#define DEFAULT_ROTATION_SPEED 0.001f
|
#define DEFAULT_ROTATION_SPEED 0.001f
|
||||||
#define TRIGGER_VALUE 15
|
#define TRIGGER_VALUE 15
|
||||||
@ -297,6 +298,8 @@ void PlayerCharacterNode::update()
|
|||||||
m_rigidBody->setLinearVelocity(newVelocity);
|
m_rigidBody->setLinearVelocity(newVelocity);
|
||||||
}
|
}
|
||||||
m_playerLightNode->update();
|
m_playerLightNode->update();
|
||||||
|
glm::vec3 p = this->getEyePosition();
|
||||||
|
sf::Listener::setPosition(p.x,p.y,p.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerCharacterNode::toggleNoClip()
|
void PlayerCharacterNode::toggleNoClip()
|
||||||
|
@ -38,3 +38,10 @@ void SoundNode::stop()
|
|||||||
if(m_valid)
|
if(m_valid)
|
||||||
m_sound.stop();
|
m_sound.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoundNode::setPosition(glm::vec3 pos,bool relative)
|
||||||
|
{
|
||||||
|
m_sound.setPosition(pos.x,pos.y,pos.z);
|
||||||
|
m_sound.setRelativeToListener(relative);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "scene/scenenode.h"
|
#include "scene/scenenode.h"
|
||||||
#include "SFML/Audio.hpp"
|
#include "SFML/Audio.hpp"
|
||||||
|
#include "glm/vec3.hpp"
|
||||||
|
|
||||||
class SoundNode : public SceneNode
|
class SoundNode : public SceneNode
|
||||||
{
|
{
|
||||||
@ -15,6 +16,7 @@ public:
|
|||||||
void play();
|
void play();
|
||||||
void pause();
|
void pause();
|
||||||
void stop();
|
void stop();
|
||||||
|
void setPosition(glm::vec3 pos, bool relative);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SOUNDNODE_H
|
#endif // SOUNDNODE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user