Ejemplo n.º 1
0
            /// <summary>
            /// Process a frame of data captured from the microphone
            /// </summary>
            /// <param name="frame"></param>
            /// <returns>Returns true iff VAD is enabled and speech is detected</returns>
            public void Process(ArraySegment <short> frame)
            {
                if (frame.Count != _frameSize)
                {
                    throw new ArgumentException(string.Format("Incorrect frame size, expected {0} but given {1}", _frameSize, frame.Count), "frame");
                }

                using (var handle = frame.Pin())
                    SpeexDspNativeMethods.speex_preprocess_run(_preprocessor, handle.Ptr);
            }