diff --git a/src/Partition.cxx b/src/Partition.cxx index 7134015bc..dbbdf7e66 100644 --- a/src/Partition.cxx +++ b/src/Partition.cxx @@ -194,6 +194,12 @@ Partition::OnPlayerStateChanged() noexcept EmitIdle(IDLE_PLAYER); } +void +Partition::OnPlayerOptionsChanged() noexcept +{ + EmitIdle(IDLE_OPTIONS); +} + void Partition::OnPlayerSync() noexcept { diff --git a/src/Partition.hxx b/src/Partition.hxx index 6f9de5931..c3680d7b7 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -285,6 +285,7 @@ private: void OnPlayerSync() noexcept override; void OnPlayerTagModified() noexcept override; void OnBorderPause() noexcept override; + void OnPlayerOptionsChanged() noexcept override; /* virtual methods from class MixerListener */ void OnMixerVolumeChanged(Mixer &mixer, int volume) noexcept override; diff --git a/src/player/Control.cxx b/src/player/Control.cxx index c61263b9e..a0f272f9a 100644 --- a/src/player/Control.cxx +++ b/src/player/Control.cxx @@ -20,7 +20,6 @@ #include "Control.hxx" #include "Outputs.hxx" #include "Listener.hxx" -#include "Idle.hxx" #include "song/DetachedSong.hxx" #include @@ -91,7 +90,7 @@ PlayerControl::LockStop() noexcept LockSynchronousCommand(PlayerCommand::CLOSE_AUDIO); assert(next_song == nullptr); - idle_add(IDLE_PLAYER); + listener.OnPlayerStateChanged(); } void @@ -112,7 +111,7 @@ PlayerControl::Kill() noexcept LockSynchronousCommand(PlayerCommand::EXIT); thread.Join(); - idle_add(IDLE_PLAYER); + listener.OnPlayerStateChanged(); } void @@ -120,7 +119,7 @@ PlayerControl::PauseLocked(std::unique_lock &lock) noexcept { if (state != PlayerState::STOP) { SynchronousCommand(lock, PlayerCommand::PAUSE); - idle_add(IDLE_PLAYER); + listener.OnPlayerStateChanged(); } } @@ -304,7 +303,7 @@ PlayerControl::SetCrossFade(FloatDuration duration) noexcept { cross_fade.duration = std::max(duration, FloatDuration::zero()); - idle_add(IDLE_OPTIONS); + listener.OnPlayerOptionsChanged(); } void @@ -312,7 +311,7 @@ PlayerControl::SetMixRampDb(float _mixramp_db) noexcept { cross_fade.mixramp_db = _mixramp_db; - idle_add(IDLE_OPTIONS); + listener.OnPlayerOptionsChanged(); } void @@ -320,5 +319,5 @@ PlayerControl::SetMixRampDelay(FloatDuration _mixramp_delay) noexcept { cross_fade.mixramp_delay = _mixramp_delay; - idle_add(IDLE_OPTIONS); + listener.OnPlayerOptionsChanged(); } diff --git a/src/player/Listener.hxx b/src/player/Listener.hxx index d7a05c44d..8cd3e7ee8 100644 --- a/src/player/Listener.hxx +++ b/src/player/Listener.hxx @@ -34,6 +34,12 @@ public: */ virtual void OnPlayerStateChanged() noexcept = 0; + /** + * Some options of the player has changed. This maps to + * #IDLE_OPTIONS. + */ + virtual void OnPlayerOptionsChanged() noexcept = 0; + /** * Must call playlist_sync(). */