private void RunOutputMeter(Object sender, StreamVolumeEventArgs e, VerticalMeter meter) { OutputMeterSpan = DateTime.Now - lastOutputMeter; lastOutputMeter = DateTime.Now; // Return Time currentOutDbFS -= returnPrSec * (OutputMeterSpan.TotalMilliseconds / 1000d); double max = 0; if (e.MaxSampleValues[0] < 1) { max = 20 * Math.Log10(e.MaxSampleValues[0]); } else if (e.MaxSampleValues[0] >= 1) { max = 20; } if (currentOutDbFS < max) { currentOutDbFS = max; } if (!float.IsNaN(e.MaxSampleValues[0])) { Invoke(new Action(() => { meter.setValue2((int)currentOutDbFS + 18); })); } else { Invoke(new Action(() => { meter.setValue2(-40); })); } }
private void IntergrateAndUpdateMeter(List <float> samples, VerticalMeter meter) { float val; double max = 0; double sum = 0; foreach (float f in samples) { if (f == float.MinValue) { val = float.MaxValue; } else { val = Math.Abs(f); } sum += val; if (val > max) { max = val; } } double avg = sum / (double)samples.Count; double dbfs = Math.Log10(max) * 20; // Return Time currentDbFS -= returnPrSec * (integration / 1000d); if (currentDbFS < dbfs) { currentDbFS = dbfs; } double dbu = currentDbFS + 18; meter.setValue1((float)dbu); //label12.Text = max.ToString(); //label13.Text = dbfs.ToString(); }
private void MakeInOutMeter() { CustomLabel lbl = new CustomLabel(); lbl.Location = new Point(20, 20); lbl.Size = new Size(80, 28); lbl.Font = smallFont; lbl.type = CustomLabel.LabelType.ENGRAVED; lbl.Text = "IN OUT"; this.Controls.Add(lbl); meter = new VerticalMeter(tinyFontB, 2); meter.Size = new Size(80, 248); meter.Location = new Point(20, 53); meter.doubleMeter = true; meter.singleScale = true; meter.setScale(-40, 18); meter.setManScale1(new float[] { -40, -36, -30, -24, -18, -12, -6, 0, 6, 12, 18 }); meter.setManScale2(new float[] { -40, -36, -30, -24, -18, -12, -6, 0, 6, 12, 18 }); this.Controls.Add(meter); }