Example #1
0
        /*********************************************************************************
        *
        *
        *********************************************************************************/
        public void ButtonRec_Click(object sender, EventArgs e)
        {
            Int32 bufferSize = AudioRecord.GetMinBufferSize(mSamplingRate, ChannelIn.Mono, mFormat);

            System.Diagnostics.Debug.WriteLine("AudioRecord : GetMinBufferSize={0}", bufferSize);

            RecordBuffer.Instance.Frames = mFrameSize;

            mAudioRecord = new AudioRecord(
                //AudioSource.Default,
                //AudioSource.Camcorder,
                AudioSource.Mic,
                //AudioSource.VoiceCommunication,
                //AudioSource.VoiceRecognition,
                //AudioSource.VoiceUplink,
                mSamplingRate,
                ChannelIn.Mono,
                mFormat,
                bufferSize);

            // 音声データを幾つずつ処理するか( = 1フレームのデータの数)
            mAudioRecord.SetPositionNotificationPeriod(RecordBuffer.Instance.Frames);

            // コールバックを指定
            mAudioRecord.SetRecordPositionUpdateListener(new OnRecordPositionUpdateListener());

            mAudioRecord.StartRecording();

            Byte[] dummy = new Byte[1];
            mAudioRecord.Read(dummy, 0, dummy.Length);
        }