コード例 #1
0
        void SetGauge(Simova s)
        {
            if (aGauge1.Value > s.Average || aGauge1.Value < s.Average)
            {
                float diff = s.Average - aGauge1.Value;

                if (Math.Abs(diff) < 2)
                {
                    aGauge1.Value += Math.Sign(diff) * (float)0.001 * trackBar1.Value;
                }
                else if (Math.Abs(diff) < 5)
                {
                    aGauge1.Value += Math.Sign(diff) * (float)0.005 * trackBar1.Value;
                }
                else if (Math.Abs(diff) < 10)
                {
                    aGauge1.Value += Math.Sign(diff) * (float)0.01 * trackBar1.Value;
                }
                else if (Math.Abs(diff) < 50)
                {
                    aGauge1.Value += Math.Sign(diff) * (float)0.05 * trackBar1.Value;
                }
                //else if(Math.Abs(diff) > trackBar1.Value * 0.1)
                //{
                // aGauge1.Value += trackBar1.Value * Math.Sign(diff) * (float)0.1;
                //}
                else
                {
                    aGauge1.Value += diff;
                }
            }
        }
コード例 #2
0
        public LevelMeterPanel(ISharpControl control)
        {
            InitializeComponent();

            _controlInterface = control;

            ToolWin = new LevelMeterTool();
            ToolWin = new LevelMeterTool();
            ToolWin.Show();
            ToolWin.Visible = false;
            OnLevelUpdateEvent = new OnLevelUpdate(ToolWin.OnLevelUpdate);

            _fft_buffer = new byte[_controlInterface.FFTResolution];

               _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
               _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
               _smaTunedPeakPowerBandwidth  = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);

               trackBar1.Value = 100;

            UpdateTimer = new Timer();
            UpdateTimer.Interval = _UPDATE_TIMER_INTERVALL;
            UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick);

            MeasureTimer = new Timer();
            MeasureTimer.Interval = _MEASURE_TIMER_INTERVALL;
            MeasureTimer.Tick += new EventHandler(MeasureTimer_Tick);

            Init();
        }
コード例 #3
0
        public LevelMeterPanel(ISharpControl control)
        {
            InitializeComponent();

            _controlInterface = control;

            ToolWin = new LevelMeterTool();
            ToolWin = new LevelMeterTool();
            ToolWin.Show();
            ToolWin.Visible    = false;
            OnLevelUpdateEvent = new OnLevelUpdate(ToolWin.OnLevelUpdate);

            _fft_buffer = new byte[_controlInterface.FFTResolution];

            _smaTunedFrequecy           = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
            _smaTunedBandwidth          = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
            _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);

            trackBar1.Value = 100;


            UpdateTimer          = new Timer();
            UpdateTimer.Interval = _UPDATE_TIMER_INTERVALL;
            UpdateTimer.Tick    += new EventHandler(UpdateTimer_Tick);


            MeasureTimer          = new Timer();
            MeasureTimer.Interval = _MEASURE_TIMER_INTERVALL;
            MeasureTimer.Tick    += new EventHandler(MeasureTimer_Tick);

            Init();
        }
コード例 #4
0
        void MeasureTimer_Tick(object sender, EventArgs e)
        {
            if (!_controlInterface.IsPlaying)
            {
                if (_smaTunedFrequecy.IsValid)
                {
                    _smaTunedFrequecy           = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                    _smaTunedBandwidth          = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                    _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                }
                return;
            }

            _controlInterface.GetSpectrumSnapshot(_fft_buffer, POWERLEVEL_MIN, 0);

            _smaTunedFrequecy.Add(GetPowerTunedFreq());
            _smaTunedBandwidth.Add(GetPowerTunedBandwith());
            _smaTunedPeakPowerBandwidth.Add(GetPeakPowerTunedBandwith());
        }
コード例 #5
0
        public LevelMeterPanel(ISharpControl control)
        {
            InitializeComponent();

            _controlInterface = control;

            InitToolWindow();

            LoadOptions();

            _fft_buffer = new float[_controlInterface.FFTResolution];

            _smaTunedFrequecy           = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
            _smaTunedBandwidth          = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
            _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);

            UpdateTimerInit();

            MeasureTimerInit();

            GuiInit();
        }
コード例 #6
0
        public LevelMeterPanel(ISharpControl control)
        {
            InitializeComponent();

              _controlInterface = control;

              InitToolWindow();

              LoadOptions();

              _fft_buffer = new float[_controlInterface.FFTResolution];

              _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
              _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
              _smaTunedPeakPowerBandwidth  = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);

              UpdateTimerInit();

              MeasureTimerInit();

              GuiInit();
        }
