コード例 #1
0
        private void StopRecording()
        {
            string filePath = string.Empty;
            string song     = string.Empty;
            int    duration = 0;

            if (SoundCardRecorder != null)
            {
                addToLog("Recording stopped");

                SoundCardRecorder.Stop();
                filePath = SoundCardRecorder.FilePath;
                song     = SoundCardRecorder.Song;
                duration = SoundCardRecorder.Duration;
                addToLog("Duration: " + duration + " (Limit: " + thresholdTextBox.Value + ")");
                SoundCardRecorder.Dispose();
                SoundCardRecorder = null;

                if (duration < (int)thresholdTextBox.Value && thresholdCheckBox.Checked)
                {
                    File.Delete(filePath);
                    addToLog("Recording too short; deleting file...");
                }
                else
                {
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        addToLog("Recorded file: " + filePath);
                        encodingLabel.Text = song;
                        PostProcessing(song);
                    }
                }
            }
        }
コード例 #2
0
        private void OnLoad(object sender, EventArgs eventArgs)
        {
            // Load the main browser
            mainBrowser = new ChromiumWebBrowser("https://www.deezer.com/")
            {
                BrowserSettings = new BrowserSettings()
                {
                    Plugins = CefState.Enabled
                }
            };
            this.splitContainer1.Panel2.Controls.Add(mainBrowser);

            // Load the timer only when loading is finished
            mainBrowser.LoadingStateChanged += OnLoadingStateChanged;

            //load the available devices
            LoadWasapiDevicesCombo();

            //load the different bitrates
            LoadBitrateCombo();

            //Load user settings
            LoadUserSettings();

            //set the change event if filePath is
            songLabel.Text     = string.Empty;
            encodingLabel.Text = string.Empty;

            folderDialog = new FolderBrowserDialog {
                SelectedPath = outputFolderTextBox.Text
            };

            versionLabel.Text = string.Format("Version {0}", Application.ProductVersion);

            ChangeApplicationState(_currentApplicationState);

            // instantiate the sound recorder once in an attempt to reduce lag the first time used
            try
            {
                soundCardRecorder = new SoundCardRecorder((MMDevice)deviceListBox.SelectedItem, CreateOutputFile("deleteme", "wav"), Mp3Tag.EmptyTag());
                soundCardRecorder.Dispose();
                soundCardRecorder = null;
                if (File.Exists(CreateOutputFile("deleteme", "wav")))
                {
                    File.Delete(CreateOutputFile("deleteme", "wav"));
                }
            }
            catch (Exception ex)
            {
                addToLog("Error: " + ex.Message);
            }
        }
コード例 #3
0
        private void StartRecording(MMDevice device)
        {
            if (device != null)
            {
                if (SoundCardRecorder != null)
                {
                    StopRecording();
                }

                recordingTrack = new Mp3Tag(currentTrack.Title, currentTrack.Artist, currentTrack.TrackUri);

                SoundCardRecorder = new SoundCardRecorder(
                    device, CreateOutputFile(recordingTrack.Artist + " - " + recordingTrack.Title, "wav"),
                    recordingTrack.Artist + " - " + recordingTrack.Title);
                SoundCardRecorder.Start();

                addToLog("Recording!");
            }
        }
コード例 #4
0
        private void StartRecording(MMDevice device)
        {
            if (device != null)
            {
                if (soundCardRecorder != null)
                {
                    StopRecording();
                }

                recordingTrack = new Mp3Tag(currentTrack.Title, currentTrack.Artist);

                string song = recordingTrack.ToString();
                string file = CreateOutputFile(song, "wav");

                soundCardRecorder = new SoundCardRecorder(
                    device, file,
                    recordingTrack);
                soundCardRecorder.Start();

                addToLog("Recording!");
            }
        }
コード例 #5
0
        private void OnLoad(object sender, EventArgs eventArgs)
        {
            //load the available devices
            LoadWasapiDevicesCombo();

            //load the different bitrates
            LoadBitrateCombo();

            //Load user settings
            LoadUserSettings();

            //set the change event if filePath is
            songLabel.Text     = string.Empty;
            encodingLabel.Text = string.Empty;

            folderDialog = new FolderBrowserDialog {
                SelectedPath = outputFolderTextBox.Text
            };

            versionLabel.Text = string.Format("Version {0}", Application.ProductVersion);

            ChangeApplicationState(_currentApplicationState);

            // instantiate the sound recorder once in an attempt to reduce lag the first time used
            try
            {
                SoundCardRecorder = new SoundCardRecorder((MMDevice)deviceListBox.SelectedItem, CreateOutputFile("deleteme", "wav"), "");
                SoundCardRecorder.Dispose();
                SoundCardRecorder = null;
                if (File.Exists(CreateOutputFile("deleteme", "wav")))
                {
                    File.Delete(CreateOutputFile("deleteme", "wav"));
                }
            }
            catch (Exception ex)
            {
            }
        }