mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Updated AudioAnalyzer-Example
This commit is contained in:
parent
dbdc1c22e8
commit
1ba02cc613
@ -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
|
// 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.
|
// 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));
|
_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.
|
// 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)));
|
_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
|
// 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)));
|
_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:
|
// 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))));
|
//_keyboard.AttachEffect(new AudioSpectrumEffect(_soundDataProcessor, new LinearGradient(new GradientStop(0f, Color.Blue), new GradientStop(1f, Color.Red))));
|
||||||
|
|
||||||
|
|||||||
@ -33,10 +33,6 @@ namespace Example_AudioAnalyzer_full
|
|||||||
|
|
||||||
public override void Update(float deltaTime)
|
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;
|
_audioSpectrumBrush.BarData = _dataProcessor.BarValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,9 +41,6 @@ namespace Example_AudioAnalyzer_full
|
|||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
// calculate new data ...
|
|
||||||
_dataProcessor.Process();
|
|
||||||
|
|
||||||
// ... update the effect-data ...
|
// ... update the effect-data ...
|
||||||
if (_dataProcessor.SongBeat >= SONG_BEAT_THRESHOLD)
|
if (_dataProcessor.SongBeat >= SONG_BEAT_THRESHOLD)
|
||||||
_currentEffect = FLASH_DURATION;
|
_currentEffect = FLASH_DURATION;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user