/// <summary> /// Start recording session /// </summary> private void StartRecording() { #region guard if (PlayerState != PlayerStates.Stopped) { MessageBox.Show("Please stop the player before", "Karaboss", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } #endregion // Reset all InitRecordTasks(); RecorderState = RecorderStates.Recording; timerRecorder.Start(); try { inDevice.StartRecording(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public frmExternalMidiRecord(InputDevice inputdevice, OutputDevice outputdevice) { InitializeComponent(); ResizeObjects(); stopButton.Enabled = false; btnSave.Enabled = false; context = SynchronizationContext.Current; // Input Midi device inDevice = inputdevice; if (!InitInputDevice()) { startButton.Enabled = false; stopButton.Enabled = false; } // player PlayerState = PlayerStates.Stopped; timerPlayer.Interval = 20; RecorderState = RecorderStates.Stopped; timerRecorder.Interval = 100; // Output Midi Device outDevice = outputdevice; InitOutputDevice(); }
/// <summary> /// End record operations /// </summary> private void EndRecordTasks() { startButton.Text = "Start recording"; startButton.Enabled = true; stopButton.Enabled = false; btnSave.Enabled = true; LoadSequencer(); DrawControls(); RecorderState = RecorderStates.Stopped; }
/// <summary> /// Stop recording session /// </summary> private void StopRecording() { #region guard if (RecorderState != RecorderStates.Recording) { return; } #endregion try { inDevice.StopRecording(); inDevice.Reset(); // Tell timerRecorder to update and display sequence characteristics RecorderState = RecorderStates.Saving; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }