// this is to stop the recording // desc: this will first check the condition and stops the recording and then capture any left overs recorded data which is not saved public void StopRecording() { events.AudioRecorderEvents.StateChanged e = new events.AudioRecorderEvents.StateChanged(mState); mState = AudioRecorderState.Idle; StateChanged(this, e); if (null != NotificationEvent) { Capturing = false; NotificationEvent.Set(); } if (null != applicationBuffer) { if (applicationBuffer.Capturing) { InitRecording(false); } } applicationNotify = null; applicationBuffer = null; FileInfo fi = new FileInfo(m_sFileName); if (fi.Length == 44) { File.Delete(m_sFileName); } }
//it will start actual recording, append if there is data //in the wave file through the RecordCaptureData() public void StartRecording(IAudioMediaAsset asset) { events.AudioRecorderEvents.StateChanged e = new events.AudioRecorderEvents.StateChanged(mState); mState = AudioRecorderState.Recording; StateChanged(this, e); m_Channels = asset.Channels; m_SampleRate = asset.SampleRate; m_bitDepth = asset.BitDepth; mAsset = new AudioMediaAsset(m_Channels, m_bitDepth, m_SampleRate); mAsset = asset.Copy() as AudioMediaAsset; AssetManager manager = mAsset.Manager as AssetManager; sProjectDirectory = manager.DirPath; InputFormat = GetInputFormat(); m_sFileName = GetFileName(); BinaryWriter bw = new BinaryWriter(File.Create(m_sFileName)); CreateRIFF(bw); CreateCaptureBuffer(); InitRecording(true); }
public void NotifyChange(Object Sender, StateChanged state) { OnStateChangedEvent(Sender, state); }
//Audiorecorder State public void CatchOnStateChangedEvent(Object sender, VirtualAudioBackend.events.AudioRecorderEvents.StateChanged state) { MessageBox.Show(state.OldState.ToString()); }