diff options
-rw-r--r-- | src/Instance.cxx | 5 | ||||
-rw-r--r-- | src/Partition.cxx | 9 | ||||
-rw-r--r-- | src/Partition.hxx | 2 | ||||
-rw-r--r-- | src/ReplayGainConfig.cxx | 3 | ||||
-rw-r--r-- | src/client/ClientSubscribe.cxx | 5 | ||||
-rw-r--r-- | src/command/PlayerCommands.cxx | 2 | ||||
-rw-r--r-- | src/command/StorageCommands.cxx | 8 |
7 files changed, 21 insertions, 13 deletions
diff --git a/src/Instance.cxx b/src/Instance.cxx index f65eca42d..0122a9732 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -77,7 +77,6 @@ Instance::OnDatabaseModified() stats_invalidate(); partition->DatabaseModified(*database); - idle_add(IDLE_DATABASE); } void @@ -102,13 +101,13 @@ Instance::OnDatabaseSongRemoved(const LightSong &song) void Instance::FoundNeighbor(gcc_unused const NeighborInfo &info) { - idle_add(IDLE_NEIGHBOR); + partition->EmitIdle(IDLE_NEIGHBOR); } void Instance::LostNeighbor(gcc_unused const NeighborInfo &info) { - idle_add(IDLE_NEIGHBOR); + partition->EmitIdle(IDLE_NEIGHBOR); } #endif diff --git a/src/Partition.cxx b/src/Partition.cxx index 6217f45d9..f0cfe11cd 100644 --- a/src/Partition.cxx +++ b/src/Partition.cxx @@ -25,6 +25,12 @@ #include "Idle.hxx" #include "GlobalEvents.hxx" +void +Partition::EmitIdle(unsigned mask) +{ + idle_add(mask); +} + #ifdef ENABLE_DATABASE const Database * @@ -37,6 +43,7 @@ void Partition::DatabaseModified(const Database &db) { playlist.DatabaseModified(db); + EmitIdle(IDLE_DATABASE); } #endif @@ -75,5 +82,5 @@ Partition::OnMixerVolumeChanged(gcc_unused Mixer &mixer, gcc_unused int volume) InvalidateHardwareVolume(); /* notify clients */ - idle_add(IDLE_MIXER); + EmitIdle(IDLE_MIXER); } diff --git a/src/Partition.hxx b/src/Partition.hxx index 6e209352e..3894c4084 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -53,6 +53,8 @@ struct Partition final : private PlayerListener, private MixerListener { outputs(*this), pc(*this, outputs, buffer_chunks, buffered_before_play) {} + void EmitIdle(unsigned mask); + void ClearQueue() { playlist.Clear(pc); } diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx index f9bd08042..766ddea3a 100644 --- a/src/ReplayGainConfig.cxx +++ b/src/ReplayGainConfig.cxx @@ -19,7 +19,6 @@ #include "config.h" #include "ReplayGainConfig.hxx" -#include "Idle.hxx" #include "config/Param.hxx" #include "config/ConfigGlobal.hxx" #include "system/FatalError.hxx" @@ -74,8 +73,6 @@ replay_gain_set_mode_string(const char *p) else return false; - idle_add(IDLE_OPTIONS); - return true; } diff --git a/src/client/ClientSubscribe.cxx b/src/client/ClientSubscribe.cxx index 9aac84519..2a8eb57e4 100644 --- a/src/client/ClientSubscribe.cxx +++ b/src/client/ClientSubscribe.cxx @@ -19,6 +19,7 @@ #include "config.h" #include "ClientInternal.hxx" +#include "Partition.hxx" #include "Idle.hxx" #include <assert.h> @@ -40,7 +41,7 @@ Client::Subscribe(const char *channel) ++num_subscriptions; - idle_add(IDLE_SUBSCRIPTION); + partition.EmitIdle(IDLE_SUBSCRIPTION); return Client::SubscribeResult::OK; } @@ -57,7 +58,7 @@ Client::Unsubscribe(const char *channel) subscriptions.erase(i); --num_subscriptions; - idle_add(IDLE_SUBSCRIPTION); + partition.EmitIdle(IDLE_SUBSCRIPTION); assert((num_subscriptions == 0) == subscriptions.empty()); diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx index 1eef18a0f..5f5f1e1e6 100644 --- a/src/command/PlayerCommands.cxx +++ b/src/command/PlayerCommands.cxx @@ -28,6 +28,7 @@ #include "mixer/Volume.hxx" #include "Partition.hxx" #include "Instance.hxx" +#include "Idle.hxx" #include "AudioFormat.hxx" #include "ReplayGainConfig.hxx" @@ -348,6 +349,7 @@ handle_replay_gain_mode(Client &client, Request args, Response &r) } client.partition.outputs.SetReplayGainMode(replay_gain_get_real_mode(client.playlist.queue.random)); + client.partition.EmitIdle(IDLE_OPTIONS); return CommandResult::OK; } diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx index fef454ef8..d935530a4 100644 --- a/src/command/StorageCommands.cxx +++ b/src/command/StorageCommands.cxx @@ -230,7 +230,7 @@ handle_mount(Client &client, Request args, Response &r) } composite.Mount(local_uri, storage); - idle_add(IDLE_MOUNT); + client.partition.EmitIdle(IDLE_MOUNT); #ifdef ENABLE_DATABASE Database *_db = client.partition.instance.database; @@ -249,7 +249,7 @@ handle_mount(Client &client, Request args, Response &r) // TODO: call Instance::OnDatabaseModified()? // TODO: trigger database update? - idle_add(IDLE_DATABASE); + client.partition.EmitIdle(IDLE_DATABASE); } #endif @@ -287,7 +287,7 @@ handle_unmount(Client &client, Request args, Response &r) if (db.Unmount(local_uri)) // TODO: call Instance::OnDatabaseModified()? - idle_add(IDLE_DATABASE); + client.partition.EmitIdle(IDLE_DATABASE); } #endif @@ -296,7 +296,7 @@ handle_unmount(Client &client, Request args, Response &r) return CommandResult::ERROR; } - idle_add(IDLE_MOUNT); + client.partition.EmitIdle(IDLE_MOUNT); return CommandResult::OK; } |