OutputCommands get ride of global mixer idle events
This commit is contained in:
parent
b2fb920d28
commit
310a146a55
@ -225,6 +225,13 @@ Partition::OnMixerVolumeChanged(Mixer &, int) noexcept
|
||||
EmitIdle(IDLE_MIXER);
|
||||
}
|
||||
|
||||
void
|
||||
Partition::OnMixerChanged() noexcept
|
||||
{
|
||||
/* notify clients */
|
||||
EmitIdle(IDLE_MIXER);
|
||||
}
|
||||
|
||||
void
|
||||
Partition::OnIdleMonitor(unsigned mask) noexcept
|
||||
{
|
||||
|
@ -288,6 +288,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;
|
||||
|
@ -30,6 +30,7 @@ class MixerListener {
|
||||
public:
|
||||
virtual void OnMixerVolumeChanged(Mixer &mixer,
|
||||
int volume) noexcept = 0;
|
||||
virtual void OnMixerChanged() noexcept = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
class NullMixerListener : public MixerListener {
|
||||
public:
|
||||
void OnMixerVolumeChanged(Mixer &, int) noexcept override {}
|
||||
virtual void OnMixerChanged() noexcept override {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user