예제 #1
0
        public Form1()
        {
            KeyPreview = true;
            SoundBoardData.LoadProperties();
            InitializeComponent();
            var r = new AudioRecorder(0);

            Recorders.Add(r);
            r.StartRecording();
            //SoundButtonMaker.Engine = Engine;
        }
예제 #2
0
 private void DevicesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     new DevicesForm((int[] devices) =>
     {
         foreach (var recorder in Recorders)
         {
             recorder.Reset();
         }
         Recorders.Clear();
         foreach (int i in devices)
         {
             var r = new AudioRecorder(i);
             Recorders.Add(r);
             r.StartRecording();
         }
     }).Show();
 }
예제 #3
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;
        }