audio: make system own master gain semantics

This commit is contained in:
2026-04-14 16:39:29 +08:00
parent a91df8b4cd
commit 3e56757910
6 changed files with 511 additions and 59 deletions

View File

@@ -141,22 +141,6 @@ bool WaveOutBackend::SetDevice(const std::string& deviceName) {
return false;
}
float WaveOutBackend::GetMasterVolume() const {
return m_masterVolume.load();
}
void WaveOutBackend::SetMasterVolume(float volume) {
m_masterVolume.store(std::max(0.0f, std::min(1.0f, volume)));
}
bool WaveOutBackend::IsMuted() const {
return m_muted.load();
}
void WaveOutBackend::SetMuted(bool muted) {
m_muted.store(muted);
}
void WaveOutBackend::Start() {
if (m_isRunning.load()) {
return;
@@ -309,7 +293,7 @@ void WaveOutBackend::AudioThread() {
continue;
}
FillPcm16Buffer(*targetBuffer, m_pendingMixBuffer, m_masterVolume.load(), m_muted.load());
FillPcm16Buffer(*targetBuffer, m_pendingMixBuffer);
m_hasPendingMix = false;
lock.unlock();