1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __SPEECH_NS_H__ 5 #define __SPEECH_NS_H__ 6 7 #include <stdint.h> 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #define SPEECH_NS_SET_AEC_STATE (0) 14 #define SPEECH_NS_SET_AEC_SUPPRESS (1) 15 16 typedef struct { 17 int32_t bypass; 18 float denoise_dB; 19 } SpeechNsConfig; 20 21 struct SpeechNsState_; 22 23 typedef struct SpeechNsState_ SpeechNsState; 24 25 // Creat a instance from speech_ns module/class 26 // Common value include: sample rate, frame size and so on. 27 SpeechNsState *speech_ns_create(int32_t sample_rate, int32_t frame_size, const SpeechNsConfig *cfg); 28 29 // Destory a speech ns instance 30 int32_t speech_ns_destroy(SpeechNsState *st); 31 32 // Just use modify instance configure 33 int32_t speech_ns_set_config(SpeechNsState *st, const SpeechNsConfig *cfg); 34 35 // Get/set some value or enable/disable some function 36 int32_t speech_ns_ctl(SpeechNsState *st, int32_t ctl, void *ptr); 37 38 // Process speech stream 39 int32_t speech_ns_process(SpeechNsState *st, int16_t *pcm_buf, int32_t pcm_len); 40 41 // Debug speech_ns instance 42 int32_t speech_ns_dump(SpeechNsState *st); 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 #endif 49