mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +02:00
Merge pull request #841 from overte-org/fix/avatar_volume_adjustment
Fixed avatar volume adjustment
This commit is contained in:
commit
d58940369c
1 changed files with 14 additions and 4 deletions
|
@ -222,13 +222,23 @@ void AudioMixerClientData::parseInjectorGainSet(ReceivedMessage& message, const
|
||||||
qCDebug(audio) << "Setting MASTER injector gain for" << uuid << "to" << gain;
|
qCDebug(audio) << "Setting MASTER injector gain for" << uuid << "to" << gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMixerClientData::setGainForAvatar(QUuid nodeID, float gain) {
|
bool setGainInStreams(const QUuid &nodeID, float gain, std::vector<AudioMixerClientData::MixableStream> &streamVector) {
|
||||||
auto it = std::find_if(_streams.active.cbegin(), _streams.active.cend(), [nodeID](const MixableStream& mixableStream){
|
auto itActive = std::find_if(streamVector.cbegin(), streamVector.cend(),
|
||||||
|
[nodeID](const AudioMixerClientData::MixableStream& mixableStream){
|
||||||
return mixableStream.nodeStreamID.nodeID == nodeID && mixableStream.nodeStreamID.streamID.isNull();
|
return mixableStream.nodeStreamID.nodeID == nodeID && mixableStream.nodeStreamID.streamID.isNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it != _streams.active.cend()) {
|
if (itActive != streamVector.cend()) {
|
||||||
it->hrtf->setGainAdjustment(gain);
|
itActive->hrtf->setGainAdjustment(gain);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioMixerClientData::setGainForAvatar(QUuid nodeID, float gain) {
|
||||||
|
if (!setGainInStreams(nodeID, gain, _streams.active)) {
|
||||||
|
setGainInStreams(nodeID, gain, _streams.inactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue