File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,19 @@ mod sys {
9898 st : * mut SpeexPreprocessState ,
9999 }
100100
101+ macro_rules! speex_ctl_helper {
102+ ( $st: expr, $req: expr, $v: expr) => {
103+ let ret = unsafe {
104+ speex_preprocess_ctl(
105+ $st,
106+ $req as std:: os:: raw:: c_int,
107+ & mut $v as * mut i32 as * mut c_void,
108+ )
109+ } ;
110+ debug_assert!( ret == 0 ) ;
111+ } ;
112+ }
113+
101114 impl SpeexPreprocess {
102115 pub fn new (
103116 frame_size : usize ,
@@ -164,6 +177,19 @@ mod sys {
164177 Ok ( ( ) )
165178 }
166179 }
180+
181+ pub fn set_denoise ( & mut self , enable : bool ) {
182+ let mut value = if enable { 1 } else { 0 } ;
183+ speex_ctl_helper ! ( self . st, SPEEX_PREPROCESS_SET_DENOISE , value) ;
184+ }
185+
186+ pub fn set_noise_suppress ( & mut self , mut value : i32 ) {
187+ speex_ctl_helper ! (
188+ self . st,
189+ SPEEX_PREPROCESS_SET_NOISE_SUPPRESS ,
190+ value
191+ ) ;
192+ }
167193 }
168194
169195 impl Drop for SpeexPreprocess {
You can’t perform that action at this time.
0 commit comments