[speaker_source] Don't remap a requested volume of zero (#19063)

Co-authored-by: rexmoriarty <181678468+rexmoriarty@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Kevin Ahrendt <kevin.ahrendt@openhomefoundation.org>
This commit is contained in:
rexmoriarty
2026-09-14 18:11:25 -04:00
committed by GitHub
co-authored by rexmoriarty Claude Opus 5 Kevin Ahrendt
parent 2472838e13
commit 7a25ca0741
@@ -809,8 +809,11 @@ void SpeakerSourceMediaPlayer::set_mute_state_(bool mute_state, bool publish) {
}
void SpeakerSourceMediaPlayer::set_volume_(float volume, bool publish) {
// Remap the volume to fit within the configured limits
float bounded_volume = remap<float, float>(volume, 0.0f, 1.0f, this->volume_min_, this->volume_max_);
// Remap the volume to fit within the configured limits. An effectively zero volume is passed through as zero so
// the speaker silences it, otherwise volume_min would make it audible.
float bounded_volume = (volume < speaker::SILENT_VOLUME_THRESHOLD)
? 0.0f
: remap<float, float>(volume, 0.0f, 1.0f, this->volume_min_, this->volume_max_);
for (auto &ps : this->pipelines_) {
if (ps.is_configured()) {