Partition: add a local idle_monitor
Make idle events per-partition, but leave Instance::EmitIdle() and its underlying idle_monitor which broadcasts idle events to all partitions.
This commit is contained in:
@@ -40,6 +40,7 @@ Partition::Partition(Instance &_instance,
|
||||
:instance(_instance),
|
||||
name(_name),
|
||||
listener(new ClientListener(instance.event_loop, *this)),
|
||||
idle_monitor(instance.event_loop, BIND_THIS_METHOD(OnIdleMonitor)),
|
||||
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
|
||||
playlist(max_length, *this),
|
||||
outputs(*this),
|
||||
@@ -60,12 +61,6 @@ Partition::BeginShutdown() noexcept
|
||||
listener.reset();
|
||||
}
|
||||
|
||||
void
|
||||
Partition::EmitIdle(unsigned mask) noexcept
|
||||
{
|
||||
instance.EmitIdle(mask);
|
||||
}
|
||||
|
||||
static void
|
||||
PrefetchSong(InputCacheManager &cache, const char *uri) noexcept
|
||||
{
|
||||
@@ -215,6 +210,18 @@ Partition::OnMixerVolumeChanged(Mixer &, int) noexcept
|
||||
EmitIdle(IDLE_MIXER);
|
||||
}
|
||||
|
||||
void
|
||||
Partition::OnIdleMonitor(unsigned mask) noexcept
|
||||
{
|
||||
/* send "idle" notifications to all subscribed
|
||||
clients */
|
||||
for (auto &client : clients)
|
||||
client.IdleAdd(mask);
|
||||
|
||||
if (mask & (IDLE_PLAYLIST|IDLE_PLAYER|IDLE_MIXER|IDLE_OUTPUT))
|
||||
instance.OnStateModified();
|
||||
}
|
||||
|
||||
void
|
||||
Partition::OnGlobalEvent(unsigned mask) noexcept
|
||||
{
|
||||
|
Reference in New Issue
Block a user