public int InitEncoder(int maxFrameSize, int samplesPerFrame, int samplingRate) { this.maxFrameSize = maxFrameSize; encodedBits = new SpeexBits(); encoderState = speex_encoder_init_new(0); // Don't set VAD in the codec, because we're setting it in // the preprocessor instead fixed(int *fSize = &frameSize) { speex_encoder_ctl(encoderState, (int)SpeexCtlCode.SPEEX_GET_FRAME_SIZE, fSize); } fixed(SpeexBits *bitsAdd = &encodedBits) { speex_bits_init(bitsAdd); } preprocessState = speex_preprocess_state_init(samplesPerFrame, samplingRate); return(frameSize); }
public static extern int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
public static extern int speex_preprocess_run(SpeexPreprocessState *st, short *x);
public static extern void speex_preprocess_estimate_update(SpeexPreprocessState *st, short *x);
public static extern void speex_preprocess_state_destroy(SpeexPreprocessState *st);