mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 07:58:05 +02:00
Send InjectorGainSet packet to the audio-mixer
This commit is contained in:
parent
b15651f1eb
commit
755762e8ec
2 changed files with 29 additions and 0 deletions
|
@ -265,6 +265,8 @@ void NodeList::reset(bool skipDomainHandlerReset) {
|
|||
_avatarGainMap.clear();
|
||||
_avatarGainMapLock.unlock();
|
||||
|
||||
_injectorGain = 0.0f;
|
||||
|
||||
if (!skipDomainHandlerReset) {
|
||||
// clear the domain connection information, unless they're the ones that asked us to reset
|
||||
_domainHandler.softReset();
|
||||
|
@ -1087,6 +1089,29 @@ float NodeList::getAvatarGain(const QUuid& nodeID) {
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
void NodeList::setInjectorGain(float gain) {
|
||||
auto audioMixer = soloNodeOfType(NodeType::AudioMixer);
|
||||
if (audioMixer) {
|
||||
// setup the packet
|
||||
auto setInjectorGainPacket = NLPacket::create(PacketType::InjectorGainSet, sizeof(float), true);
|
||||
|
||||
// We need to convert the gain in dB (from the script) to an amplitude before packing it.
|
||||
setInjectorGainPacket->writePrimitive(packFloatGainToByte(fastExp2f(gain / 6.02059991f)));
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
float NodeList::getInjectorGain() {
|
||||
return _injectorGain;
|
||||
}
|
||||
|
||||
void NodeList::kickNodeBySessionID(const QUuid& nodeID) {
|
||||
// send a request to domain-server to kick the node with the given session ID
|
||||
// the domain-server will handle the persistence of the kick (via username or IP)
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
bool isPersonalMutingNode(const QUuid& nodeID) const;
|
||||
void setAvatarGain(const QUuid& nodeID, float gain);
|
||||
float getAvatarGain(const QUuid& nodeID);
|
||||
void setInjectorGain(float gain);
|
||||
float getInjectorGain();
|
||||
|
||||
void kickNodeBySessionID(const QUuid& nodeID);
|
||||
void muteNodeBySessionID(const QUuid& nodeID);
|
||||
|
@ -181,6 +183,8 @@ private:
|
|||
mutable QReadWriteLock _avatarGainMapLock;
|
||||
tbb::concurrent_unordered_map<QUuid, float, UUIDHasher> _avatarGainMap;
|
||||
|
||||
std::atomic<float> _injectorGain { 0.0f };
|
||||
|
||||
void sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationNode);
|
||||
#if defined(Q_OS_ANDROID)
|
||||
Setting::Handle<bool> _ignoreRadiusEnabled { "IgnoreRadiusEnabled", false };
|
||||
|
|
Loading…
Reference in a new issue