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

Custom Pan Value for SoundContainers #572

Merged
merged 4 commits into from
Dec 20, 2023
Merged

Conversation

pawnishoovy
Copy link

adds CustomPanValue R/W ini lua property from -1.0f to 1.0f for hard-overriding left-right panning. on non-immobile sounds, volume and EQ attenuation will still occur, but the sound will remain in the exact position that is set.

not setting it, or setting it back to 0, will enable default spatial panning behavior. for disabling panning outright PanningStrengthMultiplier should be used, so this 0-to-reset deal is fine.

currently used for refinery ambiences, so the oneshots are placed around in the stereo soundscape instead of always center.

@pawnishoovy pawnishoovy self-assigned this Dec 16, 2023
@@ -602,6 +602,11 @@ namespace RTE {
result = (result == FMOD_OK) ? channel->setPriority(soundContainer->GetPriority()) : result;
float pitchVariationMultiplier = pitchVariationFactor == 1.0F ? 1.0F : RandomNum(1.0F / pitchVariationFactor, 1.0F * pitchVariationFactor);
result = (result == FMOD_OK) ? channel->setPitch(soundContainer->GetPitch() * pitchVariationMultiplier) : result;

if (soundContainer->GetCustomPanValue() != 0.0f) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you set the pan to, for example, 1, and then try to reset it to 0? Will it stay at 1?

@@ -807,7 +812,7 @@ namespace RTE {
void *userData;
result = result == FMOD_OK ? soundChannel->getUserData(&userData) : result;
const SoundContainer *soundContainer = static_cast<SoundContainer *>(userData);
if (sqrDistanceToPlayer < (m_MinimumDistanceForPanning * m_MinimumDistanceForPanning)) {
if (sqrDistanceToPlayer < (m_MinimumDistanceForPanning * m_MinimumDistanceForPanning) || soundContainer->GetCustomPanValue() != 0.0f) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already saying no guarantees for non-immobile sounds, why add this check?

network stuff there Just In Case, and to conform with what's already there. it's entirely pointless, but it was that or rename this branch remove-multiplayer
@Causeless Causeless added this pull request to the merge queue Dec 20, 2023
Merged via the queue into development with commit 3367d0a Dec 20, 2023
2 of 4 checks passed
@Causeless Causeless deleted the fmod-custom-panning branch December 20, 2023 06:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants