Track the desired audio-mixer gains when not connected

This commit is contained in:
Ken Cooke 2019-08-02 07:14:43 -07:00
parent 437d0ea928
commit 0b97f2bbc0

View file

@ -1143,6 +1143,10 @@ void NodeList::maybeSendIgnoreSetToNode(SharedNodePointer newNode) {
}
void NodeList::setAvatarGain(const QUuid& nodeID, float gain) {
if (nodeID.isNull()) {
_avatarGain = gain;
}
// cannot set gain of yourself
if (getSessionUUID() != nodeID) {
auto audioMixer = soloNodeOfType(NodeType::AudioMixer);
@ -1160,7 +1164,6 @@ void NodeList::setAvatarGain(const QUuid& nodeID, float gain) {
qCDebug(networking) << "Sending Set MASTER Avatar Gain packet with Gain:" << gain;
sendPacket(std::move(setAvatarGainPacket), *audioMixer);
_avatarGain = gain;
} else {
qCDebug(networking) << "Sending Set Avatar Gain packet with UUID:" << uuidStringWithoutCurlyBraces(nodeID) << "Gain:" << gain;
@ -1192,6 +1195,8 @@ float NodeList::getAvatarGain(const QUuid& nodeID) {
}
void NodeList::setInjectorGain(float gain) {
_injectorGain = gain;
auto audioMixer = soloNodeOfType(NodeType::AudioMixer);
if (audioMixer) {
// setup the packet
@ -1203,7 +1208,6 @@ void NodeList::setInjectorGain(float gain) {
qCDebug(networking) << "Sending Set Injector Gain packet with Gain:" << gain;
sendPacket(std::move(setInjectorGainPacket), *audioMixer);
_injectorGain = gain;
} else {
qWarning() << "Couldn't find audio mixer to send set gain request";