Merge remote-tracking branch 'jcorporation/idle'

This commit is contained in:
Max Kellermann 2022-09-20 15:11:41 +02:00
commit 5a7d2be77d
5 changed files with 16 additions and 4 deletions

View File

@ -231,6 +231,13 @@ Partition::OnMixerVolumeChanged(Mixer &, int) noexcept
EmitIdle(IDLE_MIXER);
}
void
Partition::OnMixerChanged() noexcept
{
/* notify clients */
EmitIdle(IDLE_MIXER);
}
void
Partition::OnIdleMonitor(unsigned mask) noexcept
{

View File

@ -289,6 +289,7 @@ private:
/* virtual methods from class MixerListener */
void OnMixerVolumeChanged(Mixer &mixer, int volume) noexcept override;
void OnMixerChanged() noexcept override;
/* callback for #idle_monitor */
void OnIdleMonitor(unsigned mask) noexcept;

View File

@ -30,6 +30,7 @@ class MixerListener {
public:
virtual void OnMixerVolumeChanged(Mixer &mixer,
int volume) noexcept = 0;
virtual void OnMixerChanged() noexcept = 0;
};
#endif

View File

@ -29,6 +29,7 @@
#include "Client.hxx"
#include "mixer/Mixer.hxx"
#include "mixer/Memento.hxx"
#include "mixer/Listener.hxx"
#include "Idle.hxx"
extern unsigned audio_output_state_version;
@ -47,9 +48,10 @@ audio_output_enable_index(MultipleOutputs &outputs,
idle_add(IDLE_OUTPUT);
if (ao.GetMixer() != nullptr) {
auto *mixer = ao.GetMixer();
if (mixer != nullptr) {
mixer_memento.InvalidateHardwareVolume();
idle_add(IDLE_MIXER);
mixer->listener.OnMixerChanged();
}
ao.GetClient().ApplyEnabled();
@ -77,7 +79,7 @@ audio_output_disable_index(MultipleOutputs &outputs,
if (mixer != nullptr) {
mixer->LockClose();
mixer_memento.InvalidateHardwareVolume();
idle_add(IDLE_MIXER);
mixer->listener.OnMixerChanged();
}
ao.GetClient().ApplyEnabled();
@ -104,7 +106,7 @@ audio_output_toggle_index(MultipleOutputs &outputs,
if (mixer != nullptr) {
mixer->LockClose();
mixer_memento.InvalidateHardwareVolume();
idle_add(IDLE_MIXER);
mixer->listener.OnMixerChanged();
}
}

View File

@ -25,6 +25,7 @@
class NullMixerListener : public MixerListener {
public:
void OnMixerVolumeChanged(Mixer &, int) noexcept override {}
virtual void OnMixerChanged() noexcept override {}
};
#endif