parent
530fd15e66
commit
aef2eb7566
@ -1,15 +1,15 @@ |
||||
#pragma once |
||||
|
||||
#include <cstdint> |
||||
#include "audio_common.h" |
||||
#include "audio_element.h" |
||||
#include "audio_output.hpp" |
||||
#include <cstdint> |
||||
|
||||
namespace drivers { |
||||
|
||||
class A2DPAudioOutput : IAudioOutput { |
||||
public: |
||||
virtual auto SetVolume(uint8_t volume) -> void; |
||||
public: |
||||
virtual auto SetVolume(uint8_t volume) -> void; |
||||
}; |
||||
|
||||
} // namespace drivers
|
||||
} // namespace drivers
|
||||
|
@ -1,27 +1,24 @@ |
||||
#pragma once |
||||
|
||||
#include <cstdint> |
||||
#include <memory> |
||||
#include "audio_common.h" |
||||
#include "audio_element.h" |
||||
#include <cstdint> |
||||
|
||||
namespace drivers { |
||||
|
||||
class IAudioOutput { |
||||
public: |
||||
IAudioOutput(audio_element_handle_t element) : element_(element) {} |
||||
virtual ~IAudioOutput() { |
||||
audio_element_deinit(element_); |
||||
} |
||||
public: |
||||
IAudioOutput(audio_element_handle_t element) : element_(element) {} |
||||
virtual ~IAudioOutput() { audio_element_deinit(element_); } |
||||
|
||||
auto GetAudioElement() -> audio_element_handle_t { |
||||
return element_; |
||||
} |
||||
auto GetAudioElement() -> audio_element_handle_t { return element_; } |
||||
|
||||
virtual auto SetVolume(uint8_t volume) -> void = 0; |
||||
virtual auto Configure(audio_element_info_t info) -> void = 0; |
||||
virtual auto SetVolume(uint8_t volume) -> void = 0; |
||||
virtual auto Configure(audio_element_info_t& info) -> void = 0; |
||||
|
||||
protected: |
||||
audio_element_handle_t element_; |
||||
protected: |
||||
audio_element_handle_t element_; |
||||
}; |
||||
|
||||
} // namespace drivers
|
||||
} // namespace drivers
|
||||
|
@ -1,30 +1,32 @@ |
||||
#pragma once |
||||
|
||||
#include "audio_common.h" |
||||
#include "audio_element.h" |
||||
#include "audio_output.hpp" |
||||
#include "dac.hpp" |
||||
#include "gpio-expander.hpp" |
||||
#include "result.hpp" |
||||
|
||||
#include <cstdint> |
||||
#include <memory> |
||||
#include "result.hpp" |
||||
#include "dac.hpp" |
||||
|
||||
#include "audio_element.h" |
||||
|
||||
namespace drivers { |
||||
|
||||
class I2SAudioOutput : public IAudioOutput { |
||||
public: |
||||
public: |
||||
enum Error { DAC_CONFIG, I2S_CONFIG, STREAM_INIT }; |
||||
static auto create(GpioExpander* expander) |
||||
-> cpp::result<std::unique_ptr<I2SAudioOutput>, Error>; |
||||
static auto create(GpioExpander* expander) |
||||
-> cpp::result<std::unique_ptr<I2SAudioOutput>, Error>; |
||||
|
||||
I2SAudioOutput(AudioDac* dac, audio_element_handle_t element); |
||||
I2SAudioOutput(std::unique_ptr<AudioDac>& dac, |
||||
audio_element_handle_t element); |
||||
~I2SAudioOutput(); |
||||
|
||||
virtual auto SetVolume(uint8_t volume) -> void; |
||||
virtual auto Configure(audio_element_info_t info) -> void; |
||||
virtual auto Configure(audio_element_info_t& info) -> void; |
||||
|
||||
private: |
||||
std::unique_ptr<AudioDac> dac_; |
||||
private: |
||||
std::unique_ptr<AudioDac> dac_; |
||||
}; |
||||
|
||||
} // namespace drivers
|
||||
} // namespace drivers
|
||||
|
Loading…
Reference in new issue