Beispiel #1
0
 public Spectrum()
 {
     this.InitializeComponent();
     this.Timer           = new Timer();
     this.Timer.Interval  = UPDATE_INTERVAL;
     this.Timer.AutoReset = false;
     this.Timer.Elapsed  += this.OnElapsed;
     if (Enabled != null)
     {
         Enabled.ConnectValue(value =>
         {
             if (value)
             {
                 this.Visibility = Visibility.Visible;
                 this.Timer.Start();
             }
             else
             {
                 this.Visibility = Visibility.Collapsed;
                 this.Timer.Stop();
             }
         });
     }
     if (Bars != null)
     {
         Bars.ConnectValue(value =>
                           this.Configure(
                               SpectrumBehaviourConfiguration.GetBars(value),
                               SpectrumBehaviourConfiguration.GetWidth(value)
                               )
                           );
     }
 }
Beispiel #2
0
 private void OnValueChanged(object sender, EventArgs e)
 {
     var task = Windows.Invoke(() =>
     {
         //Fix the width so all 2d math is integer.
         this.MinWidth = SpectrumBehaviourConfiguration.GetWidthForBars(BarCount.Value);
     });
 }
Beispiel #3
0
 public Spectrum()
 {
     this.InitializeComponent();
     if (BarCount != null)
     {
         //Fix the width so all 2d math is integer.
         this.MinWidth          = SpectrumBehaviourConfiguration.GetWidthForBars(BarCount.Value);
         BarCount.ValueChanged += this.OnValueChanged;
     }
 }
Beispiel #4
0
 protected override void CreateViewBox()
 {
     this.RendererData = Create(
         this.Output,
         this.Bitmap.PixelWidth,
         this.Bitmap.PixelHeight,
         SpectrumBehaviourConfiguration.GetBars(this.Bars.Value),
         VisualizationBehaviourConfiguration.GetFFTSize(this.FFTSize.Value),
         this.ShowPeaks.Value,
         this.HighCut.Value
         );
     this.Viewbox = new Rect(0, 0, this.GetPixelWidth(), this.Bitmap.PixelHeight);
 }
Beispiel #5
0
 protected virtual Task RefreshBitmap()
 {
     return(Windows.Invoke(() =>
     {
         this.RendererData = Create(
             this.Output,
             this.Bitmap.PixelWidth,
             this.Bitmap.PixelHeight,
             SpectrumBehaviourConfiguration.GetBars(this.Bars.Value),
             VisualizationBehaviourConfiguration.GetFFTSize(this.FFTSize.Value),
             this.ShowPeaks.Value,
             this.HighCut.Value
             );
     }));
 }
Beispiel #6
0
 protected override void CreateViewBox()
 {
     this.RendererData = Create(
         this.Output,
         this.Bitmap.PixelWidth,
         this.Bitmap.PixelHeight,
         SpectrumBehaviourConfiguration.GetBars(this.Bars.Value),
         SpectrumBehaviourConfiguration.GetFFTSize(this.FFTSize.Value),
         this.HoldInterval.Value,
         this.UpdateInterval.Value,
         this.SmoothingFactor.Value,
         this.Amplitude.Value,
         this.ShowPeaks.Value,
         this.HighCut.Value
         );
     this.Viewbox = new Rect(0, 0, this.GetPixelWidth(), this.Bitmap.PixelHeight);
 }
Beispiel #7
0
 protected virtual Task RefreshBitmap()
 {
     return(Windows.Invoke(() =>
     {
         this.RendererData = Create(
             this.Output,
             this.Bitmap.PixelWidth,
             this.Bitmap.PixelHeight,
             SpectrumBehaviourConfiguration.GetBars(this.Bars.Value),
             SpectrumBehaviourConfiguration.GetFFTSize(this.FFTSize.Value),
             this.HoldInterval.Value,
             this.UpdateInterval.Value,
             this.SmoothingFactor.Value,
             this.Amplitude.Value,
             this.ShowPeaks.Value,
             this.HighCut.Value
             );
     }));
 }
 public IEnumerable <ConfigurationSection> GetConfigurationSections()
 {
     return(SpectrumBehaviourConfiguration.GetConfigurationSections());
 }