GUI
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include "audio.h"
|
||||
|
||||
irrklang::vec3df Audio::convertVector(Vector3f& vec) const { return irrklang::vec3df(vec.x, vec.y, vec.z); };
|
||||
|
||||
Audio::Audio() {
|
||||
m_engine = irrklang::createIrrKlangDevice();
|
||||
m_engine->setDopplerEffectParameters(1);
|
||||
@@ -20,25 +18,25 @@ Audio::Audio(const char * music) {
|
||||
}
|
||||
|
||||
Audio::~Audio() {
|
||||
m_music->drop();
|
||||
m_engine->drop();
|
||||
if (m_music) m_music->drop();
|
||||
if (m_engine) m_engine->drop();
|
||||
}
|
||||
|
||||
void Audio::Update3DAudio(Vector3f& pos, Vector3f& dir, Vector3f& speed) {
|
||||
m_engine->setListenerPosition(convertVector(pos),
|
||||
convertVector(dir),
|
||||
convertVector(speed));
|
||||
void Audio::Update3DAudio(Vector3f pos, Vector3f dir, Vector3f vel) {
|
||||
m_engine->setListenerPosition(irrklang::vec3df(pos.x, pos.y, pos.z),
|
||||
irrklang::vec3df(dir.x, dir.y, dir.z),
|
||||
irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
}
|
||||
|
||||
void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f& pos, Vector3f& speed, float volume = 1) {
|
||||
sound = m_engine->play3D(name, convertVector(pos), true, false, true, irrklang::ESM_NO_STREAMING, true);
|
||||
sound->setVelocity(convertVector(speed));
|
||||
void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f& pos, Vector3f& vel, float volume = 1) {
|
||||
sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), true, false, true, irrklang::ESM_NO_STREAMING, true);
|
||||
sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
sound->setVolume(volume);
|
||||
}
|
||||
|
||||
void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& speed, float volume = 1) {
|
||||
sound->setPosition(convertVector(pos));
|
||||
sound->setVelocity(convertVector(speed));
|
||||
void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume = 1) {
|
||||
sound->setPosition(irrklang::vec3df(pos.x, pos.y, pos.z));
|
||||
sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
sound->setVolume(volume);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user