mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into workload
This commit is contained in:
commit
ff93be80f5
1 changed files with 17 additions and 6 deletions
|
@ -322,8 +322,16 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU
|
||||||
|
|
||||||
// stereo sources are not passed through HRTF
|
// stereo sources are not passed through HRTF
|
||||||
if (streamToAdd.isStereo()) {
|
if (streamToAdd.isStereo()) {
|
||||||
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; ++i) {
|
|
||||||
_mixSamples[i] += float(streamPopOutput[i] * gain / AudioConstants::MAX_SAMPLE_VALUE);
|
// apply the avatar gain adjustment
|
||||||
|
auto& hrtf = listenerNodeData.hrtfForStream(sourceNodeID, streamToAdd.getStreamIdentifier());
|
||||||
|
gain *= hrtf.getGainAdjustment();
|
||||||
|
|
||||||
|
const float scale = 1/32768.0f; // int16_t to float
|
||||||
|
|
||||||
|
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL; i++) {
|
||||||
|
_mixSamples[2*i+0] += (float)streamPopOutput[2*i+0] * gain * scale;
|
||||||
|
_mixSamples[2*i+1] += (float)streamPopOutput[2*i+1] * gain * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
++stats.manualStereoMixes;
|
++stats.manualStereoMixes;
|
||||||
|
@ -332,10 +340,13 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU
|
||||||
|
|
||||||
// echo sources are not passed through HRTF
|
// echo sources are not passed through HRTF
|
||||||
if (isEcho) {
|
if (isEcho) {
|
||||||
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; i += 2) {
|
|
||||||
auto monoSample = float(streamPopOutput[i / 2] * gain / AudioConstants::MAX_SAMPLE_VALUE);
|
const float scale = 1/32768.0f; // int16_t to float
|
||||||
_mixSamples[i] += monoSample;
|
|
||||||
_mixSamples[i + 1] += monoSample;
|
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL; i++) {
|
||||||
|
float sample = (float)streamPopOutput[i] * gain * scale;
|
||||||
|
_mixSamples[2*i+0] += sample;
|
||||||
|
_mixSamples[2*i+1] += sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
++stats.manualEchoMixes;
|
++stats.manualEchoMixes;
|
||||||
|
|
Loading…
Reference in a new issue