mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:19:05 +02:00
Add AudioClient mixing gains for local injectors and system sounds
This commit is contained in:
parent
7311c3ac06
commit
e6c720f793
2 changed files with 7 additions and 1 deletions
|
@ -1366,7 +1366,9 @@ bool AudioClient::mixLocalAudioInjectors(float* mixBuffer) {
|
||||||
memset(_localScratchBuffer, 0, bytesToRead);
|
memset(_localScratchBuffer, 0, bytesToRead);
|
||||||
if (0 < injectorBuffer->readData((char*)_localScratchBuffer, bytesToRead)) {
|
if (0 < injectorBuffer->readData((char*)_localScratchBuffer, bytesToRead)) {
|
||||||
|
|
||||||
float gain = injector->getVolume();
|
bool isSystemSound = !injector->isPositionSet() && !injector->isAmbisonic();
|
||||||
|
|
||||||
|
float gain = injector->getVolume() * (isSystemSound ? _systemInjectorGain : _localInjectorGain);
|
||||||
|
|
||||||
if (injector->isAmbisonic()) {
|
if (injector->isAmbisonic()) {
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,8 @@ public slots:
|
||||||
void setInputVolume(float volume, bool emitSignal = true);
|
void setInputVolume(float volume, bool emitSignal = true);
|
||||||
void setReverb(bool reverb);
|
void setReverb(bool reverb);
|
||||||
void setReverbOptions(const AudioEffectOptions* options);
|
void setReverbOptions(const AudioEffectOptions* options);
|
||||||
|
void setLocalInjectorGain(float gain) { _localInjectorGain = gain; };
|
||||||
|
void setSystemInjectorGain(float gain) { _systemInjectorGain = gain; };
|
||||||
|
|
||||||
void outputNotify();
|
void outputNotify();
|
||||||
|
|
||||||
|
@ -393,6 +395,8 @@ private:
|
||||||
int16_t* _outputScratchBuffer { NULL };
|
int16_t* _outputScratchBuffer { NULL };
|
||||||
|
|
||||||
// for local audio (used by audio injectors thread)
|
// for local audio (used by audio injectors thread)
|
||||||
|
std::atomic<float> _localInjectorGain { 1.0f };
|
||||||
|
std::atomic<float> _systemInjectorGain { 1.0f };
|
||||||
float _localMixBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_STEREO];
|
float _localMixBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_STEREO];
|
||||||
int16_t _localScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];
|
int16_t _localScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];
|
||||||
float* _localOutputMixBuffer { NULL };
|
float* _localOutputMixBuffer { NULL };
|
||||||
|
|
Loading…
Reference in a new issue