Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarVoice.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-19 23:30:04 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-19 23:30:04 +1000
commitdb3d004d3008f10f133c8a1eb8f0200f0b05eea1 (patch)
treef58c757abd3c2e64b6c407cdb51fb405b5d57c4b /source/frontend/StarVoice.cpp
parent7ad1671e0daf1c15d593343e5e2cd03593db744e (diff)
Fix decibel level being 0 when under threshold
Diffstat (limited to 'source/frontend/StarVoice.cpp')
-rw-r--r--source/frontend/StarVoice.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/frontend/StarVoice.cpp b/source/frontend/StarVoice.cpp
index 44e62cb..fdc10ea 100644
--- a/source/frontend/StarVoice.cpp
+++ b/source/frontend/StarVoice.cpp
@@ -321,11 +321,12 @@ void Voice::readAudioData(uint8_t* stream, int len) {
}
}
+ m_clientSpeaker->decibelLevel = getAudioLoudness((int16_t*)stream, sampleCount, m_inputVolume);
+
if (!m_loopback) {
if (active && !m_clientSpeaker->playing)
m_clientSpeaker->lastPlayTime = now;
- m_clientSpeaker->decibelLevel = getAudioLoudness((int16_t*)stream, sampleCount, m_inputVolume);
m_clientSpeaker->playing = active;
}
@@ -366,7 +367,8 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
for (size_t i = 0; i != samples; ++i)
speakerBuffer[i] = audio->take();
- speaker->decibelLevel = getAudioLoudness(speakerBuffer.data(), samples);
+ if (speaker != m_clientSpeaker)
+ speaker->decibelLevel = getAudioLoudness(speakerBuffer.data(), samples);
float volume = speaker->volume;
Array2F levels = speaker->channelVolumes;
@@ -402,7 +404,8 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
}
else {
speaker->playing = false;
- speaker->decibelLevel = -96.0f;
+ if (speaker != m_clientSpeaker)
+ speaker->decibelLevel = -96.0f;
it = m_activeSpeakers.erase(it);
}
}