Codec Player Interface
Public header: #include "brookesia/hal_interface/audio/codec_player.hpp"
Class: AudioCodecPlayerIface
API Reference
Header File
Classes
-
class AudioCodecPlayerIface : public esp_brookesia::hal::Interface
Playback interface exposed by audio-capable devices.
Public Functions
-
inline AudioCodecPlayerIface(Info info)
Construct an audio playback interface.
- Parameters
info – [in] Static playback capability information.
-
virtual ~AudioCodecPlayerIface() = default
Virtual destructor for polymorphic playback interfaces.
-
virtual bool open(const Config &config) = 0
Open the playback backend.
- Parameters
config – [in] Dynamic playback configuration.
- Returns
trueon success; otherwisefalse.
-
virtual void close() = 0
Close the playback backend.
-
virtual bool set_volume(uint8_t volume) = 0
Set playback volume.
- Parameters
volume – [in] Requested output volume percentage.
- Returns
trueon success; otherwisefalse.
-
virtual bool get_volume(uint8_t &volume) = 0
Get current playback volume.
- Parameters
volume – [out] Current output volume percentage.
- Returns
trueon success; otherwisefalse.
-
virtual bool mute() = 0
Set playback to mute.
Note
Calling this interface will mute the playback. Even if the minimum volume is not zero, the volume will be muted to zero.
- Returns
trueon success; otherwisefalse.
-
virtual bool unmute() = 0
Unmute playback.
Note
Calling this interface will set the volume to the last set value. If the last set value is zero, the volume will be restored to the default value.
- Returns
trueon success; otherwisefalse.
-
virtual bool write_data(const uint8_t *data, size_t size) = 0
Write PCM/encoded payload to the playback backend.
- Parameters
data – [in] Buffer pointer containing audio payload.
size – [in] Buffer size in bytes.
- Returns
trueon success; otherwisefalse.
Public Static Attributes
-
struct Config
Dynamic playback configuration.
-
struct Info
Static playback capability information.
-
inline AudioCodecPlayerIface(Info info)