Open cappah opened 8 years ago
UPDATE: 5/18/2016 SetPanByAngle broken
UPDATE: 5/19/2016 Fixed and improved SetPanByAngle SetPanByAngle requires the following in the base Camera class:
protected:
float m_Yaw;
public:
inline float GetYaw() const { return m_Yaw; }
Example Usage Within Test3D::OnInit():
audio::SoundManager::Add(new audio::Sound("name", "resource audio dir/name.*"));
audio::SoundManager::Get("name")->Loop();
Within Test3D::OnUpdate() (specifically in this order):
audio::SoundManager::Get("name")->SetGainByDistance(m_Scene->GetCamera()->GetPosition(), g_CubeTransform, 50.0f, 0.7f);
audio::SoundManager::Get("name")->SetPanByAngle(m_Scene->GetCamera()->GetPosition(), g_CubeTransform, m_Scene->GetCamera()->GetYaw(), 25.0f);
I would recommend using SP_INFO instead of std::cout.
@Jacob-Mango That's part of the original Sound.cpp
Audio scales based on the distance of the object emitting sound within a given radius.
Audio is panned left, center or right based on the angle of the object emitting sound in conjunction with the direction the camera is facing. Objects emitting sound that are left of the camera in accordance to the camera's facing direction will pan the audio to the left speaker for example.