Skip to content

Commit e24cf9e

Browse files
committed
device: move event handler and statemachine to separate class/file
1 parent 9fbd51e commit e24cf9e

10 files changed

Lines changed: 715 additions & 506 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ OBJS = $(PLUGIN).o \
150150
softhdsetupmenu.o \
151151
softhdosd.o \
152152
softhdosdprovider.o \
153+
statemachine.o \
153154
videofilter.o \
154155
videorender.o \
155156
videostream.o

audio.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ extern "C" {
3838
#include "audioprocessor.h"
3939
#include "codec_audio.h"
4040
#include "config.h"
41-
#include "event.h"
4241
#include "filllevel.h"
4342
#include "logger.h"
4443
#include "misc.h"
4544
#include "pidcontroller.h"
4645
#include "ringbuffer.h"
4746
#include "softhddevice.h"
47+
#include "statemachine.h"
4848

4949
/**
5050
* Create a new audio context
@@ -54,7 +54,6 @@ cSoftHdAudio::cSoftHdAudio(cSoftHdDevice *device)
5454
m_pDevice(device),
5555
m_pConfig(m_pDevice->Config()),
5656
m_alsa(m_pConfig),
57-
m_pEventReceiver(device),
5857
m_softVolume(m_pConfig->ConfigAudioSoftvol),
5958
m_audioProcessor(BYTES_PER_SAMPLE),
6059
m_pMixerChannel(m_pConfig->ConfigAudioMixerChannel)
@@ -1180,7 +1179,7 @@ void cSoftHdAudio::ProcessEvents(void)
11801179
{
11811180
std::lock_guard<std::mutex> lock(m_queueMutex);
11821181
for (Event event : m_eventQueue)
1183-
m_pEventReceiver->OnEventReceived(event);
1182+
m_pDevice->TriggerEvent(event);
11841183

11851184
m_eventQueue.clear();
11861185
}

audio.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ extern "C" {
3535

3636
#include "alsadevice.h"
3737
#include "audioprocessor.h"
38-
#include "event.h"
3938
#include "filllevel.h"
4039
#include "pidcontroller.h"
4140
#include "ringbuffer.h"
41+
#include "statemachine.h"
4242

4343
class cSoftHdConfig;
4444
class cSoftHdDevice;
@@ -104,7 +104,6 @@ class cSoftHdAudio : public cThread {
104104
cSoftHdDevice *m_pDevice; ///< pointer to device
105105
cSoftHdConfig *m_pConfig; ///< pointer to config
106106
cAlsaDevice m_alsa; ///< alsa device
107-
IEventReceiver *m_pEventReceiver; ///< pointer to event receiver
108107
cBufferFillLevelLowPassFilter m_fillLevel; ///< low pass filter for the buffer fill level
109108
cPidController m_pidController{3, 0.005, 0, 1000}; ///< PID controller for clock drift compensation with tuning values coming from educated guesses
110109
std::chrono::steady_clock::time_point m_lastPidInvocation; ///< last time the PID controller was invoked

event.h

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)