Exemplo n.º 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)
                               )
                           );
     }
 }
Exemplo n.º 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);
     });
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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
             );
     }));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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
             );
     }));
 }
Exemplo n.º 8
0
 public IEnumerable <ConfigurationSection> GetConfigurationSections()
 {
     return(SpectrumBehaviourConfiguration.GetConfigurationSections());
 }