mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 10:02:25 +02:00
Fix the distance attenuation of stereo local injectors
This commit is contained in:
parent
833ad936c0
commit
fdd86876cb
1 changed files with 5 additions and 1 deletions
|
@ -1333,8 +1333,12 @@ bool AudioClient::mixLocalAudioInjectors(float* mixBuffer) {
|
|||
|
||||
} else if (injector->isStereo()) {
|
||||
|
||||
// calculate distance, gain
|
||||
glm::vec3 relativePosition = injector->getPosition() - _positionGetter();
|
||||
float distance = glm::max(glm::length(relativePosition), EPSILON);
|
||||
float gain = gainForSource(distance, injector->getVolume());
|
||||
|
||||
// stereo gets directly mixed into mixBuffer
|
||||
float gain = injector->getVolume();
|
||||
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; i++) {
|
||||
mixBuffer[i] += convertToFloat(_localScratchBuffer[i]) * gain;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue