當前位置: 首頁>>代碼示例>>C#>>正文


C# WaveIn.GetMixerLine方法代碼示例

本文整理匯總了C#中NAudio.Wave.WaveIn.GetMixerLine方法的典型用法代碼示例。如果您正苦於以下問題:C# WaveIn.GetMixerLine方法的具體用法?C# WaveIn.GetMixerLine怎麽用?C# WaveIn.GetMixerLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NAudio.Wave.WaveIn的用法示例。


在下文中一共展示了WaveIn.GetMixerLine方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: VolumeControl

        public VolumeControl(int deviceNumber)
        {
            waveIn = new WaveIn();
            waveIn.DeviceNumber = deviceNumber;
            //           waveIn.DataAvailable += waveIn_DataAvailable;
            //           waveIn.StartRecording();

            int waveInDeviceNumber = waveIn.DeviceNumber;
            if (Environment.OSVersion.Version.Major >= 6) // Vista and over
            {
                var mixerLine = waveIn.GetMixerLine();
                //new MixerLine((IntPtr)waveInDeviceNumber, 0, MixerFlags.WaveIn);
                foreach (var control in mixerLine.Controls.Where(control => control.ControlType == MixerControlType.Volume))
                {
                    this.volumeControl = control as UnsignedMixerControl;
                    //Level = desiredVolume;
                    break;
                }
            }
            else
            {
                var mixer = new Mixer(waveInDeviceNumber);
                foreach (var source in from destination in mixer.Destinations
                                       where destination.ComponentType == MixerLineComponentType.DestinationWaveIn
                                       from source in destination.Sources
                                       where source.ComponentType == MixerLineComponentType.SourceMicrophone
                                       select source)
                {
                    foreach (var control in source.Controls.Where(control => control.ControlType == MixerControlType.Volume))
                    {
                        volumeControl = control as UnsignedMixerControl;
                        //Level = desiredVolume;
                        break;
                    }
                }
            }
        }
開發者ID:gbanister,項目名稱:VolumeControl,代碼行數:37,代碼來源:VolumeControl.cs

示例2: CanGetWaveInMixerLine

 public void CanGetWaveInMixerLine()
 {
     using (WaveIn waveIn = new WaveIn())
     {
         MixerLine line = waveIn.GetMixerLine();                
         //Debug.WriteLine(String.Format("Mic Level {0}", level));
     }
 }
開發者ID:Punloeu,項目名稱:karaoke,代碼行數:8,代碼來源:MixerApiTests.cs

示例3: Record

        public void Record(string fileName, int volume = 100)
        {
            _waveIn = new WaveIn { WaveFormat = new WaveFormat() };
            _writer = new WaveFileWriter(fileName, _waveIn.WaveFormat);

            TrySetVolumeControl(_waveIn.GetMixerLine(), volume);

            _waveIn.DataAvailable += new_dataAvailable;
            _waveIn.StartRecording();
        }
開發者ID:AdamStefan,項目名稱:Speech-Recognition,代碼行數:10,代碼來源:Recorder.cs

示例4: AudioLevelManager

 protected AudioLevelManager(WaveIn waveDevice)
     : this(GetVolumeMixerControlForInputLine(waveDevice.GetMixerLine()))
 {
 }
開發者ID:stevenzeiler,項目名稱:FeenPhone,代碼行數:4,代碼來源:AudioLevelManager.cs


注:本文中的NAudio.Wave.WaveIn.GetMixerLine方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。