[Core] [FMOD] Neutral panning when source is close to listener#559
Open
Schroedingers-Cat wants to merge 2 commits intoValveSoftware:masterfrom
Open
Conversation
When source and listener are close, api_geometry::calculateRelativeDirection would return Vector3f::kYAxis, which results in a sound panned fully left. This is a common situation, for example in the editor context of FMOD Studio. A better default value therefore is the forward direction of a right-handed coordinate system, resulting in sounds panned to the center (front) which is more neutral when no positional context has been established yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #557.
The calculateRelativeDirection() function returns kYAxis when the distance between source and listener is smaller than 0.00001 which causes Steam Audio to render the sound from the left on a speaker array. While there is no right answer to the situation that source and listener are at exactly the same position, generally returning Steam Audio's front vector will lead to more neutral results. One such example is previewing sound events in a middleware like FMOD Studio where the listener defaults to the source's location.
As an additional safety measure, the Steam Audio Spatializer (FMOD) now checks if the source and listener are at exactly the same position and nudges the source 0.0001 to the listener's front. That nudging though is a magic number depending on another magic number from the core library, so should someone change the threshold in the core library to something like 0.01, it won't be effective anymore.