コード例 #1
0
        void Form1_Load(object sender, EventArgs arg)
        {
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            _input = new AudioInput();

            _input.DeviceInfoUpdated += (s, e) =>
            {
                this.Invoke(new updateDeviceListDelegate(updateDeviceList), e.DeviceInfo);
            };

            _input.DeviceSelected += (s, e) =>
            {
                this.Invoke(new updateDeviceDelegate(updateDevice), e.Device);
            };
            _input.CaptureStarted += (s, e) =>
            {
                Console.WriteLine("capture started");
            };
            _input.CaptureStopped += (s, e) =>
            {
                Console.WriteLine("capture stopped");
            };
            _input.DataUpdated += (s, e) =>
            {
                this.Invoke(new TestShowDelegate(TestShow), e.Pitch);
            };
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: davinx/PitchPitch
        void Form1_Load(object sender, EventArgs arg)
        {
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            _input = new AudioInput();

            _input.DeviceInfoUpdated += (s, e) =>
                {
                    this.Invoke(new updateDeviceListDelegate(updateDeviceList), e.DeviceInfo);
                };

            _input.DeviceSelected += (s, e) =>
                {
                    this.Invoke(new updateDeviceDelegate(updateDevice), e.Device);
                };
            _input.CaptureStarted += (s, e) =>
                {
                    Console.WriteLine("capture started");
                };
            _input.CaptureStopped += (s, e) =>
                {
                    Console.WriteLine("capture stopped");
                };
            _input.DataUpdated += (s, e) =>
                {
                    this.Invoke(new TestShowDelegate(TestShow), e.Pitch);
                };
        }
コード例 #3
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();
 }
コード例 #4
0
ファイル: PitchPitch.cs プロジェクト: davinx/PitchPitch
 /// <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();
 }
コード例 #5
0
ファイル: SceneOption.cs プロジェクト: davinx/PitchPitch
        public override void Init(PitchPitch parent)
        {
            base.Init(parent);

            _audioInput = parent.AudioInput;
            _audioInput.DeviceInfoUpdated += (s, e) => { _needUpdate = true; };
            updateDevices();

            _isCalStarted = false;
            _calSelectedIdx = IDX_MAXPITCH;
            _state = SelectionState.Device;
        }