public void DrawStringsLabels(Tuning TUNING) { float pxPerHz = (float)(PitchBar.Height - 22) / (PitchBar.Maximum - PitchBar.Minimum); int xPosition, yPosition; xPosition = PitchBar.Right - 20; foreach (var pitch in TUNING.StringsPitches) { var stringLabel = new Label { Text = pitch.Name, AutoSize = true, Font = new Font("Arial", 8), TextAlign = ContentAlignment.MiddleLeft }; stringLabels.Add(stringLabel); this.Controls.Add(stringLabel); float diff = (PitchBar.Maximum - pitch.Fundamental); yPosition = (int)(diff * pxPerHz) + PitchBar.Top + 10 - stringLabel.Height / 2; stringLabel.Location = new Point(xPosition, yPosition); stringLabel.BringToFront(); } }
public void SetTuningsListBox(Tuning TUNING) { foreach (var tuning in TUNING.TuningList) { this.TuningsListBox.Items.Add(tuning); } TuningsListBox.SelectedIndex = 0; }
public TunerController(ITunerView VIEW, PitchDetector DETECTOR) { tuningType = new Tuning(); tuningType.SetStandardTuning(); pitchDetector = DETECTOR; view = VIEW; view.SetController(this); view.DrawStringsLabels(tuningType); view.SetDeviceList(GetDeviceList()); view.SetTuningsListBox(tuningType); view.DeviceNumber = 0; pitchDetector.FundamentalDetector.Recorder.Buffer.BufferFilled += OnBufferFilled; pitchDetector.PitchFound += OnPitchFound; }