29#ifndef ASYNC_AUDIO_STREAM_STATE_DETECTOR_INCLUDED
30#define ASYNC_AUDIO_STREAM_STATE_DETECTOR_INCLUDED
39#include <sigc++/sigc++.h>
247 using StateMap = std::map<State, StateMapValue>;
249 const StateMap STATE_MAP {
256 void setState(
State new_state)
258 if (new_state == m_state)
263 auto& old_mapping = STATE_MAP.at(m_state);
264 auto& new_mapping = STATE_MAP.at(new_state);
267 if (new_mapping.is_active != old_mapping.is_active)
272 if (new_mapping.is_idle != old_mapping.is_idle)
This file contains a class that just pass the audio through.
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
AudioPassthrough(void)
Default constuctor.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
AudioStreamStateDetector(void)
Default constuctor.
sigc::signal< void(bool)> sigStreamIsIdle
A signal that is emitted when stream idle state changes.
sigc::signal< void(bool)> sigStreamIsActive
A signal that is emitted when stream activity state changes.
virtual ~AudioStreamStateDetector(void) override
Destructor.
State state(void) const
Get the stream state.
bool isActive(void) const
Check if the steam is active or not.
virtual void allSamplesFlushed(void) override
The registered sink has flushed all samples.
bool isIdle(void) const
Check if the steam is idle or not.
sigc::signal< void(bool, bool)> sigStreamStateChanged
A signal that is emitted when the stream state changes.
virtual int writeSamples(const float *samples, int count) override
Write samples into this audio sink.
virtual void flushSamples(void) override
Tell the sink to flush the previously written samples.
State
An enum representing the stream state.
@ ACTIVE
Samples have been written to the stream.
@ FLUSHING
The stream source have requested stream flush.
@ IDLE
There are no samples left in the stream.
bool isFlushing(void) const
Check if the steam is flushing or not.
Namespace for the asynchronous programming classes.