qrb_audio_manager
Overview
It creates stream based on client requests (PlaybackStream for playback, RecordThread for record), provides operations on the stream, and maintains its lifecycle.
API
AudioManager
Function Name |
Comment |
---|---|
uint32_t create_playback_stream(std::string source, std::string coding_format, uint8_t volume, std::string play_mode, int8_t repeat) |
Create playback stream, initialize stream configurations, then open it.
|
uint32_t create_record_stream(uint32_t sample_rate, uint8_t channels, uint8_t sample_format, std::string coding_format, std::string source, bool pub_pcm) |
Create record stream, initialize stream configurations, then open it.
|
bool start_stream(uint32_t stream_handle) |
Start stream.
|
bool stop_stream(uint32_t stream_handle) |
Stop stream.
|
bool release_stream(uint32_t stream_handle) |
Close stream.
|
bool mute_stream(uint32_t stream_handle) |
Mute playback stream.
|
const std::map<std::string, std::string> & get_buildin_sounds() |
Get build-in sounds name.
|
void clean() |
Delete all streams. |
Stream
Function Name |
Comment |
---|---|
bool open() |
Open stream.
|
bool start() |
Start stream.
|
bool stop() |
Stop stream.
|
bool close() |
Close stream.
|
const StreamConfigs & get_stream_configs() |
Get stream’s configs.
|
bool get_domain_async_mode(uint8_t domain_id) |
Domain is a ROS package that implements a particular clint request. For playback/record, the ROS package is qrb_ros_audio_common.
async_mode indicate whether qrb_ros_manager needs to wait until result of calling domina.
|
uint32_t get_domain_handle(uint8_t domain_id) |
Domain handle is stream created in domain.
|
void set_domain_handle(uint8_t domain_id, uint32_t handle) |
Set domain’s handle.
|
static void register_callback(int domain_id, std::function<bool(const void * const, StreamCommand, uint32_t &)> cb, bool use_async) |
A ROS package call it to register itself as a domain.
|
std::function<bool(const void * const, StreamCommand, uint32_t &)> get_domain_cb(uint8_t domain_id) |
Get a domain’s callback function.
|
PlaybackStream
Function Name |
Comment |
---|---|
bool set_mute(bool mute) |
Set mute for playback stream.
|