コード例 #1
0
        public Mp3Result GetAudioCaptcha()
        {
            string file = AudioTool.GenerateAudio(
                ControllerContext,
                HttpContext.Session["captcha"].ToString()
                );

            return(new Mp3Result(file));
        }
コード例 #2
0
ファイル: AudioHelper.cs プロジェクト: wwj229/ScreenStreamer
        public static List <AudioSourceItem> GetAudioSources(bool ForceUpdate = false)
        {
            if (audioSourceItems == null || ForceUpdate)
            {
                audioSourceItems = AudioTool.GetAudioCaptureDevices().Select(d => new AudioSourceItem(d)).ToList();
            }

            return(new List <AudioSourceItem>(audioSourceItems));

            //return AudioTool.GetAudioCaptureDevices().Select(d => new AudioSourceItem(d)).ToList();
        }
コード例 #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Initialize sio
            sio = new SoundIO();

            // Initialize AudioTool with sio's output parameters:
            at = new AudioTool(sio.getOutputNumChannels(), sio.getOutputSampleRate());

            // Setup event logic with a lambda to run every time we get an input buffer of audio
            sio.audioInEvent += (float[] data) =>
            {
                // When we get a buffer of data, make Audio Tool convert it from mono to stereo:
                float[] output = at.convertChannels(data, 1);

                // Output that data to the speakers
                sio.writeAudio(output);
            };
        }
コード例 #4
0
        private void UpdateAudioSources()
        {
            audioSourceItems = new BindingList <ComboBoxItem>();

            var audioDevices = AudioTool.GetAudioCaptureDevices();

            var captureProps = Config.Data.WasapiCaptureProps;

            foreach (var d in audioDevices)
            {
                d.Properties = captureProps;

                ComboBoxItem item = new ComboBoxItem
                {
                    Name = d.Name,
                    Tag  = d,
                };

                audioSourceItems.Add(item);
            }

            audioSourceComboBox.DataSource    = audioSourceItems;
            audioSourceComboBox.DisplayMember = "Name";
        }
コード例 #5
0
        private void setupSensors()
        {
            // Initialize the combined orientation sensor
            try
            {
                motion = new Motion();
                motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100);
                motion.CurrentValueChanged += motion_CurrentValueChanged;
                motion.Start();
            }
            catch
            {
                // Print out an error
                MessageBox.Show("Could not initialize Motion API.  This phone does not have the necessary sensors to run this code properly!");

                // The kill the current application
                Application.Current.Terminate();
            }

            // Setup sound output
            sio = new SoundIO();
            sio.audioOutEvent += sio_audioOutEvent;
            sio.start();
            at = new AudioTool(sio.getOutputNumChannels(), sio.getOutputSampleRate());
        }