Voice: Minor options menu fixes, fix decibel level freezing on muted speakers

This commit is contained in:
Kae 2023-07-20 14:55:38 +10:00
parent 3aa45ab799
commit 043db1841e
6 changed files with 9 additions and 10 deletions

View File

@ -223,5 +223,6 @@ end
function voiceToggle()
set("enabled", not settings.enabled)
widget.playSound(fmt("/sfx/interface/voice_%s.ogg", settings.enabled and "on" or "off"), 0)
updateVoiceButton()
end

View File

@ -42,6 +42,7 @@
"base" : "/interface/optionsmenu/tricontrolsbutton.png",
"hover" : "/interface/optionsmenu/tricontrolsbuttonhover.png"
},
"sfxValueLabel" : { "position" : [192, 142] } // this is 2px too low in vanilla lol
"sfxValueLabel" : { "position" : [192, 142] }, // this is 2px too low in vanilla lol
"musicSlider" : { "position" : [62, 126] }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Binary file not shown.

View File

@ -362,13 +362,14 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
VoiceAudioStream* audio = speaker->audioStream.get();
MutexLocker audioLock(audio->mutex);
if (speaker->playing && !audio->samples.empty()) {
for (size_t i = 0; i != samples; ++i)
speakerBuffer[i] = audio->take();
if (speaker != m_clientSpeaker)
speaker->decibelLevel = getAudioLoudness(speakerBuffer.data(), samples);
if (!speaker->muted) {
mix = true;
for (size_t i = 0; i != samples; ++i)
speakerBuffer[i] = audio->take();
if (speaker != m_clientSpeaker)
speaker->decibelLevel = getAudioLoudness(speakerBuffer.data(), samples);
float volume = speaker->volume;
Array2F levels = speaker->channelVolumes;
@ -396,10 +397,6 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
}
//*/
}
else {
for (size_t i = 0; i != samples; ++i)
audio->take();
}
++it;
}
else {