From fb707fe1f11c2d70224ca910a385b9168eb2ad9b Mon Sep 17 00:00:00 2001 From: Daniel Hrabovcak Date: Mon, 25 May 2015 11:58:54 -0400 Subject: [PATCH 1/4] Group audio not being reset --- src/core/core.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index ef2cf86db..3cef6a2af 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -759,7 +759,7 @@ void Core::setAvatar(const QByteArray& data) pic.loadFromData(data); Settings::getInstance().saveAvatar(pic, getSelfId().toString()); emit selfAvatarChanged(pic); - + AvatarBroadcaster::setAvatar(data); AvatarBroadcaster::enableAutoBroadcast(); } @@ -1325,7 +1325,13 @@ void Core::setNospam(uint32_t nospam) void Core::resetCallSources() { for (ToxGroupCall& call : groupCalls) + { + for (QPair alSources : alSources) + { + alDeleteSources(1, alSources.second); + } call.alSources.clear(); + } for (ToxCall& call : calls) { From bd2f8b5db5d488355d90c62ec2fb7cd64b5c930c Mon Sep 17 00:00:00 2001 From: Daniel Hrabovcak Date: Mon, 25 May 2015 12:19:56 -0400 Subject: [PATCH 2/4] Add al delete to group leave --- src/core/core.cpp | 4 +--- src/core/coreav.cpp | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 3cef6a2af..b9e7a7905 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1326,10 +1326,8 @@ void Core::resetCallSources() { for (ToxGroupCall& call : groupCalls) { - for (QPair alSources : alSources) - { + for (QPair alSources : call) alDeleteSources(1, alSources.second); - } call.alSources.clear(); } diff --git a/src/core/coreav.cpp b/src/core/coreav.cpp index 1715edfde..3c12c08c3 100644 --- a/src/core/coreav.cpp +++ b/src/core/coreav.cpp @@ -629,6 +629,8 @@ void Core::leaveGroupCall(int groupId) groupCalls[groupId].active = false; disconnect(groupCalls[groupId].sendAudioTimer,0,0,0); groupCalls[groupId].sendAudioTimer->stop(); + for (QPair alSources : groupCalls[groupId]) + alDeleteSources(1, alSources.second); groupCalls[groupId].alSources.clear(); Audio::unsuscribeInput(); delete groupCalls[groupId].sendAudioTimer; From 992e648f64509723d5850cf0916aa632d4fd2a20 Mon Sep 17 00:00:00 2001 From: Daniel Hrabovcak Date: Mon, 25 May 2015 12:32:34 -0400 Subject: [PATCH 3/4] Fix compile issues --- src/core/core.cpp | 4 ++-- src/core/coreav.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 60655f497..d801d4638 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1330,8 +1330,8 @@ void Core::resetCallSources() { for (ToxGroupCall& call : groupCalls) { - for (QPair alSources : call) - alDeleteSources(1, alSources.second); + for (QHash::iterator i = call.alSources.begin(); i != call.alSources.end(); ++i) + alDeleteSources(1, &i.value()); call.alSources.clear(); } diff --git a/src/core/coreav.cpp b/src/core/coreav.cpp index 3c12c08c3..3642b1907 100644 --- a/src/core/coreav.cpp +++ b/src/core/coreav.cpp @@ -629,8 +629,8 @@ void Core::leaveGroupCall(int groupId) groupCalls[groupId].active = false; disconnect(groupCalls[groupId].sendAudioTimer,0,0,0); groupCalls[groupId].sendAudioTimer->stop(); - for (QPair alSources : groupCalls[groupId]) - alDeleteSources(1, alSources.second); + for (QHash::iterator i = groupCalls[groupId].alSources.begin(); i != groupCalls[groupId].alSources.end(); ++i) + alDeleteSources(1, &i.value()); groupCalls[groupId].alSources.clear(); Audio::unsuscribeInput(); delete groupCalls[groupId].sendAudioTimer; From 051a88a7e8ef89c205feb387ef93f78c0746b1aa Mon Sep 17 00:00:00 2001 From: Daniel Hrabovcak Date: Mon, 25 May 2015 12:38:52 -0400 Subject: [PATCH 4/4] For range loops --- src/core/core.cpp | 4 ++-- src/core/coreav.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index d801d4638..20e59b7ce 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1330,8 +1330,8 @@ void Core::resetCallSources() { for (ToxGroupCall& call : groupCalls) { - for (QHash::iterator i = call.alSources.begin(); i != call.alSources.end(); ++i) - alDeleteSources(1, &i.value()); + for (ALuint source : call.alSources) + alDeleteSources(1, &source); call.alSources.clear(); } diff --git a/src/core/coreav.cpp b/src/core/coreav.cpp index 3642b1907..e0b6fb2de 100644 --- a/src/core/coreav.cpp +++ b/src/core/coreav.cpp @@ -629,8 +629,8 @@ void Core::leaveGroupCall(int groupId) groupCalls[groupId].active = false; disconnect(groupCalls[groupId].sendAudioTimer,0,0,0); groupCalls[groupId].sendAudioTimer->stop(); - for (QHash::iterator i = groupCalls[groupId].alSources.begin(); i != groupCalls[groupId].alSources.end(); ++i) - alDeleteSources(1, &i.value()); + for (ALuint source : groupCalls[groupId].alSources) + alDeleteSources(1, &source); groupCalls[groupId].alSources.clear(); Audio::unsuscribeInput(); delete groupCalls[groupId].sendAudioTimer;