mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Needed to properly remove hrtfs for avatar audio
This commit is contained in:
parent
404c08b0c7
commit
0b80610e65
3 changed files with 19 additions and 7 deletions
|
@ -602,10 +602,16 @@ void AudioMixer::handleNodeKilled(SharedNodePointer killedNode) {
|
|||
void AudioMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||
auto clientData = dynamic_cast<AudioMixerClientData*>(sendingNode->getLinkedData());
|
||||
if (clientData) {
|
||||
clientData->removeAgentAvatarAudioStream();
|
||||
// when you don't specify a stream, this removes just the QUuid()
|
||||
// stream (which is the avatar's mic stream)
|
||||
clientData->removeHRTFForStream(sendingNode->getUUID());
|
||||
QUuid streamID = clientData->removeAgentAvatarAudioStream();
|
||||
if (streamID != QUuid()) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->eachNode([sendingNode, &streamID](const SharedNodePointer& node){
|
||||
auto listenerClientData = dynamic_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
if (listenerClientData) {
|
||||
listenerClientData->removeHRTFForStream(sendingNode->getUUID(), streamID);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,20 +73,26 @@ void AudioMixerClientData::removeHRTFForStream(const QUuid& nodeID, const QUuid&
|
|||
}
|
||||
}
|
||||
|
||||
void AudioMixerClientData::removeAgentAvatarAudioStream() {
|
||||
QUuid AudioMixerClientData::removeAgentAvatarAudioStream() {
|
||||
QWriteLocker writeLocker { &_streamsLock };
|
||||
QUuid streamId;
|
||||
auto it = _audioStreams.find(QUuid());
|
||||
if (it != _audioStreams.end()) {
|
||||
AvatarAudioStream* stream = dynamic_cast<AvatarAudioStream*>(it->second.get());
|
||||
if (stream) {
|
||||
streamId = stream->getStreamIdentifier();
|
||||
}
|
||||
_audioStreams.erase(it);
|
||||
}
|
||||
writeLocker.unlock();
|
||||
|
||||
return streamId;
|
||||
}
|
||||
|
||||
int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||
PacketType packetType = message.getType();
|
||||
|
||||
if (packetType == PacketType::AudioStreamStats) {
|
||||
|
||||
// skip over header, appendFlag, and num stats packed
|
||||
message.seek(sizeof(quint8) + sizeof(quint16));
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
// removes an AudioHRTF object for a given stream
|
||||
void removeHRTFForStream(const QUuid& nodeID, const QUuid& streamID = QUuid());
|
||||
|
||||
void removeAgentAvatarAudioStream();
|
||||
QUuid removeAgentAvatarAudioStream();
|
||||
|
||||
int parseData(ReceivedMessage& message) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue