Merge branch 'RepairWhoosh'

This commit is contained in:
Claudel-D-Roy 2023-12-16 12:09:04 -05:00
commit 7a7ba94cbd
2 changed files with 17 additions and 16 deletions

View File

@ -2,18 +2,18 @@
Audio::Audio() {
m_engine = irrklang::createIrrKlangDevice();
m_engine->setDopplerEffectParameters(10);
m_engine->setRolloffFactor(2);
m_engine->setDefault3DSoundMinDistance(.1);
m_engine->setDopplerEffectParameters(1);
m_engine->setRolloffFactor(1);
m_engine->setDefault3DSoundMinDistance(1);
m_engine->setDefault3DSoundMaxDistance(1000);
}
Audio::Audio(const char * music, const char* menumusic) {
m_engine = irrklang::createIrrKlangDevice();
m_engine->setDopplerEffectParameters(1);
m_engine->setRolloffFactor(2);
m_engine->setDefault3DSoundMinDistance(.1);
m_engine->setDefault3DSoundMaxDistance(1000);
m_engine->setRolloffFactor(1);
m_engine->setDefault3DSoundMinDistance(1);
m_engine->setDefault3DSoundMaxDistance(100);
m_music = m_engine->play2D(music, true, true, true, irrklang::ESM_STREAMING);
m_menumusic = m_engine->play2D(menumusic, true, true, true, irrklang::ESM_STREAMING);
m_music->setVolume(.5);

View File

@ -1409,18 +1409,19 @@ void Engine::Render(float elapsedTime) {
m_chunkmod = nullptr;
}
m_bullets[x] = nullptr;
//if (m_whoosh[x])
// m_whoosh[x]->drop();
//m_whoosh[x] = nullptr;
if (m_whoosh[x]){
m_whoosh[x]->drop();
m_whoosh[x] = nullptr;
}
break;
}
// else if (!m_whoosh[x]) {
// m_whoosh[x] = m_audio.Create3DAudioObj(m_whoosh[x], AUDIO_PATH "noise.wav", m_bullets[x]->getPos(), m_bullets[x]->getVel(), true, (m_bullets[x]->getPos() - m_player.GetPosition()).Length());
// }
// else {
// Vector3f pos = m_bullets[x]->getPos(), vel = m_bullets[x]->getVel();
// m_audio.Render3DAudioObj(m_whoosh[x], pos, vel, 5 - (m_bullets[x]->getPos() - m_player.GetPosition()).Length());
// }
else if (!m_whoosh[x]) {
m_whoosh[x] = m_audio.Create3DAudioObj(m_whoosh[x], AUDIO_PATH "noise.wav", m_bullets[x]->getPos(), m_bullets[x]->getVel(), true, (m_bullets[x]->getPos() - m_player.GetPosition()).Length());
}
else {
Vector3f pos = m_bullets[x]->getPos(), vel = m_bullets[x]->getVel();
m_audio.Render3DAudioObj(m_whoosh[x], pos, vel, m_sfxvolume);
}
}
}
}