From 3887e7abcfe4b05d6714dfc5c97fd18a8e9eadc3 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Jun 2015 00:39:49 +0200 Subject: [PATCH] Fixed values for swoosh sound --- Escape-the-Dawn/Systems/PlayerSystem.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Escape-the-Dawn/Systems/PlayerSystem.cpp b/Escape-the-Dawn/Systems/PlayerSystem.cpp index 66f2174..ca58d58 100644 --- a/Escape-the-Dawn/Systems/PlayerSystem.cpp +++ b/Escape-the-Dawn/Systems/PlayerSystem.cpp @@ -219,10 +219,13 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa auto swoosh = m_World->CreateEntity(parent); m_World->AddComponent(swoosh, "Transform"); auto swooshSound = m_World->AddComponent(swoosh, "SoundEmitter"); - swooshSound->Gain = 2.f; - swooshSound->MaxDistance = 5.f; - swooshSound->ReferenceDistance = 1.f; + float gainchanger = float(transform->Velocity.z) / float(m_basespeed); + swooshSound->Gain = 2 * gainchanger; + swooshSound->MaxDistance = 1000; + swooshSound->ReferenceDistance = 2.f; swooshSound->Pitch = 1.f - (glm::length(parentTransform->Scale) / 12.f) * 0.5f; + LOG_ERROR("Pitch: %f", swooshSound->Pitch); + LOG_ERROR("Gain: %f. Vel: %f", swooshSound->Gain, transform->Velocity.z); auto soundSystem = m_World->GetSystem("SoundSystem"); soundSystem->PlaySound(swooshSound.get(), "Sounds/swoosh.wav"); m_World->RemoveEntity(ent);