Add AudioClient mixing gains for local injectors and system sounds

This commit is contained in:
Ken Cooke 2019-03-22 10:12:31 -07:00 committed by Wayne Chen
parent a2d261d20c
commit 95b4f954a6
2 changed files with 7 additions and 1 deletions
libraries/audio-client/src

View file

@ -1368,7 +1368,9 @@ bool AudioClient::mixLocalAudioInjectors(float* mixBuffer) {
memset(_localScratchBuffer, 0, bytesToRead);
if (0 < injectorBuffer->readData((char*)_localScratchBuffer, bytesToRead)) {
float gain = options.volume;
bool isSystemSound = !injector->isPositionSet() && !injector->isAmbisonic();
float gain = injector->getVolume() * (isSystemSound ? _systemInjectorGain : _localInjectorGain);
if (options.ambisonic) {

View file

@ -241,6 +241,8 @@ public slots:
void setInputVolume(float volume, bool emitSignal = true);
void setReverb(bool reverb);
void setReverbOptions(const AudioEffectOptions* options);
void setLocalInjectorGain(float gain) { _localInjectorGain = gain; };
void setSystemInjectorGain(float gain) { _systemInjectorGain = gain; };
void outputNotify();
@ -395,6 +397,8 @@ private:
int16_t* _outputScratchBuffer { NULL };
// 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];
int16_t _localScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];
float* _localOutputMixBuffer { NULL };