From 4e44a4ed7566fbbc7248796423b822430205ad98 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 15 Jul 2023 14:01:44 +1000 Subject: Get transmission working --- source/frontend/StarVoice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/frontend/StarVoice.cpp') diff --git a/source/frontend/StarVoice.cpp b/source/frontend/StarVoice.cpp index f2bcbe2..c424d30 100644 --- a/source/frontend/StarVoice.cpp +++ b/source/frontend/StarVoice.cpp @@ -241,6 +241,7 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) { if (!audio->samples.empty()) { std::vector samples = move(audio->samples); audioLock.unlock(); + speaker->decibelLevel = getAudioLoudness(samples.data(), samples.size()); if (!speaker->muted) { mix = true; if (voiceBuffer.size() < samples.size()) @@ -286,8 +287,8 @@ void Voice::update(PositionalAttenuationFunction positionalAttenuationFunction) for (auto& entry : m_speakers) { if (SpeakerPtr& speaker = entry.second) { speaker->channelVolumes = { - positionalAttenuationFunction(0, speaker->position, 1.0f), - positionalAttenuationFunction(1, speaker->position, 1.0f) + 1.0f - positionalAttenuationFunction(0, speaker->position, 1.0f), + 1.0f - positionalAttenuationFunction(1, speaker->position, 1.0f) }; } } @@ -376,7 +377,6 @@ bool Voice::receive(SpeakerPtr speaker, std::string_view view) { decodedSamples *= channels; //Logger::info("Voice: decoded Opus chunk {} bytes -> {} samples", opusLength, decodedSamples); - speaker->decibelLevel = getAudioLoudness(decodeBuffer, decodedSamples); { MutexLocker lock(speaker->audioStream->mutex); auto& samples = speaker->audioStream->samples; -- cgit v1.2.3