123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- enum sr_audsrc
- {
- SR_MIC,
- SR_USER
- };
- #define E_SR_NOACTIVEDEVICE 1
- #define E_SR_NOMEM 2
- #define E_SR_INVAL 3
- #define E_SR_RECORDFAIL 4
- #define E_SR_ALREADY 5
- struct speech_rec_notifier {
- void (*on_result)(const char *result, char is_last);
- void (*on_speech_begin)();
- void (*on_speech_end)(int reason);
- };
- #define END_REASON_VAD_DETECT 0
- struct speech_rec {
- enum sr_audsrc aud_src;
- struct speech_rec_notifier notif;
- const char * session_id;
- int ep_stat;
- int rec_stat;
- int audio_status;
- struct recorder *recorder;
- volatile int state;
- char * session_begin_params;
- };
- #ifdef __cplusplus
- extern "C" {
- #endif
- int sr_init(struct speech_rec * sr, const char * session_begin_params, enum sr_audsrc aud_src, struct speech_rec_notifier * notifier);
- int sr_start_listening(struct speech_rec *sr);
- int sr_stop_listening(struct speech_rec *sr);
- int sr_write_audio_data(struct speech_rec *sr, char *data, unsigned int len);
- void sr_uninit(struct speech_rec * sr);
- #ifdef __cplusplus
- }
- #endif
|