From 1ba02cc6139a2a3b613e7e0ccf25ae5e26fb6081 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 26 Mar 2016 20:39:36 +0100 Subject: [PATCH] Updated AudioAnalyzer-Example --- .../Example_AudioAnalyzer_full/AudioAnalyzerExample.cs | 4 +++- .../Example_AudioAnalyzer_full/AudioSpectrumEffect.cs | 4 ---- .../Example_AudioAnalyzer_full/SongBeatEffect.cs | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioAnalyzerExample.cs b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioAnalyzerExample.cs index db52cc7..ae559e3 100644 --- a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioAnalyzerExample.cs +++ b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioAnalyzerExample.cs @@ -63,13 +63,15 @@ namespace Example_AudioAnalyzer_full // Add a lack background. We want this to be semi-transparent to add some sort of fade-effect - this will smooth everything out a bit // Note that this isn't a 'real effect' since it's update-rate dependent. A real effect would do always the same thing not mather how fast the keyboard updates. _keyboard.Brush = new SolidColorBrush(Color.FromArgb(96, 0, 0, 0)); - // Add our song-beat-effect. Remember to uncomment the update in the spectrum effect if you want to remove this. _keyboard.AttachEffect(new SongBeatEffect(_soundDataProcessor, Color.FromArgb(127, 164, 164, 164))); // Add our spectrum-effect using the soundDataProcessor and a rainbow from purple to red as gradient _keyboard.AttachEffect(new AudioSpectrumEffect(_soundDataProcessor, new RainbowGradient(300, -14))); + // Hook onto the keyboard update and process data + _keyboard.Updating += (sender, args) => _soundDataProcessor.Process(); + // If you don't like rainbows replace the gradient with anything you like. For example: //_keyboard.AttachEffect(new AudioSpectrumEffect(_soundDataProcessor, new LinearGradient(new GradientStop(0f, Color.Blue), new GradientStop(1f, Color.Red)))); diff --git a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioSpectrumEffect.cs b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioSpectrumEffect.cs index d14b736..022641c 100644 --- a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioSpectrumEffect.cs +++ b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/AudioSpectrumEffect.cs @@ -33,10 +33,6 @@ namespace Example_AudioAnalyzer_full public override void Update(float deltaTime) { - // calculate new data ... - we don't need to do this, since we know that the song beat-effect already calculated them - //_dataProcessor.Process(); - - // ... and update the brush _audioSpectrumBrush.BarData = _dataProcessor.BarValues; } diff --git a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/SongBeatEffect.cs b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/SongBeatEffect.cs index c47f066..42b54bf 100644 --- a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/SongBeatEffect.cs +++ b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/SongBeatEffect.cs @@ -41,9 +41,6 @@ namespace Example_AudioAnalyzer_full public override void Update(float deltaTime) { - // calculate new data ... - _dataProcessor.Process(); - // ... update the effect-data ... if (_dataProcessor.SongBeat >= SONG_BEAT_THRESHOLD) _currentEffect = FLASH_DURATION;