コード例 #1
0
        private void InputCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            var prov = Recorder.GetWaveProvider();

            VolumeControl.Volume = 1;
            Sound                = new AudioSound(prov, 0, 0, VolumeControl.Volume);
            Sound.EndPos         = Recorder.RecordedTime;
            StartTime.Minimum    = 0;
            StartTime.Maximum    = (decimal)Sound.EndPos;
            EndTime.Minimum      = 0;
            EndTime.Maximum      = StartTime.Maximum;
            EndTime.Value        = StartTime.Maximum;
            TotalTimeLabel.Text  = $"{EndTime.Maximum} s";
            WaveGraph.WaveStream = Sound.FileReader;
        }
コード例 #2
0
        public SaveSound()
        {
            InitializeComponent();

            AddActionsForControlsOfTypes((Control c) => c.KeyDown += PlayStopOnKeys, typeof(Button), typeof(ComboBox), typeof(NumericUpDown));
            AddActionsForControlsOfTypes((Control c) => c.KeyDown += SelectNextOnEnterKey, typeof(ComboBox), typeof(NumericUpDown), typeof(TextBox));
            AddActionsForControlsOfTypes((Control c) => c.KeyDown += SpaceForNumUpDown, typeof(NumericUpDown));
            AddArrowSelectForControls(StartTime, EndTime);
            AddActionsForControlsOfTypes((Control c) => { c.KeyDown += CloseOnEsc; c.KeyDown += SupressKeys; }, typeof(Button), typeof(ComboBox), typeof(NumericUpDown), typeof(TextBox));

            Recorder = Form1.Recorders[0];
            foreach (var recorder in Form1.Recorders)
            {
                recorder.StopRecording();
                InputCombo.Items.Add(WaveIn.GetCapabilities(recorder.Device).ProductName);
            }
            InputCombo.SelectedIndex = 0;
            var prov = Recorder.GetWaveProvider();

            Sound               = new AudioSound(prov, 0, 0, VolumeControl.Volume);
            Sound.EndPos        = Recorder.RecordedTime;
            StartTime.Minimum   = 0;
            StartTime.Maximum   = (decimal)Sound.EndPos;
            EndTime.Minimum     = 0;
            EndTime.Maximum     = StartTime.Maximum;
            EndTime.Value       = StartTime.Maximum;
            TotalTimeLabel.Text = $"{EndTime.Maximum} s";
            KeyCombo.Items.Add("Select a key");
            foreach (var item in Form1.MyKeyboard)
            {
                foreach (var key in item)
                {
                    KeyCombo.Items.Add(key);
                }
            }
            KeyCombo.SelectedIndex = 0;
            //SaveButton.Enabled = false;
            WaveGraph.WaveStream = Sound.FileReader;
        }