编解码器播放接口
公共头文件: #include "brookesia/hal_interface/audio/codec_player.hpp"
类名: AudioCodecPlayerIface
API 参考
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.
- 参数
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.
- 参数
config – [in] Dynamic playback configuration.
- 返回
trueon success; otherwisefalse.
-
virtual void close() = 0
Close the playback backend.
-
virtual bool set_volume(uint8_t volume) = 0
Set playback volume.
- 参数
volume – [in] Requested output volume percentage.
- 返回
trueon success; otherwisefalse.
-
virtual bool get_volume(uint8_t &volume) = 0
Get current playback volume.
- 参数
volume – [out] Current output volume percentage.
- 返回
trueon success; otherwisefalse.
-
virtual bool mute() = 0
Set playback to mute.
备注
Calling this interface will mute the playback. Even if the minimum volume is not zero, the volume will be muted to zero.
- 返回
trueon success; otherwisefalse.
-
virtual bool unmute() = 0
Unmute playback.
备注
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.
- 返回
trueon success; otherwisefalse.
-
virtual bool write_data(const uint8_t *data, size_t size) = 0
Write PCM/encoded payload to the playback backend.
- 参数
data – [in] Buffer pointer containing audio payload.
size – [in] Buffer size in bytes.
- 返回
trueon success; otherwisefalse.
Public Static Attributes
-
struct Config
Dynamic playback configuration.
-
struct Info
Static playback capability information.
-
inline AudioCodecPlayerIface(Info info)