Mute and unmute audio

This commit is contained in:
eried 2020-06-08 01:22:58 +02:00
parent 2d765f8120
commit 3c304b9fe3
3 changed files with 29 additions and 0 deletions

View File

@ -26,6 +26,7 @@
using portapack::clock_manager;
#include "portapack_hal.hpp"
#include "portapack_persistent_memory.hpp"
#include "i2s.hpp"
using namespace lpc43xx;
@ -153,6 +154,16 @@ void unmute() {
audio_codec->headphone_enable();
}
void speaker_mute() {
i2s::i2s0::tx_mute();
audio_codec->speaker_disable();
}
void speaker_unmute() {
i2s::i2s0::tx_unmute();
audio_codec->speaker_enable();
}
} /* namespace output */
namespace input {

View File

@ -41,6 +41,9 @@ public:
virtual bool reset() = 0;
virtual void init() = 0;
virtual void speaker_enable() = 0;
virtual void speaker_disable() = 0;
virtual void headphone_enable() = 0;
virtual void headphone_disable() = 0;
virtual volume_range_t headphone_gain_range() const = 0;
@ -62,6 +65,9 @@ void stop();
void mute();
void unmute();
void speaker_mute();
void speaker_unmute();
} /* namespace output */
namespace input {
@ -79,6 +85,14 @@ void set_volume(const volume_t volume);
} /* namespace headphone */
namespace speaker {
volume_range_t volume_range();
void set_volume(const volume_t volume);
} /* namespace speaker */
namespace debug {
size_t reg_count();

View File

@ -341,6 +341,10 @@ public:
headphone_mute();
}
void speaker_enable() {};
void speaker_disable() {};
void microphone_enable() override {
// TODO: Implement
}