1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef _SPEECH_NOISE_GATE_H_ 5 #define _SPEECH_NOISE_GATE_H_ 6 7 #include <stdint.h> 8 9 typedef struct { 10 int32_t bypass; 11 int32_t data_threshold; 12 int32_t data_shift; 13 float factor_up; 14 float factor_down; 15 } NoisegateConfig; 16 17 struct NoisegateState_; 18 19 typedef struct NoisegateState_ NoisegateState; 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 NoisegateState* speech_noise_gate_create(int32_t sample_rate, int32_t frame_size, const NoisegateConfig *cfg); 26 int32_t speech_noise_gate_destroy(NoisegateState *st); 27 int32_t speech_noise_gate_set_config(NoisegateState *st, const NoisegateConfig *cfg); 28 29 int32_t speech_noise_gate_process(NoisegateState *st, int16_t *pcm_buf, int32_t pcm_len); 30 31 #ifdef __cplusplus 32 } 33 #endif 34 35 #endif 36