/// <summary> /// The Initialize Audio Controls /// </summary> public void InitializeAudioControls(AudioDataFlow initFlow, string pid, string vid) { IMMDevice _audioDevice = null; //Get Audio Device switch (initFlow) { case AudioDataFlow.eAll: _audioDevice = GetIMMDevice(AudioDataFlow.eRender, pid, vid); _speakerControl = new AudioControl(_audioDevice, AudioDataFlow.eRender); _audioSessionControl = new AudioSessionControl(_audioDevice, AudioDataFlow.eRender); _audioDevice = GetIMMDevice(AudioDataFlow.eCapture, pid, vid); _microphoneControl = new AudioControl(_audioDevice, AudioDataFlow.eCapture); break; case AudioDataFlow.eRender: _audioDevice = GetIMMDevice(initFlow, pid, vid); _speakerControl = new AudioControl(_audioDevice, initFlow); break; case AudioDataFlow.eCapture: _audioDevice = GetIMMDevice(initFlow, pid, vid); _microphoneControl = new AudioControl(_audioDevice, initFlow); break; } }
/// <summary> /// The UnIntialize Audio Controls /// </summary> public void UnInitializeAudioControls() { if (null != _speakerControl) { _speakerControl.UninitializeAudio(); _speakerControl = null; } if (null != _microphoneControl) { _microphoneControl.UninitializeAudio(); _microphoneControl = null; } if (null != _audioSessionControl) { _audioSessionControl.UninitializeAudio(); _audioSessionControl = null; } }