编解码器录音接口
公共头文件: #include "brookesia/hal_interface/audio/codec_recorder.hpp"
类名: AudioCodecRecorderIface
API 参考
Header File
Classes
-
class AudioCodecRecorderIface : public esp_brookesia::hal::Interface
Recording interface exposed by audio-capable devices.
Public Functions
-
inline AudioCodecRecorderIface(Info info)
Construct an audio recording interface.
- 参数
info – [in] Static recording capability information.
-
virtual ~AudioCodecRecorderIface() = default
Virtual destructor for polymorphic recording interfaces.
-
virtual bool open() = 0
Open the recording backend.
- 返回
trueon success; otherwisefalse.
-
virtual void close() = 0
Close the recording backend.
-
virtual bool read_data(uint8_t *data, size_t size) = 0
Read captured audio payload.
- 参数
data – [out] Destination buffer for captured bytes.
size – [in] Requested byte count.
- 返回
trueon success; otherwisefalse.
-
virtual bool set_general_gain(float gain) = 0
Set the general gain.
- 参数
gain – [in] The gain to set.
- 返回
trueon success; otherwisefalse.
-
virtual bool set_channel_gains(const std::map<uint8_t, float> &gains) = 0
Set the channel gains.
- 参数
gains – [in] The channel gains to set.
- 返回
trueon success; otherwisefalse.
Public Static Attributes
-
struct Info
Static recording capability information.
Public Members
-
uint8_t bits
Sample bit width.
-
uint8_t channels
Number of capture channels.
-
uint32_t sample_rate
Capture sample rate in Hz.
-
std::string mic_layout
Microphone layout descriptor.
-
float general_gain
Global input gain.
-
std::map<uint8_t, float> channel_gains
Per-channel gain overrides.
-
uint8_t bits
-
inline AudioCodecRecorderIface(Info info)