Added spatial audio #374

Merged
srishamharan merged 4 commits from SP3-129-AudioSystem into main 2023-02-28 13:17:19 +08:00
1 changed files with 2 additions and 7 deletions
Showing only changes of commit 417f086dfa - Show all commits

View File

@ -91,11 +91,6 @@ namespace SHADE
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
//auto clip = CreateAudioClip("event:/Characters/sfx_footsteps_human");
//clip->Play();
//PlayEventOnce("event:/Characters/sfx_footsteps_raccoon");
//PlayEventOnce("event:/SFX/Dawn/Dawn_Attack");
#ifdef SHEDITOR
// Subscribe to Editor State Change Events
@ -163,13 +158,13 @@ namespace SHADE
}
auto [begin, end] = audioClipLibrary.GetDenseAccess();
for(auto it = begin; it != end; ++it)
for (auto& it = begin; it != end; ++it)
{
if(it->instance && (it->transformRef != MAX_EID))
{
if(SHTransformComponent* transformComponent = SHComponentManager::GetComponent_s<SHTransformComponent>(it->transformRef))
{
FMOD_3D_ATTRIBUTES attribs{ { 0 } }; //TODO: Set other attribs
FMOD_3D_ATTRIBUTES attribs{ { 0 } };
auto pos = transformComponent->GetWorldPosition();
SHQuaternion worldOrientation = transformComponent->GetWorldOrientation();
SHVec3 orientatedFoward = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Forward) * SHQuaternion::Conjugate(worldOrientation)).ToEuler();