Skip to content

Commit

Permalink
Suppress no-op audio volume changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Sep 15, 2023
1 parent 2c1c84d commit af34bb6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ void AudioSession::set_audio_output(AudioDeviceInfo info){
}
void AudioSession::set_volume(double volume){
std::lock_guard<std::mutex> lg(m_lock);
if (m_option.m_volume == volume){
return;
}
m_devices->set_sink_volume(volume);
m_option.m_volume = volume;
for (Listener* listener : m_listeners){
Expand All @@ -178,6 +181,9 @@ void AudioSession::set_volume(double volume){
}
void AudioSession::set_display(AudioOption::AudioDisplayType display){
std::lock_guard<std::mutex> lg(m_lock);
if (m_option.m_display_type == display){
return;
}
m_option.m_display_type = display;
for (Listener* listener : m_listeners){
listener->display_changed(m_option.m_display_type);
Expand Down

0 comments on commit af34bb6

Please sign in to comment.