Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
make setting panningstrengthmultiplier at runtime actually work
Browse files Browse the repository at this point in the history
may or may not be expensive and needless
  • Loading branch information
pawnishoovy committed Nov 1, 2023
1 parent e3278b2 commit 50fa393
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Managers/AudioMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,12 +801,15 @@ namespace RTE {
if (result == FMOD_OK && m_CurrentActivityHumanPlayerPositions.size() == 1) {
float sqrDistanceToPlayer = (*(m_CurrentActivityHumanPlayerPositions[0].get()) - GetAsVector(channelPosition)).GetSqrMagnitude();
float doubleMinimumDistanceForPanning = m_MinimumDistanceForPanning * 2.0F;
void *userData;
result = result == FMOD_OK ? soundChannel->getUserData(&userData) : result;
const SoundContainer *soundContainer = static_cast<SoundContainer *>(userData);
if (sqrDistanceToPlayer < (m_MinimumDistanceForPanning * m_MinimumDistanceForPanning)) {
soundChannel->set3DLevel(0);
} else if (sqrDistanceToPlayer < (doubleMinimumDistanceForPanning * doubleMinimumDistanceForPanning)) {
soundChannel->set3DLevel(LERP(0, 1, 0, m_SoundPanningEffectStrength, channel3dLevel));
soundChannel->set3DLevel(LERP(0, 1, 0, m_SoundPanningEffectStrength * soundContainer->GetPanningStrengthMultiplier(), channel3dLevel));
} else {
soundChannel->set3DLevel(m_SoundPanningEffectStrength);
soundChannel->set3DLevel(m_SoundPanningEffectStrength * soundContainer->GetPanningStrengthMultiplier());
}
}
}
Expand Down

0 comments on commit 50fa393

Please sign in to comment.