Esempio n. 1
0
 /// <summary>
 /// AudioInput初期化
 /// </summary>
 private void initAudio()
 {
     _audioInput = new audio.AudioInput();
     _audioInput.DeviceInfoUpdated += (s, e) =>
     {
         if (e.DeviceInfo.FindIndex((audio.DeviceInfo di) => { return(di.DeviceId == Config.Instance.DeviceId); }) >= 0)
         {
             if (!string.IsNullOrEmpty(Config.Instance.DeviceId))
             {
                 _audioInput.SelectDevice(Config.Instance.DeviceId);
             }
         }
         else
         {
             // 繋ぎたいデバイスが消えた
             _deviceRemoved = true;
         }
     };
     _audioInput.DeviceSelected += (s, e) =>
     {
         Config.Instance.DeviceId = e.Device.Id;
         _selectedDeviceIndex     = e.Index;
         _audioInput.StartCapture();
     };
     _audioInput.CaptureStarted += (s, e) => { };
     _audioInput.CaptureStopped += (s, e) => { };
     _audioInput.Disposed       += (s, e) => { };
     _audioInput.DataUpdated    += (s, e) =>
     {
         lock (_audioLockObj)
         {
             _pitchResult = e.Pitch;
             _toneResult  = e.Tone;
         }
     };
     _audioInput.UpdateDeviceInfo();
 }
Esempio n. 2
0
 /// <summary>
 /// AudioInput初期化
 /// </summary>
 private void initAudio()
 {
     _audioInput = new audio.AudioInput();
     _audioInput.DeviceInfoUpdated += (s, e) =>
     {
         if (e.DeviceInfo.FindIndex((audio.DeviceInfo di) => { return di.DeviceId == Config.Instance.DeviceId; }) >= 0)
         {
             if (!string.IsNullOrEmpty(Config.Instance.DeviceId))
             {
                 _audioInput.SelectDevice(Config.Instance.DeviceId);
             }
         }
         else
         {
             // 繋ぎたいデバイスが消えた
             _deviceRemoved = true;
         }
     };
     _audioInput.DeviceSelected += (s, e) =>
     {
         Config.Instance.DeviceId = e.Device.Id;
         _selectedDeviceIndex = e.Index;
         _audioInput.StartCapture();
     };
     _audioInput.CaptureStarted += (s, e) => { };
     _audioInput.CaptureStopped += (s, e) => { };
     _audioInput.Disposed += (s, e) => { };
     _audioInput.DataUpdated += (s, e) =>
     {
         lock (_audioLockObj)
         {
             _pitchResult = e.Pitch;
             _toneResult = e.Tone;
         }
     };
     _audioInput.UpdateDeviceInfo();
 }
Esempio n. 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     _input.StartCapture();
 }