コード例 #7
0
        void GetPowerThreadFunc(object parameter)
        {
            while (true)
            {
                if (!_controlInterface.IsPlaying)
                {
                    if (_smaTunedFrequecy.IsValid)
                    {
                        _smaTunedFrequecy           = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                        _smaTunedBandwidth          = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                        _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                    }
                    return;
                }

                _controlInterface.GetSpectrumSnapshot(_fft_buffer, POWERLEVEL_MIN, 0);

                _smaTunedFrequecy.Add(MyLib.GetPowerTunedFreq());
                _smaTunedBandwidth.Add(MyLib.GetPowerTunedBandwith());
                _smaTunedPeakPowerBandwidth.Add(MyLib.GetPeakPowerTunedBandwith());

                Thread.Sleep(_MEASURE_TIMER_INTERVALL);
            }
        }
コード例 #8
0
        void SetGauge(Simova s)
        {
            if (aGauge1.Value > s.Average || aGauge1.Value < s.Average)
              {
            float diff = s.Average - aGauge1.Value;

            if ( Math.Abs(diff) < 2 )
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.001 * trackBar1.Value;
            }
            else if (Math.Abs(diff) < 5)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.005 * trackBar1.Value;
            }
            else if (Math.Abs(diff) < 10)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.01 * trackBar1.Value;
            }
            else if (Math.Abs(diff) < 50)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.05 * trackBar1.Value;
            }
            //else if(Math.Abs(diff) > trackBar1.Value * 0.1)
            //{
             // aGauge1.Value += trackBar1.Value * Math.Sign(diff) * (float)0.1;
            //}
            else
            {
               aGauge1.Value += diff;
            }
              }
        }
コード例 #9
0
        void MeasureTimer_Tick(object sender, EventArgs e)
        {
            if (!_controlInterface.IsPlaying)
              {
            if (_smaTunedFrequecy.IsValid)
            {
              _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
              _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
              _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
            }
            return;
              }

              _controlInterface.GetSpectrumSnapshot(_fft_buffer);

              _smaTunedFrequecy.Add(GetPowerTunedFreq());
              _smaTunedBandwidth.Add(GetPowerTunedBandwith());
              _smaTunedPeakPowerBandwidth.Add(GetPeakPowerTunedBandwith());
        }
コード例 #10
0
        public void TestThis()
        {
            Simova Sma = new Simova(5, 0);

            Console.WriteLine(Sma.Add(1).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(2).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(3).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(4).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(5).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(6).ToString());
            Console.WriteLine(Sma.BufferToString());
            Console.WriteLine(Sma.Add(7).ToString());
            Console.WriteLine(Sma.BufferToString());

            if (Sma.Add(8) != 6)
            {
              throw new Exception("Simova selftest failed!");
            }
        }
コード例 #11
0
        void SetGauge(Simova s)
        {
            if (aGauge1.Value > s.Average || aGauge1.Value < s.Average)
              {
            float diff = s.Average - aGauge1.Value;

            if (Math.Abs(diff) < 2)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.001 * tbSmoothing.Value;
            }
            else if (Math.Abs(diff) < 5)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.005 * tbSmoothing.Value;
            }
            else if (Math.Abs(diff) < 10)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.01 * tbSmoothing.Value;
            }
            else if (Math.Abs(diff) < 50)
            {
              aGauge1.Value += Math.Sign(diff) * (float)0.05 * tbSmoothing.Value;
            }
            else
            {
              aGauge1.Value += diff;
            }
              }
        }
コード例 #12
0
        void GetPowerThreadFunc(object parameter)
        {
            while (true)
                    {
                        if (!_controlInterface.IsPlaying)
                        {
                            if (_smaTunedFrequecy.IsValid)
                            {
                                _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                                _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                                _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN);
                            }
                            return;
                        }

                        _controlInterface.GetSpectrumSnapshot(_fft_buffer, POWERLEVEL_MIN, 0);

                        _smaTunedFrequecy.Add(MyLib.GetPowerTunedFreq());
                        _smaTunedBandwidth.Add(MyLib.GetPowerTunedBandwith());
                        _smaTunedPeakPowerBandwidth.Add(MyLib.GetPeakPowerTunedBandwith());

                        Thread.Sleep(_MEASURE_TIMER_INTERVALL);
                    }
        }