void InitializeStream(int sampleRate) { try { if (audioStream != null) { audioStream.OnBroadcast -= AudioStream_OnBroadcast; } else { audioStream = new AudioStream(sampleRate); } audioStream.OnBroadcast += AudioStream_OnBroadcast; if (recorder == null) { recorder = new WaveRecorder(); } System.Diagnostics.Debug.WriteLine("AudioRecorderService.InitializeStream() complete. Audio stream is initialized."); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error: {0}", ex); } }
void InitializeStream(int sampleRate) { try { if (audioStream != null) { audioStream.OnBroadcast -= AudioStream_OnBroadcast; } else { audioStream = new AudioStream(sampleRate); } audioStream.OnBroadcast += AudioStream_OnBroadcast; if (recorder == null) { recorder = new WaveRecorder { WriteAudioDataToFile = WriteAudioDataToFile }; } } catch (Exception ex) { Debug.WriteLine("Error: {0}", ex); } }