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


C# Microphone.Start方法代碼示例

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


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

示例1: StartCapture

 public void StartCapture()
 {
     try
     {
         if (_microphone == null)
         {
             _microphone = Microphone.Default;
             _microphone.BufferDuration = TimeSpan.FromMilliseconds(100);
             var sampleSize = _microphone.GetSampleSizeInBytes(_microphone.BufferDuration);
             _baBuffer = new byte[sampleSize];
             _microphone.BufferReady += MicrophoneBufferReady;
             _microphone.Start();
         }
     }
     catch (Exception)
     {
     }
 }
開發者ID:Bootz,項目名稱:VoIP_Project_Archives_Testing,代碼行數:18,代碼來源:AudioDeviceResource.cs

示例2: MicrophoneButton

        private MicrophoneButton(Microphone microphone)
        {
            FrameworkDispatcher.Update();
                        
            var minSupportedBufferDurationMs = 100;
            var duration = TimeSpan.FromMilliseconds(minSupportedBufferDurationMs);

            Microphone = microphone;
            Microphone.BufferDuration = duration;

            Buffer = new byte[Microphone.GetSampleSizeInBytes(duration)];
            Buffer2D = new Color[TexWidth * byte.MaxValue];

            Texture2D = Texture2D ?? Program.Renderer.LeaseFor<Gray, byte>(TexWidth, byte.MaxValue);
            Texture2D.SetData(Buffer2D);

            Microphone.BufferReady += OnBufferReady;

            Microphone.Start();            
        }
開發者ID:JaapSuter,項目名稱:Pentacorn,代碼行數:20,代碼來源:MicrophoneButton.cs


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