Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioDialog"/> class.
        /// </summary>
        /// <param name="card">The card.</param>
        /// <param name="side">The side.</param>
        /// <param name="example">if set to <c>true</c> to use the example.</param>
        /// <remarks>Documented by Dev05, 2007-12-06</remarks>
        public AudioDialog()
        {
            InitializeComponent();

            # region MP3-Settings
            LameDOTnet.Lame.MP3_Settings mp3Settings = new LameDOTnet.Lame.MP3_Settings();
            mp3Settings.Bitrate = 128;
            mp3Settings.CopyrightBit = true;
            mp3Settings.CRC_Bit = true;
            mp3Settings.DisableBitReservoir = false;
            mp3Settings.OriginalBit = true;
            mp3Settings.PrivatBit = false;
            mp3Settings.QualityPreset = LameDOTnet.Lame.LAME_QUALITY_PRESET.LQP_NORMAL_QUALITY;
            mp3Settings.StrictISOencoding = false;
            mp3Settings.VBR_enabled = true;
            mp3Settings.VBR_maxBitrate = 128;
            mp3Settings.VBR_method = LameDOTnet.Lame.VBR_METHOD.VBR_METHOD_DEFAULT;
            mp3Settings.VBR_Quality = Settings.Default.audioVBRQuality;
            mp3Settings.VBR_WriteHeader = true;
            # endregion
            if (EnableMP3Recording)
                recorder = new Recorder(mp3Settings, Settings.Default.audioChannels, Settings.Default.audioSamplingrate);
            else
                recorder = new Recorder(Settings.Default.audioChannels, Settings.Default.audioSamplingrate);

            buttonRecord.Enabled = SoundDevicesAvailable.SoundInDeviceAvailable();
        }
Example #2
0
        /// <summary>
        /// Start a recording.
        /// </summary>
        /// <remarks>Documented by Dev05, 2007-08-03</remarks>
        private void Record()
        {
            if (!SoundDevicesAvailable.SoundInDeviceAvailable())
            {
                MessageBox.Show(Resources.NO_WAVEIN_DEVICE_TEXT, Resources.NO_WAVEIN_DEVICE_CAPTION);
                Stop();
                return;
            }

            collapsed = false;
            groupBoxSelect.Enabled = false;
            menuStripMain.Enabled = false;
            UpdateSettings();

            bool enableMP3 = false;

            //Initialize default settings for the Lame MP3 encoding.
            LameDOTnet.Lame.MP3_Settings MP3Settings = new LameDOTnet.Lame.MP3_Settings();
            MP3Settings.Bitrate = 192;
            MP3Settings.CopyrightBit = true;
            MP3Settings.CRC_Bit = true;
            MP3Settings.DisableBitReservoir = false;
            MP3Settings.OriginalBit = true;
            MP3Settings.PrivatBit = false;
            MP3Settings.QualityPreset = LameDOTnet.Lame.LAME_QUALITY_PRESET.LQP_NORMAL_QUALITY;
            MP3Settings.StrictISOencoding = false;
            MP3Settings.VBR_enabled = true;
            MP3Settings.VBR_maxBitrate = 320;
            MP3Settings.VBR_method = LameDOTnet.Lame.VBR_METHOD.VBR_METHOD_DEFAULT;
            MP3Settings.VBR_Quality = 0;
            MP3Settings.VBR_WriteHeader = true;

            if (enableMP3)
                recorder = new Recorder(MP3Settings, settings.Channels, settings.SamplingRate);
            else
                recorder = new Recorder(settings.Channels, settings.SamplingRate);

            //fetch temporary filename
            do
            {
                actualFilename = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName().Split('.')[0] + (enableMP3 ? Resources.MP3_EXTENSION : Resources.WAV_EXTENSION));
            }
            while (File.Exists(actualFilename));

            recorder.StartRecording(actualFilename, 0, (settings.DelaysActive ? settings.StartDelay : 0), (settings.DelaysActive ? settings.StopDelay : 0));

            if (numPadControl.CurrentState == Function.Nothing)
                toolStripStatusLabelAction.Text = string.Format(Resources.STATUS_STRIP_RECORD_MESSAGE, STANDART_KEYS.RECORD1.ToString(), STANDART_KEYS.RECORD2.ToString());
            else
                toolStripStatusLabelAction.Text = string.Format(Resources.STATUS_STRIP_STOP_MESSAGE, STANDART_KEYS.RECORD1.ToString(), STANDART_KEYS.RECORD2.ToString());
        }