class CAudioIO : public IPulseStreamListener {
public:
struct SStreamCallback {
- void* mUserData;
- void (*onStream)(size_t nbytes, void* user_data);
-
- SStreamCallback() : mUserData(nullptr), onStream(nullptr) {
- /* Empty Body */
- }
+ void* mUserData {};
+ void (*onStream)(size_t nbytes, void* user_data) {};
void set(void (*callback)(size_t, void*), void* userdata) {
onStream = callback;
};
struct SStateChangedCallback {
- void* mUserData;
- void (*onStateChanged)(CAudioInfo::EAudioIOState state, CAudioInfo::EAudioIOState statePrev, bool byPolicy, void* user_data);
-
- SStateChangedCallback() : mUserData(nullptr), onStateChanged(nullptr) {
- /* Empty Body */
- }
+ void* mUserData {};
+ void (*onStateChanged)(CAudioInfo::EAudioIOState state, CAudioInfo::EAudioIOState statePrev, bool byPolicy, void* user_data) {};
void set(void (*callback)(CAudioInfo::EAudioIOState, CAudioInfo::EAudioIOState, bool, void*), void* userdata) {
onStateChanged = callback;
};
/* Constructor & Destructor */
- CAudioIO();
explicit CAudioIO(CAudioInfo& audioInfo);
virtual ~CAudioIO() = default;
virtual void onStream(CPulseAudioClient* pClient, size_t length);
virtual void onStateChanged(CAudioInfo::EAudioIOState state, bool byPolicy);
virtual void onStateChanged(CAudioInfo::EAudioIOState state);
+ virtual void onCorked(CPulseAudioClient* pClient, bool corked);
/* Methods */
virtual void initialize();
virtual bool isInit();
virtual bool IsReady();
- CPulseAudioClient* mpPulseAudioClient;
+ CPulseAudioClient* mpPulseAudioClient {};
CAudioInfo mAudioInfo;
SStreamCallback mStreamCallback;
SStateChangedCallback mStateChangedCallback;
- CAudioInfo::EAudioDirection mDirection;
- CAudioInfo::EAudioIOState mState;
- CAudioInfo::EAudioIOState mStatePrev;
- bool mByPolicy;
- std::mutex mMutex;
+ CAudioInfo::EAudioDirection mDirection { CAudioInfo::EAudioDirection::AUDIO_DIRECTION_MAX };
+ CAudioInfo::EAudioIOState mState { CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE };
+ CAudioInfo::EAudioIOState mStatePrev { CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE };
+ bool mByPolicy {};
+ std::timed_mutex mMutex;
std::mutex mCondMutex;
std::condition_variable mCond;
private:
- bool __mIsInit;
+ bool __mIsInit {};
};