diff --git a/raspi/audio.cpp b/raspi/audio.cpp index ce31c33..a0d45f6 100644 --- a/raspi/audio.cpp +++ b/raspi/audio.cpp @@ -43,23 +43,24 @@ cAudio::~cAudio(void) lt_debug("%s\n", __func__); } -void cAudio::openDevice(void) +int cAudio::mute(void) { - lt_debug("%s\n", __func__); + return SetMute(true); } -void cAudio::closeDevice(void) +int cAudio::unmute(void) { - lt_debug("%s\n", __func__); + return SetMute(false); } -int cAudio::do_mute(bool enable, bool remember) +int cAudio::SetMute(bool enable) { - lt_debug("%s(%d, %d)\n", __func__, enable, remember); + lt_debug("%s(%d)\n", __func__, enable); if (enable) avdec->set_volume(0); else avdec->set_volume(volume); + muted = enable; return 0; } @@ -160,8 +161,3 @@ void cAudio::EnableAnalogOut(bool enable) { lt_debug("%s %d\n", __func__, enable); }; - -void cAudio::setBypassMode(bool disable) -{ - lt_debug("%s %d\n", __func__, disable); -} diff --git a/raspi/audio_lib.h b/raspi/audio_lib.h index 4e26e9d..f474fb6 100644 --- a/raspi/audio_lib.h +++ b/raspi/audio_lib.h @@ -39,43 +39,21 @@ typedef enum class cAudio { - friend class cPlayback; - private: - int fd; - bool Muted; - - int clipfd; /* for pcm playback */ - int mixer_fd; /* if we are using the OSS mixer */ - int mixer_num; /* oss mixer to use, if any */ - - AUDIO_FORMAT StreamType; - AUDIO_SYNC_MODE SyncMode; - bool started; - bool thread_started; - - int volume; - int64_t curr_pts; - - void openDevice(void); - void closeDevice(void); - - int do_mute(bool enable, bool remember); - void setBypassMode(bool disable); public: /* construct & destruct */ cAudio(void *, void *, void *); ~cAudio(void); - int64_t getPts() { return curr_pts; } void *GetHandle() { return NULL; }; /* shut up */ - int mute(bool remember = true) { return do_mute(true, remember); }; - int unmute(bool remember = true) { return do_mute(false, remember); }; + int mute(void); + int unmute(void); + int SetMute(bool enable); /* volume, min = 0, max = 255 */ int setVolume(unsigned int left, unsigned int right); int getVolume(void) { return volume;} - bool getMuteStatus(void) { return Muted; }; + bool getMuteStatus(void) { return muted; }; /* start and stop audio */ int Start(void); @@ -96,7 +74,10 @@ class cAudio void SetSpdifDD(bool enable); void ScheduleMute(bool On); void EnableAnalogOut(bool enable); - int my_read(uint8_t *buf, int buf_size); + private: + bool muted; + int volume; + void *pdata; }; #endif