Codec Player Interface
Public header: #include "brookesia/hal_interface/interfaces/audio/codec_player.hpp"
Class: AudioCodecPlayerIface
API Reference
Header File
Classes
-
class AudioCodecPlayerIface : public esp_brookesia::hal::Interface
Player interface exposed by audio-capable devices.
Public Functions
-
inline AudioCodecPlayerIface()
Construct an audio interface.
-
virtual ~AudioCodecPlayerIface() = default
Virtual destructor for polymorphic interfaces.
-
virtual bool open(const Config &config) = 0
Open the backend.
- Parameters
config -- [in] Dynamic configuration.
- Returns
trueon success; otherwisefalse.
-
virtual void close() = 0
Close the backend.
-
virtual bool set_volume(uint8_t volume) = 0
Set volume.
- Parameters
volume -- [in] Requested output volume percentage.
- Returns
trueon success; otherwisefalse.
-
virtual bool write_data(const uint8_t *data, size_t size) = 0
Write PCM/encoded payload to the backend.
- Parameters
data -- [in] Buffer pointer containing audio payload.
size -- [in] Buffer size in bytes.
- Returns
trueon success; otherwisefalse.
-
virtual bool is_pa_on_off_supported() = 0
Check if the PA control is supported.
- Returns
trueif the PA on/off control is supported; otherwisefalse.
-
virtual bool set_pa_on_off(bool on) = 0
Set the PA on/off state.
- Parameters
on -- [in]
trueto set the PA to be on;falseto set the PA to be off.- Returns
trueif the PA on/off state is set successfully; otherwisefalse.
-
virtual bool is_pa_on() const = 0
Check if the PA is set on.
- Returns
trueif the PA is set on; otherwisefalse.
Public Static Attributes
-
struct Config
Dynamic configuration.
-
inline AudioCodecPlayerIface()