示例#1
0
        private void record_thread()
        {
            log("Record Thread Started");
            audio.newDataAvailableEventHandler += Audio_newDataAvailableEventHandler;
            audio.sampleRate = 48000;
            audio.open(usedev);

            /*
             * // set up the recorder
             * wi = new WaveIn(WaveCallbackInfo.FunctionCallback());
             * wi.WaveFormat = new WaveFormat(48000, 16, 2);
             * wi.DeviceNumber = usedev;
             * wi.DataAvailable += RecorderOnDataAvailable;
             * wi.BufferMilliseconds = 50; // 50 ms = 2400 Samples at 48 kHz fs
             */

            fftx    = new fft(2400, fft_win);
            fftfreq = fftx.freq;
            amp_cf  = fftx.amp_cf;
            pwr_cf  = fftx.pwr_cf;

            // wi.StartRecording();
            log("Recording started");
            while (!killthread)
            {
                System.Threading.Thread.Sleep(100);
            }
            // wi.StopRecording();
            audio.close();
            log("Recording stopped");
        }
示例#2
0
        private void record_thread()
        {
            log("Record Thread Started");
            // set up the recorder
            wi                    = new WaveIn(WaveCallbackInfo.FunctionCallback());
            wi.WaveFormat         = new WaveFormat(48000, 16, 2);
            wi.DeviceNumber       = usedev;
            wi.DataAvailable     += RecorderOnDataAvailable;
            wi.BufferMilliseconds = 50; // 50 ms = 2400 Samples at 48 kHz fs

            fftx    = new fft(2400, fft_win);
            fftfreq = fftx.freq;
            amp_cf  = fftx.amp_cf;
            pwr_cf  = fftx.pwr_cf;

            wi.StartRecording();
            log("Recording started");
            while (!killthread)
            {
                System.Threading.Thread.Sleep(100);
            }
            wi.StopRecording();
            log("Recording stopped");
        }