Exemple #1
0
        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); }));
            }
        }