/// <summary> /// 初始化声卡麦克风 /// </summary> private void InitializeMixing() { try { this.trackBarIn.Scroll += new EventHandler(trackBarOut_Scroll); this.trackBarOut.Scroll += new EventHandler(trackBarOut_Scroll); mixerF.MixerControlChange += new EventHandler(mixer_MixerControlChange); this.outdtl = new Mixer.MixerControlDetail(mixerF, Mixer.MIXERLINE_COMPONENTTYPE_DST_SPEAKERS); this.trackBarOut.Minimum = this.outdtl.Min; this.trackBarOut.Maximum = this.outdtl.Max; this.trackBarOut.Value = this.outdtl.Volume; this.indtl = new Mixer.MixerControlDetail(mixerF, Mixer.MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE); this.trackBarIn.Minimum = indtl.Min; this.trackBarIn.Maximum = indtl.Max; this.trackBarIn.Value = this.indtl.Volume; m_pWaveIn = new LumiSoft.Media.Wave.WaveIn(LumiSoft.Media.Wave.WaveIn.Devices[0], 8000, 16, 1, 400); m_pWaveIn.BufferFull += new LumiSoft.Media.Wave.BufferFullHandler(m_pWaveIn_BufferFull); m_pWaveIn.Start(); } catch { } }
private void InitializeMixing()//初始化声卡麦克风 { mixer = new Mixer(this); mixer.MixerControlChange += new EventHandler(mixer_MixerControlChange); this.outdtl = new Mixer.MixerControlDetail(mixer, Mixer.MIXERLINE_COMPONENTTYPE_DST_SPEAKERS); this.trackBarOut.Properties.Minimum = this.outdtl.Min; this.trackBarOut.Properties.Maximum = this.outdtl.Max; this.trackBarOut.Properties.TickFrequency = this.outdtl.Volume; this.indtl = new Mixer.MixerControlDetail(mixer, Mixer.MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE); this.trackBarIn.Properties.Minimum = indtl.Min; this.trackBarIn.Properties.Maximum = indtl.Max; this.trackBarIn.Properties.TickFrequency = this.indtl.Volume; }
/// <summary> /// 关闭并释放资源 /// </summary> public void Close() { if (m_pWaveIn != null) { m_pWaveIn.Stop(); m_pWaveIn.Dispose(); } trackBarIn.Dispose(); trackBarIn = null; trackBarOut.Dispose(); trackBarOut = null; mixerF.Close(); mixerF = null; if (outdtl != null) { outdtl = null; } if (indtl != null) { indtl = null; } }
/// <summary> /// 关闭并释放资源 /// </summary> public void Close() { if (m_pWaveIn != null) { m_pWaveIn.Stop(); m_pWaveIn.Dispose(); } trackBarIn.Dispose(); trackBarIn= null; trackBarOut.Dispose(); trackBarOut = null; mixerF.Close(); mixerF = null; if (outdtl != null) outdtl = null; if (indtl != null) indtl = null; }