Instance: move GlobalEvents::Monitor to Partition
All remaining events are specific to the Partition.
This commit is contained in:
parent
e2bc92d128
commit
483daa5882
@ -23,7 +23,6 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "event/Loop.hxx"
|
#include "event/Loop.hxx"
|
||||||
#include "event/MaskMonitor.hxx"
|
#include "event/MaskMonitor.hxx"
|
||||||
#include "GlobalEvents.hxx"
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||||
@ -66,8 +65,6 @@ struct Instance final
|
|||||||
public NeighborListener
|
public NeighborListener
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
GlobalEvents::Monitor global_events;
|
|
||||||
|
|
||||||
CallbackMaskMonitor<Instance> idle_monitor;
|
CallbackMaskMonitor<Instance> idle_monitor;
|
||||||
|
|
||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||||
@ -93,8 +90,7 @@ struct Instance final
|
|||||||
StateFile *state_file;
|
StateFile *state_file;
|
||||||
|
|
||||||
Instance()
|
Instance()
|
||||||
:global_events(event_loop),
|
:idle_monitor(event_loop, *this, &Instance::OnIdle) {}
|
||||||
idle_monitor(event_loop, *this, &Instance::OnIdle) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiate shutdown. Wrapper for EventLoop::Break().
|
* Initiate shutdown. Wrapper for EventLoop::Break().
|
||||||
|
@ -29,7 +29,9 @@ Partition::Partition(Instance &_instance,
|
|||||||
unsigned max_length,
|
unsigned max_length,
|
||||||
unsigned buffer_chunks,
|
unsigned buffer_chunks,
|
||||||
unsigned buffered_before_play)
|
unsigned buffered_before_play)
|
||||||
:instance(_instance), playlist(max_length, *this),
|
:instance(_instance),
|
||||||
|
global_events(instance.event_loop),
|
||||||
|
playlist(max_length, *this),
|
||||||
outputs(*this),
|
outputs(*this),
|
||||||
pc(*this, outputs, buffer_chunks, buffered_before_play)
|
pc(*this, outputs, buffer_chunks, buffered_before_play)
|
||||||
{
|
{
|
||||||
@ -95,13 +97,13 @@ Partition::OnQueueSongStarted()
|
|||||||
void
|
void
|
||||||
Partition::OnPlayerSync()
|
Partition::OnPlayerSync()
|
||||||
{
|
{
|
||||||
instance.global_events.Emit(GlobalEvents::PLAYLIST);
|
global_events.Emit(GlobalEvents::PLAYLIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Partition::OnPlayerTagModified()
|
Partition::OnPlayerTagModified()
|
||||||
{
|
{
|
||||||
instance.global_events.Emit(GlobalEvents::TAG);
|
global_events.Emit(GlobalEvents::TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#ifndef MPD_PARTITION_HXX
|
#ifndef MPD_PARTITION_HXX
|
||||||
#define MPD_PARTITION_HXX
|
#define MPD_PARTITION_HXX
|
||||||
|
|
||||||
|
#include "GlobalEvents.hxx"
|
||||||
#include "queue/Playlist.hxx"
|
#include "queue/Playlist.hxx"
|
||||||
#include "queue/Listener.hxx"
|
#include "queue/Listener.hxx"
|
||||||
#include "output/MultipleOutputs.hxx"
|
#include "output/MultipleOutputs.hxx"
|
||||||
@ -40,6 +41,8 @@ class SongLoader;
|
|||||||
struct Partition final : QueueListener, PlayerListener, MixerListener {
|
struct Partition final : QueueListener, PlayerListener, MixerListener {
|
||||||
Instance &instance;
|
Instance &instance;
|
||||||
|
|
||||||
|
GlobalEvents::Monitor global_events;
|
||||||
|
|
||||||
struct playlist playlist;
|
struct playlist playlist;
|
||||||
|
|
||||||
MultipleOutputs outputs;
|
MultipleOutputs outputs;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "PlaylistGlobal.hxx"
|
#include "PlaylistGlobal.hxx"
|
||||||
#include "Main.hxx"
|
#include "Main.hxx"
|
||||||
#include "Instance.hxx"
|
#include "Instance.hxx"
|
||||||
|
#include "Partition.hxx"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
playlist_tag_event(void)
|
playlist_tag_event(void)
|
||||||
@ -42,6 +43,6 @@ playlist_event(void)
|
|||||||
void
|
void
|
||||||
playlist_global_init()
|
playlist_global_init()
|
||||||
{
|
{
|
||||||
instance->global_events.Register(GlobalEvents::TAG, playlist_tag_event);
|
instance->partition->global_events.Register(GlobalEvents::TAG, playlist_tag_event);
|
||||||
instance->global_events.Register(GlobalEvents::PLAYLIST, playlist_event);
|
instance->partition->global_events.Register(GlobalEvents::PLAYLIST, playlist_event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user