/// <summary> /// Load event - initializes the control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PresetControl_Load(object sender, EventArgs e) { ChangeState(PresetStates.Off); PresetData = new PresetData(); presetIdLabel.Text = this.Id.ToString(); presetIdLabel.ForeColor = LABEL_INACTIVE_COLOR; presetIdLabel.HoverColor = LABEL_HOVER_COLOR; presetIdLabel.RegularColor = LABEL_INACTIVE_COLOR; presetButton.ButtonText = Resources.PresetNoDesc; }
/// <summary> /// Load event - initializes the control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PresetControl_Load(object sender, EventArgs e) { ChangeState(PresetStates.Off); PresetData = new PresetData(); presetIdLabel.Text = this.Id.ToString(); presetButton.ButtonText = Resources.PresetNoDesc; }
/// <summary> /// Applies the preset values to UI controls - Effectively loads the UI controls with preset values /// </summary> /// <param name="presetData"></param> private void ApplyPresetValueUIControls(PresetData presetData) { // Apply preset values tempoTrackBar.Value = Convert.ToInt32(presetData.Tempo * 100.0f); pitchTrackBar.Value = Convert.ToInt32(presetData.Pitch * TicksPerSemitone); volumeTrackBar.Value = Convert.ToInt32(presetData.Volume * 100.0f); loEqTrackBar.Value = Convert.ToInt32(presetData.LoEqValue * 100.0f); loEqTrackBar_ValueChanged(this, new EventArgs()); medEqTrackBar.Value = Convert.ToInt32(presetData.MedEqValue * 100.0f); medEqTrackBar_ValueChanged(this, new EventArgs()); hiEqTrackBar.Value = Convert.ToInt32(presetData.HiEqValue * 100.0f); hiEqTrackBar_ValueChanged(this, new EventArgs()); if (m_practiceSharpLogic.FilePlayDuration == TimeSpan.Zero) { playTimeTrackBar.Value = playTimeTrackBar.Minimum; } else { // Protect against invalid preset values if (presetData.CurrentPlayTime.TotalSeconds > m_practiceSharpLogic.FilePlayDuration.TotalSeconds) { presetData.CurrentPlayTime = TimeSpan.Zero; presetData.StartMarker = TimeSpan.Zero; presetData.EndMarker = TimeSpan.Zero; } // Set the PlayTimeTrackBar value to the preset's CurrentPlayTime playTimeTrackBar.Value = Convert.ToInt32(100.0f * presetData.CurrentPlayTime.TotalSeconds / m_practiceSharpLogic.FilePlayDuration.TotalSeconds); } ApplyLoopStartMarkerUI(presetData.StartMarker); ApplyLoopEndMarkerUI(presetData.EndMarker); m_practiceSharpLogic.StartMarker = presetData.StartMarker; m_practiceSharpLogic.EndMarker = presetData.EndMarker; int cueItemIndex = cueComboBox.FindString(Convert.ToInt32(presetData.Cue.TotalSeconds).ToString()); cueComboBox.SelectedIndex = cueItemIndex; loopCheckBox.Checked = presetData.Loop; positionMarkersPanel.Refresh(); // Find matching Time Stretch Profile for ( int itemIndex = 0; itemIndex < timeStretchProfileComboBox.Items.Count; itemIndex++ ) { TimeStretchProfile profile = timeStretchProfileComboBox.Items[itemIndex] as TimeStretchProfile; if (profile.Id == presetData.TimeStretchProfile.Id) { timeStretchProfileComboBox.SelectedIndex = itemIndex; break; } } timeStretchProfileComboBox.SelectedValue = presetData.TimeStretchProfile; removeVocalsCheckBox.Checked = presetData.RemoveVocals; }