master 008fd65c08da cached
109 files
373.6 KB
78.4k tokens
376 symbols
1 requests
Download .txt
Showing preview only (406K chars total). Download the full file or copy to clipboard to get everything.
Repository: DarthAffe/KeyboardAudioVisualizer
Branch: master
Commit: 008fd65c08da
Files: 109
Total size: 373.6 KB

Directory structure:
gitextract_124yql35/

├── .gitattributes
├── .gitignore
├── KeyboardAudioVisualizer/
│   ├── App.config
│   ├── App.xaml
│   ├── App.xaml.cs
│   ├── ApplicationManager.cs
│   ├── Attached/
│   │   ├── SliderValue.cs
│   │   └── SliderValueAdorner.cs
│   ├── Attributes/
│   │   ├── DisplayNameAttribute.cs
│   │   └── VisualizerForAttribute.cs
│   ├── AudioCapture/
│   │   ├── AudioBuffer.cs
│   │   ├── CSCoreAudioInput.cs
│   │   └── IAudioInput.cs
│   ├── AudioProcessing/
│   │   ├── AbstractAudioProcessor.cs
│   │   ├── AudioVisualizationFactory.cs
│   │   ├── Equalizer/
│   │   │   ├── EqualizerBand.cs
│   │   │   ├── IEqualizer.cs
│   │   │   └── MultiBandEqualizer.cs
│   │   ├── IAudioProcessor.cs
│   │   ├── Spectrum/
│   │   │   ├── AbstractSpectrum.cs
│   │   │   ├── Band.cs
│   │   │   ├── FourierSpectrumProvider.cs
│   │   │   ├── GammaSpectrum.cs
│   │   │   ├── ISpectrum.cs
│   │   │   ├── ISpectrumProvider.cs
│   │   │   ├── LinearSpectrum.cs
│   │   │   ├── LogarithmicSpectrum.cs
│   │   │   └── RawSpectrumProvider.cs
│   │   ├── VisualizationPRovider/
│   │   │   ├── FrequencyBarsVisualizationProvider.cs
│   │   │   └── IVisualizationProvider.cs
│   │   └── VisualizationProvider/
│   │       ├── BeatVisualizationProvider.cs
│   │       ├── LevelVisualizationProvider.cs
│   │       └── VisualizationType.cs
│   ├── Configuration/
│   │   ├── AbstractConfiguration.cs
│   │   ├── ColorSerializer.cs
│   │   ├── EqualizerConfiguration.cs
│   │   ├── IConfiguration.cs
│   │   └── Settings.cs
│   ├── Controls/
│   │   ├── BlurredDecorationWindow.cs
│   │   ├── ColorSelector.cs
│   │   ├── Form.cs
│   │   ├── GradientEditor.cs
│   │   └── ImageButton.cs
│   ├── Converter/
│   │   ├── BoolToVisibilityConverter.cs
│   │   ├── EqualizerBandsToPointsConverter.cs
│   │   ├── EqualsToBoolConverter.cs
│   │   ├── OffsetToPosXConverter.cs
│   │   ├── ValueToPosYConverter.cs
│   │   ├── VisualizationProviderDisplayNameConverter.cs
│   │   ├── VisualizationToLastChildFillConverter.cs
│   │   └── VisualizationTypeSelectableConverter.cs
│   ├── Decorators/
│   │   ├── BeatDecorator.cs
│   │   ├── FrequencyBarsDecorator.cs
│   │   └── LevelBarDecorator.cs
│   ├── Helper/
│   │   ├── ActionCommand.cs
│   │   ├── EnumExtension.cs
│   │   ├── ExceptionExtension.cs
│   │   ├── FrequencyHelper.cs
│   │   ├── MathHelper.cs
│   │   ├── ObservableDictionary.cs
│   │   ├── RingBuffer.cs
│   │   ├── VisualizationIndex.cs
│   │   └── WPFHelper.cs
│   ├── KeyboardAudioVisualizer.csproj
│   ├── KeyboardAudioVisualizer.csproj.DotSettings
│   ├── Legacy/
│   │   ├── ConfigurationMigrator.cs
│   │   ├── ConfigurationUpdates.cs
│   │   ├── SerializationHelper.cs
│   │   └── Settings.cs
│   ├── Properties/
│   │   ├── AssemblyInfo.cs
│   │   ├── Resources.Designer.cs
│   │   ├── Resources.resx
│   │   ├── Settings.Designer.cs
│   │   └── Settings.settings
│   ├── Resources/
│   │   └── KeyboardAudioVisualizer.xaml
│   ├── Styles/
│   │   ├── BlurredDecorationWindow.xaml
│   │   ├── Button.xaml
│   │   ├── CachedResourceDictionary.cs
│   │   ├── ColorSelector.xaml
│   │   ├── ComboBox.xaml
│   │   ├── Form.xaml
│   │   ├── FrameworkElement.xaml
│   │   ├── GradientEditor.xaml
│   │   ├── GroupBox.xaml
│   │   ├── ImageButton.xaml
│   │   ├── Navigation.xaml
│   │   ├── Slider.xaml
│   │   ├── Theme.xaml
│   │   └── ToolTip.xaml
│   ├── UI/
│   │   ├── Configuration/
│   │   │   ├── BeatConfiguration.xaml
│   │   │   ├── FrequencyBarsConfiguration.xaml
│   │   │   └── LevelConfiguration.xaml
│   │   ├── ConfigurationViewModel.cs
│   │   ├── ConfigurationWindow.xaml
│   │   ├── ConfigurationWindow.xaml.cs
│   │   └── Visualization/
│   │       ├── BeatVisualization.xaml
│   │       ├── BeatVisualizer.cs
│   │       ├── EqualizerVisualization.xaml
│   │       ├── EqualizerVisualizer.cs
│   │       ├── FrequencyBarsVisualization.xaml
│   │       ├── FrequencyBarsVisualizer.cs
│   │       ├── LevelVisualization.xaml
│   │       └── LevelVisualizer.cs
│   └── packages.config
├── KeyboardAudioVisualizer.sln
├── KeyboardAudioVisualizer.sln.DotSettings
├── LICENSE
├── NuGet.Config
└── README.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs     diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following 
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln       merge=binary
#*.csproj    merge=binary
#*.vbproj    merge=binary
#*.vcxproj   merge=binary
#*.vcproj    merge=binary
#*.dbproj    merge=binary
#*.fsproj    merge=binary
#*.lsproj    merge=binary
#*.wixproj   merge=binary
#*.modelproj merge=binary
#*.sqlproj   merge=binary
#*.wwaproj   merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg   binary
#*.png   binary
#*.gif   binary

###############################################################################
# diff behavior for common document formats
# 
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the 
# entries below.
###############################################################################
#*.doc   diff=astextplain
#*.DOC   diff=astextplain
#*.docx  diff=astextplain
#*.DOCX  diff=astextplain
#*.dot   diff=astextplain
#*.DOT   diff=astextplain
#*.pdf   diff=astextplain
#*.PDF   diff=astextplain
#*.rtf   diff=astextplain
#*.RTF   diff=astextplain


================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Typescript v1 declaration files
typings/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs


================================================
FILE: KeyboardAudioVisualizer/App.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

================================================
FILE: KeyboardAudioVisualizer/App.xaml
================================================
<Application x:Class="KeyboardAudioVisualizer.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:tb="http://www.hardcodet.net/taskbar"
             xmlns:keyboardAudioVisualizer="clr-namespace:KeyboardAudioVisualizer"
             xmlns:styles="clr-namespace:KeyboardAudioVisualizer.Styles"
             ShutdownMode="OnExplicitShutdown">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <styles:CachedResourceDictionary Source="/KeyboardAudioVisualizer;component/Resources/KeyboardAudioVisualizer.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <tb:TaskbarIcon x:Key="TaskbarIcon"
                            IconSource="Resources/Icon.ico"
                            ToolTip="Keyboard Audio-Visualizer"
                            MenuActivation="RightClick">
                <tb:TaskbarIcon.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Open Configuration" Command="{Binding Source={x:Static keyboardAudioVisualizer:ApplicationManager.Instance}, Path=OpenConfigurationCommand}" />
                        <MenuItem Header="Exit" Command="{Binding Source={x:Static keyboardAudioVisualizer:ApplicationManager.Instance}, Path=ExitCommand}" />
                    </ContextMenu>
                </tb:TaskbarIcon.ContextMenu>
            </tb:TaskbarIcon>
        </ResourceDictionary>
    </Application.Resources>
</Application>


================================================
FILE: KeyboardAudioVisualizer/App.xaml.cs
================================================
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Hardcodet.Wpf.TaskbarNotification;
using KeyboardAudioVisualizer.AudioProcessing;
using KeyboardAudioVisualizer.Configuration;
using KeyboardAudioVisualizer.Helper;
using KeyboardAudioVisualizer.Legacy;
using Newtonsoft.Json;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;
using Settings = KeyboardAudioVisualizer.Configuration.Settings;

namespace KeyboardAudioVisualizer
{
    public partial class App : Application
    {
        #region Constants

        private const string PATH_SETTINGS = "Settings.json";

        #endregion

        #region Properties & Fields

        private TaskbarIcon _taskbarIcon;

        #endregion

        #region Methods

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            try
            {
                ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(int.MaxValue));

                _taskbarIcon = (TaskbarIcon)FindResource("TaskbarIcon");
                _taskbarIcon.DoubleClickCommand = ApplicationManager.Instance.OpenConfigurationCommand;

                //Settings settings = SerializationHelper.LoadObjectFromFile<Settings>(PATH_SETTINGS);
                Settings settings = null;
                try { settings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(PATH_SETTINGS), new ColorSerializer()); }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    /* File doesn't exist or is corrupt - just create a new one. */
                }

                if (settings == null)
                    settings = ConfigurationMigrator.MigrateOldConfig();

                if (settings == null)
                {
                    settings = new Settings
                    {
                        Version = Settings.CURRENT_VERSION,
                        Background = new LinearGradient(new GradientStop(0.5, new Color(64, 0, 0, 0)))
                    };
                    _taskbarIcon.ShowBalloonTip("Keyboard Audio-Visualizer is starting in the tray!", "Click on the icon to open the configuration.", BalloonIcon.Info);
                }
                else if (settings.Version != Settings.CURRENT_VERSION)
                    ConfigurationUpdates.PerformOn(settings);

                ApplicationManager.Instance.Settings = settings;

                AudioVisualizationFactory.Initialize();
                ApplicationManager.Instance.InitializeDevices();
            }
            catch (Exception ex)
            {
                File.WriteAllText("error.log", $"[{DateTime.Now:G}] Exception!\r\n\r\nMessage:\r\n{ex.GetFullMessage()}\r\n\r\nStackTrace:\r\n{ex.StackTrace}\r\n\r\n");
                MessageBox.Show("An error occured while starting the Keyboard Audio-Visualizer.\r\nPlease double check if SDK-support for your devices is enabled.\r\nMore information can be found in the error.log file in the application directory.", "Can't start Keyboard Audio-Visualizer.");

                try { ApplicationManager.Instance.ExitCommand.Execute(null); }
                catch { Environment.Exit(0); }
            }
        }

        protected override void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);

            File.WriteAllText(PATH_SETTINGS, JsonConvert.SerializeObject(ApplicationManager.Instance.Settings, new ColorSerializer()));
            ConfigurationMigrator.CleanupOldConfigs();
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/ApplicationManager.cs
================================================
using System.Collections.Generic;
using System.Windows;
using KeyboardAudioVisualizer.AudioProcessing;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using KeyboardAudioVisualizer.Configuration;
using KeyboardAudioVisualizer.Decorators;
using KeyboardAudioVisualizer.Helper;
using KeyboardAudioVisualizer.UI;
using RGB.NET.Brushes;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster;
using RGB.NET.Devices.Corsair;
using RGB.NET.Devices.Logitech;
using RGB.NET.Devices.Novation;
using RGB.NET.Devices.Razer;
using RGB.NET.Devices.SteelSeries;
using RGB.NET.Groups;
using Point = RGB.NET.Core.Point;
using GetDecoratorFunc = System.Func<KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider.VisualizationType, KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider.IVisualizationProvider, RGB.NET.Core.IBrushDecorator>;

namespace KeyboardAudioVisualizer
{
    public class ApplicationManager
    {
        #region Constants
        #endregion

        #region Properties & Fields

        public static ApplicationManager Instance { get; } = new ApplicationManager();

        private ConfigurationWindow _configurationWindow;

        public Settings Settings { get; set; }

        public ObservableDictionary<VisualizationIndex, IVisualizationProvider> Visualizations { get; } = new ObservableDictionary<VisualizationIndex, IVisualizationProvider>();

        private readonly Dictionary<VisualizationIndex, IEnumerable<(ILedGroup group, GetDecoratorFunc getDecoratorFunc)>> _groups = new Dictionary<VisualizationIndex, IEnumerable<(ILedGroup group, GetDecoratorFunc getDecoratorFunc)>>();

        public TimerUpdateTrigger UpdateTrigger { get; } = new TimerUpdateTrigger();

        #endregion

        #region Commands

        private ActionCommand _openConfiguration;
        public ActionCommand OpenConfigurationCommand => _openConfiguration ?? (_openConfiguration = new ActionCommand(OpenConfiguration));

        private ActionCommand _exitCommand;
        public ActionCommand ExitCommand => _exitCommand ?? (_exitCommand = new ActionCommand(Exit));

        #endregion

        #region Constructors

        private ApplicationManager() { }

        #endregion

        #region Methods

        public void InitializeDevices()
        {
            RGBSurface surface = RGBSurface.Instance;

            UpdateTrigger.UpdateFrequency = 1.0 / MathHelper.Clamp(Settings.UpdateRate, 1, 60);
            surface.RegisterUpdateTrigger(UpdateTrigger);

            LoadDevices(surface, CorsairDeviceProvider.Instance);
            LoadDevices(surface, CoolerMasterDeviceProvider.Instance);
            LoadDevices(surface, NovationDeviceProvider.Instance);
            LoadDevices(surface, RazerDeviceProvider.Instance);
            LoadDevices(surface, LogitechDeviceProvider.Instance);
            LoadDevices(surface, SteelSeriesDeviceProvider.Instance);

            surface.AlignDevices();

            ILedGroup background = new ListLedGroup(surface.Leds);
            background.Brush = new LinearGradientBrush(Settings.Background);

            LinearGradient primaryGradient = Settings[VisualizationIndex.Primary].Gradient;
            LinearGradient secondaryGradient = Settings[VisualizationIndex.Secondary].Gradient;
            LinearGradient tertiaryGradient = Settings[VisualizationIndex.Tertiary].Gradient;

            List<(ILedGroup, GetDecoratorFunc)> primaryGroups = new List<(ILedGroup, GetDecoratorFunc)>();
            List<(ILedGroup, GetDecoratorFunc)> secondaryGroups = new List<(ILedGroup, GetDecoratorFunc)>();
            List<(ILedGroup, GetDecoratorFunc)> tertiaryGroups = new List<(ILedGroup, GetDecoratorFunc)>();
            foreach (IRGBDevice device in RGBSurface.Instance.Devices)
                switch (device.DeviceInfo.DeviceType)
                {
                    case RGBDeviceType.Keyboard:
                    case RGBDeviceType.Keypad:
                    case RGBDeviceType.LedMatrix:
                        ListLedGroup primary = new ListLedGroup(device);

                        LightbarSpecialPart lightbar = device.GetSpecialDevicePart<LightbarSpecialPart>();
                        if (lightbar != null)
                        {
                            primary.RemoveLeds(lightbar.Leds);

                            ILedGroup lightbarLeft = new ListLedGroup(lightbar.Left);
                            lightbarLeft.Brush = new LinearGradientBrush(new Point(1.0, 0.5), new Point(0.0, 0.5), tertiaryGradient);
                            tertiaryGroups.Add((lightbarLeft, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer, LevelBarDirection.Left, 0)));

                            ILedGroup lightbarRight = new ListLedGroup(lightbar.Right);
                            lightbarRight.Brush = new LinearGradientBrush(tertiaryGradient);
                            tertiaryGroups.Add((lightbarRight, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer, LevelBarDirection.Right, 1)));

                            ILedGroup lightbarCenter = new ListLedGroup(lightbar.Center);
                            lightbarCenter.Brush = new LinearGradientBrush(secondaryGradient);
                            secondaryGroups.Add((lightbarCenter, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer)));
                        }

                        primary.Brush = new LinearGradientBrush(primaryGradient);
                        primaryGroups.Add((primary, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer, LevelBarDirection.Horizontal, 0, primaryGradient)));
                        break;

                    case RGBDeviceType.Mousepad:
                    case RGBDeviceType.LedStripe:
                    case RGBDeviceType.HeadsetStand:
                        ILedGroup left = new RectangleLedGroup(new Rectangle(device.Location.X, device.Location.Y, device.Size.Width / 2.0, device.Size.Height));
                        left.Brush = new LinearGradientBrush(new Point(0.5, 1), new Point(0.5, 0), tertiaryGradient);
                        tertiaryGroups.Add((left, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer, LevelBarDirection.Top, 0)));

                        ILedGroup right = new RectangleLedGroup(new Rectangle(device.Location.X + (device.Size.Width / 2.0), device.Location.Y, device.Size.Width / 2.0, device.Size.Height));
                        right.Brush = new LinearGradientBrush(new Point(0.5, 1), new Point(0.5, 0), tertiaryGradient);
                        tertiaryGroups.Add((right, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer, LevelBarDirection.Top, 1)));
                        break;

                    case RGBDeviceType.Mouse:
                    case RGBDeviceType.Headset:
                    case RGBDeviceType.Speaker:
                    case RGBDeviceType.Fan:
                    case RGBDeviceType.GraphicsCard:
                    case RGBDeviceType.DRAM:
                    case RGBDeviceType.Mainboard:
                        ILedGroup deviceGroup = new ListLedGroup(device);
                        deviceGroup.Brush = new LinearGradientBrush(secondaryGradient);
                        secondaryGroups.Add((deviceGroup, (visualizationType, visualizer) => CreateDecorator(visualizationType, visualizer)));
                        break;
                }

            _groups[VisualizationIndex.Primary] = primaryGroups;
            _groups[VisualizationIndex.Secondary] = secondaryGroups;
            _groups[VisualizationIndex.Tertiary] = tertiaryGroups;

            ApplyVisualization(VisualizationIndex.Primary, Settings[VisualizationIndex.Primary].SelectedVisualization);
            ApplyVisualization(VisualizationIndex.Secondary, Settings[VisualizationIndex.Secondary].SelectedVisualization);
            ApplyVisualization(VisualizationIndex.Tertiary, Settings[VisualizationIndex.Tertiary].SelectedVisualization);

            surface.Updating += args => AudioVisualizationFactory.Instance.Update();
        }

        private void LoadDevices(RGBSurface surface, IRGBDeviceProvider deviceProvider)
        {
            surface.LoadDevices(deviceProvider, RGBDeviceType.Keyboard | RGBDeviceType.LedMatrix
                                              | RGBDeviceType.Mousepad | RGBDeviceType.LedStripe
                                              | RGBDeviceType.Mouse | RGBDeviceType.Headset
                                              | RGBDeviceType.HeadsetStand);
        }

        //TODO DarthAffe 12.09.2017: This is just a big mess - is this worth to rework before arge?
        public void ApplyVisualization(VisualizationIndex visualizationIndex, VisualizationType visualizationType)
        {
            IVisualizationProvider visualizer = AudioVisualizationFactory.Instance.CreateVisualizationProvider(visualizationIndex, visualizationType);
            Visualizations[visualizationIndex] = visualizer;

            foreach ((ILedGroup group, GetDecoratorFunc getDecoratorFunc) in _groups[visualizationIndex])
            {
                group.Brush.RemoveAllDecorators();

                if (visualizer != null)
                {
                    IBrushDecorator decorator = getDecoratorFunc(visualizationType, visualizer);
                    if (decorator != null)
                        group.Brush.AddDecorator(decorator);
                }
            }
        }

        private IBrushDecorator CreateDecorator(VisualizationType visualizationType, IVisualizationProvider visualizationProvider, LevelBarDirection direction = LevelBarDirection.Top, int dataIndex = 0, LinearGradient gradient = null)
        {
            if (visualizationType == VisualizationType.FrequencyBars)
                return new FrequencyBarsDecorator(visualizationProvider);

            if (visualizationType == VisualizationType.Level)
                return new LevelBarDecorator(visualizationProvider, direction, dataIndex, gradient);

            if (visualizationType == VisualizationType.Beat)
                return new BeatDecorator(visualizationProvider);

            return null;
        }

        private void OpenConfiguration()
        {
            if (_configurationWindow == null) _configurationWindow = new ConfigurationWindow();
            _configurationWindow.Show();
        }

        private void Exit()
        {
            try { AudioVisualizationFactory.Instance?.Dispose(); } catch { }
            try { RGBSurface.Instance?.Dispose(); } catch { }
            Application.Current.Shutdown();
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Attached/SliderValue.cs
================================================
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;

namespace KeyboardAudioVisualizer.Attached
{
    public static class SliderValue
    {
        #region Properties & Fields
        // ReSharper disable InconsistentNaming

        public static readonly DependencyProperty UnitProperty = DependencyProperty.RegisterAttached(
            "Unit", typeof(string), typeof(SliderValue), new PropertyMetadata(default(string)));

        public static void SetUnit(DependencyObject element, string value) => element.SetValue(UnitProperty, value);
        public static string GetUnit(DependencyObject element) => (string)element.GetValue(UnitProperty);

        public static readonly DependencyProperty IsShownProperty = DependencyProperty.RegisterAttached(
            "IsShown", typeof(bool), typeof(SliderValue), new PropertyMetadata(default(bool), IsShownChanged));

        public static void SetIsShown(DependencyObject element, bool value) => element.SetValue(IsShownProperty, value);
        public static bool GetIsShown(DependencyObject element) => (bool)element.GetValue(IsShownProperty);

        public static readonly DependencyProperty BorderBrushProperty = DependencyProperty.RegisterAttached(
            "BorderBrush", typeof(Brush), typeof(SliderValue), new PropertyMetadata(default(Brush)));

        public static void SetBorderBrush(DependencyObject element, Brush value) => element.SetValue(BorderBrushProperty, value);
        public static Brush GetBorderBrush(DependencyObject element) => (Brush)element.GetValue(BorderBrushProperty);

        public static readonly DependencyProperty BackgroundProperty = DependencyProperty.RegisterAttached(
            "Background", typeof(Brush), typeof(SliderValue), new PropertyMetadata(default(Brush)));

        public static void SetBackground(DependencyObject element, Brush value) => element.SetValue(BackgroundProperty, value);
        public static Brush GetBackground(DependencyObject element) => (Brush)element.GetValue(BackgroundProperty);

        public static readonly DependencyProperty ForegroundProperty = DependencyProperty.RegisterAttached(
            "Foreground", typeof(Brush), typeof(SliderValue), new PropertyMetadata(default(Brush)));

        public static void SetForeground(DependencyObject element, Brush value) => element.SetValue(ForegroundProperty, value);
        public static Brush GetForeground(DependencyObject element) => (Brush)element.GetValue(ForegroundProperty);

        public static readonly DependencyProperty FontProperty = DependencyProperty.RegisterAttached(
            "Font", typeof(FontFamily), typeof(SliderValue), new PropertyMetadata(default(FontFamily)));

        public static void SetFont(DependencyObject element, FontFamily value) => element.SetValue(FontProperty, value);
        public static FontFamily GetFont(DependencyObject element) => (FontFamily)element.GetValue(FontProperty);

        public static readonly DependencyProperty FontSizeProperty = DependencyProperty.RegisterAttached(
            "FontSize", typeof(double), typeof(SliderValue), new PropertyMetadata(default(double)));

        public static void SetFontSize(DependencyObject element, double value) => element.SetValue(FontSizeProperty, value);
        public static double GetFontSize(DependencyObject element) => (double)element.GetValue(FontSizeProperty);

        // ReSharper enable InconsistentNaming
        #endregion

        #region Methods

        private static void IsShownChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (!(dependencyObject is Slider slider)) return;

            if (dependencyPropertyChangedEventArgs.NewValue as bool? == true)
            {
                slider.MouseEnter += SliderOnMouseEnter;
                slider.MouseLeave += SliderOnMouseLeave;
            }
            else
            {
                slider.MouseEnter -= SliderOnMouseEnter;
                slider.MouseLeave -= SliderOnMouseLeave;
                RemoveAdorner(slider);
            }
        }

        private static void SliderOnMouseEnter(object sender, MouseEventArgs mouseEventArgs)
        {
            if (!(sender is Slider slider)) return;
            AdornerLayer.GetAdornerLayer(slider)?.Add(new SliderValueAdorner(slider, GetUnit(slider))
            {
                BorderBrush = GetBorderBrush(slider),
                Background = GetBackground(slider),
                Foreground = GetForeground(slider),
                Font = GetFont(slider),
                FontSize = GetFontSize(slider)
            });
        }

        private static void SliderOnMouseLeave(object sender, MouseEventArgs mouseEventArgs)
        {
            if (!(sender is Slider slider)) return;
            RemoveAdorner(slider);
        }

        private static void RemoveAdorner(Slider slider)
        {
            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(slider);
            Adorner adorner = adornerLayer?.GetAdorners(slider)?.FirstOrDefault(x => x is SliderValueAdorner);
            if (adorner != null)
            {
                adornerLayer.Remove(adorner);
                (adorner as SliderValueAdorner)?.Cleanup();
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Attached/SliderValueAdorner.cs
================================================
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Point = System.Windows.Point;

namespace KeyboardAudioVisualizer.Attached
{
    public class SliderValueAdorner : System.Windows.Documents.Adorner
    {
        #region Properties & Fields

        private readonly string _unit;
        private readonly Slider _slider;
        private readonly Thumb _thumb;
        private readonly RepeatButton _decreaseRepeatButton;

        public Brush BorderBrush { get; set; } = Brushes.Black;
        public Brush Background { get; set; } = Brushes.Black;
        public Brush Foreground { get; set; } = Brushes.White;
        public FontFamily Font { get; set; } = new FontFamily("Verdana");
        public double FontSize { get; set; } = 14;

        #endregion

        #region Constructors

        public SliderValueAdorner(UIElement adornedElement, string unit)
            : base(adornedElement)
        {
            this._unit = unit;

            _slider = (Slider)adornedElement;
            Track track = (Track)_slider.Template.FindName("PART_Track", _slider);

            _thumb = track.Thumb;
            _decreaseRepeatButton = track.DecreaseRepeatButton;
            _decreaseRepeatButton.SizeChanged += OnButtonSizeChanged;
        }

        #endregion

        #region Methods

        public void Cleanup()
        {
            _decreaseRepeatButton.SizeChanged -= OnButtonSizeChanged;
        }

        private void OnButtonSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs) => InvalidateVisual();

        protected override void OnRender(DrawingContext drawingContext)
        {
            double offset = _decreaseRepeatButton.ActualWidth + (_thumb.ActualWidth / 2.0);

            FormattedText text = new FormattedText(GetText(), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(Font, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal), FontSize, Foreground);
            Geometry border = CreateBorder(offset, text.Width, text.Height);

            drawingContext.DrawGeometry(Background, new Pen(BorderBrush, 1), border);
            drawingContext.DrawText(text, new Point(offset - (text.Width / 2.0), -26));
        }

        private string GetText()
        {
            string valueText = _slider.Value.ToString();
            if (!string.IsNullOrWhiteSpace(_unit))
                valueText += " " + _unit;

            return valueText;
        }

        private Geometry CreateBorder(double offset, double width, double height)
        {
            double halfWidth = width / 2.0;

            PathGeometry borderGeometry = new PathGeometry();
            PathFigure border = new PathFigure
            {
                StartPoint = new Point(offset, 0),
                IsClosed = true,
                IsFilled = true
            };

            border.Segments.Add(new LineSegment(new Point(offset + 4, -6), true));
            border.Segments.Add(new LineSegment(new Point(offset + 4 + halfWidth, -6), true));
            border.Segments.Add(new LineSegment(new Point(offset + 4 + halfWidth, -10 - height), true));
            border.Segments.Add(new LineSegment(new Point(offset - 4 - halfWidth, -10 - height), true));
            border.Segments.Add(new LineSegment(new Point(offset - 4 - halfWidth, -6), true));
            border.Segments.Add(new LineSegment(new Point(offset - 4, -6), true));

            borderGeometry.Figures.Add(border);

            return borderGeometry;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Attributes/DisplayNameAttribute.cs
================================================
using System;

namespace KeyboardAudioVisualizer.Attributes
{
    public class DisplayNameAttribute : Attribute
    {
        #region Properties & Fields

        public string DisplayName { get; set; }

        #endregion

        #region Constructors

        public DisplayNameAttribute(string displayName)
        {
            this.DisplayName = displayName;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Attributes/VisualizerForAttribute.cs
================================================
using System;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Attributes
{
    public class VisualizerForAttribute : Attribute
    {
        #region Properties & Fields

        public RGBDeviceType VisualizerFor { get; set; }

        #endregion

        #region Constructors

        public VisualizerForAttribute(RGBDeviceType visualizerFor)
        {
            this.VisualizerFor = visualizerFor;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioCapture/AudioBuffer.cs
================================================
using System;

namespace KeyboardAudioVisualizer.AudioCapture
{
    public class AudioBuffer
    {
        #region Properties & Fields

        private readonly int _capacity;
        private readonly float[] _bufferLeft;
        private readonly float[] _bufferRight;
        private int _currentIndex;

        public int Size => _capacity;

        public float? Prescale { get; set; } = null;

        #endregion

        #region Constructors

        public AudioBuffer(int capacity)
        {
            this._capacity = capacity;

            _bufferLeft = new float[capacity];
            _bufferRight = new float[capacity];
        }

        #endregion

        #region Methods

        public void Put(float left, float right)
        {
            _currentIndex++;
            if (_currentIndex >= _capacity) _currentIndex = 0;

            _bufferLeft[_currentIndex] = left;
            _bufferRight[_currentIndex] = right;
        }

        public void Put(float[] src, int offset, int count)
        {
            if ((count & 1) != 0) return; // we expect stereo-data to be an even amount of values

            if (count > _capacity)
            {
                offset += count - _capacity;
                count = _capacity;
            }

            for (int i = 0; i < count; i += 2)
            {
                _currentIndex++;
                if (_currentIndex >= _capacity) _currentIndex = 0;

                if (Prescale.HasValue)
                {
                    _bufferLeft[_currentIndex] = src[offset + i] / Prescale.Value;
                    _bufferRight[_currentIndex] = src[offset + i + 1] / Prescale.Value;
                }
                else
                {
                    _bufferLeft[_currentIndex] = src[offset + i];
                    _bufferRight[_currentIndex] = src[offset + i + 1];
                }
            }
        }

        public void CopyLeftInto(ref float[] data, int offset) => CopyLeftInto(ref data, offset, Math.Min(data.Length, _capacity));
        public void CopyLeftInto(ref float[] data, int offset, int count)
        {
            int bufferOffset = _capacity - count;
            for (int i = 0; i < count; i++)
                data[offset + i] = _bufferLeft[(_currentIndex + (bufferOffset + i)) % _capacity];
        }

        public void CopyRightInto(ref float[] data, int offset) => CopyRightInto(ref data, offset, Math.Min(data.Length, _capacity));
        public void CopyRightInto(ref float[] data, int offset, int count)
        {
            int bufferOffset = _capacity - count;
            for (int i = 0; i < count; i++)
                data[offset + i] = _bufferRight[(_currentIndex + (bufferOffset + i)) % _capacity];
        }

        public void CopyMixInto(ref float[] data, int offset) => CopyMixInto(ref data, offset, Math.Min(data.Length, _capacity));
        public void CopyMixInto(ref float[] data, int offset, int count)
        {
            int bufferOffset = _capacity - count;
            for (int i = 0; i < count; i++)
            {
                int index = (_currentIndex + (bufferOffset + i)) % _capacity;
                data[offset + i] = (_bufferLeft[index] + _bufferRight[index]) / 2f;
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioCapture/CSCoreAudioInput.cs
================================================
using System;
using CSCore;
using CSCore.CoreAudioAPI;
using CSCore.SoundIn;
using CSCore.Streams;

namespace KeyboardAudioVisualizer.AudioCapture
{
    public class CSCoreAudioInput : IAudioInput
    {
        #region Properties & Fields

        private WasapiCapture _capture;
        private SoundInSource _soundInSource;
        private IWaveSource _source;
        private SingleBlockNotificationStream _stream;
        private AudioEndpointVolume _audioEndpointVolume;

        public int SampleRate => _soundInSource?.WaveFormat?.SampleRate ?? -1;
        public float MasterVolume => _audioEndpointVolume.MasterVolumeLevelScalar;

        #endregion

        #region Event

        public event AudioData DataAvailable;

        #endregion

        #region Methods

        public void Initialize()
        {
            MMDevice captureDevice = MMDeviceEnumerator.DefaultAudioEndpoint(DataFlow.Render, Role.Console);
            WaveFormat deviceFormat = captureDevice.DeviceFormat;
            _audioEndpointVolume = AudioEndpointVolume.FromDevice(captureDevice);

            //DarthAffe 07.02.2018: This is a really stupid workaround to (hopefully) finally fix the surround driver issues
            for (int i = 1; i < 13; i++)
                try { _capture = new WasapiLoopbackCapture(100, new WaveFormat(deviceFormat.SampleRate, deviceFormat.BitsPerSample, i)); } catch { /* We're just trying ... */ }

            if (_capture == null)
                throw new NullReferenceException("Failed to initialize WasapiLoopbackCapture");

            _capture.Initialize();

            _soundInSource = new SoundInSource(_capture) { FillWithZeros = false };
            _source = _soundInSource.WaveFormat.SampleRate == 44100
                          ? _soundInSource.ToStereo()
                          : _soundInSource.ChangeSampleRate(44100).ToStereo();

            _stream = new SingleBlockNotificationStream(_source.ToSampleSource());
            _stream.SingleBlockRead += StreamOnSingleBlockRead;

            _source = _stream.ToWaveSource();

            byte[] buffer = new byte[_source.WaveFormat.BytesPerSecond / 2];
            _soundInSource.DataAvailable += (s, aEvent) =>
                                            {
                                                while ((_source.Read(buffer, 0, buffer.Length)) > 0) ;
                                            };

            _capture.Start();
        }

        public void Dispose()
        {
            _capture?.Stop();
            _capture?.Dispose();
        }

        private void StreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs singleBlockReadEventArgs)
            => DataAvailable?.Invoke(singleBlockReadEventArgs.Left, singleBlockReadEventArgs.Right);

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioCapture/IAudioInput.cs
================================================
using System;

namespace KeyboardAudioVisualizer.AudioCapture
{
    public delegate void AudioData(float left, float right);

    public interface IAudioInput : IDisposable
    {
        int SampleRate { get; }
        float MasterVolume { get; }

        event AudioData DataAvailable;

        void Initialize();
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/AbstractAudioProcessor.cs
================================================
namespace KeyboardAudioVisualizer.AudioProcessing
{
    public abstract class AbstractAudioProcessor : IAudioProcessor
    {
        #region Properties & Fields

        public bool IsActive { get; set; } = true;

        #endregion

        #region Methods

        public abstract void Initialize();

        public abstract void Update();

        public virtual void Dispose() { }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/AudioVisualizationFactory.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using KeyboardAudioVisualizer.AudioCapture;
using KeyboardAudioVisualizer.AudioProcessing.Equalizer;
using KeyboardAudioVisualizer.AudioProcessing.Spectrum;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing
{
    public class AudioVisualizationFactory : IDisposable
    {
        #region Properties & Fields

        public static AudioVisualizationFactory Instance { get; private set; }

        private IAudioInput _audioInput;
        private AudioBuffer _audioBuffer;
        private readonly List<IAudioProcessor> _processors = new List<IAudioProcessor>();

        #endregion

        #region Constructors

        private AudioVisualizationFactory() { }

        #endregion

        #region Methods

        public void Update()
        {
            if (ApplicationManager.Instance.Settings.EnableAudioPrescale)
                _audioBuffer.Prescale = _audioInput.MasterVolume;
            else
                _audioBuffer.Prescale = null;

            foreach (IAudioProcessor processor in _processors.Where(x => x.IsActive))
                processor.Update();
        }

        public static void Initialize()
        {
            if (Instance != null) return;

            Instance = new AudioVisualizationFactory();
            Instance.InitializeInstance();
        }

        private void InitializeInstance()
        {
            _audioInput = new CSCoreAudioInput();
            _audioInput.Initialize();

            _audioBuffer = new AudioBuffer(4096); // Working with ~93ms - 
            _audioInput.DataAvailable += (left, right) => _audioBuffer.Put(left, right);

            _processors.Add(new FourierSpectrumProvider(_audioBuffer));

            foreach (IAudioProcessor processor in _processors)
                processor.Initialize();
        }

        private T GetAudioProcessor<T>() => (T)_processors.FirstOrDefault(x => x.GetType() == typeof(T));

        public IVisualizationProvider CreateVisualizationProvider(VisualizationIndex visualizationIndex, VisualizationType visualizationType)
        {
            IVisualizationProvider visualizationProvider = default;
            switch (visualizationType)
            {
                case VisualizationType.FrequencyBars:
                    MultiBandEqualizer equalizer = new MultiBandEqualizer();
                    ApplicationManager.Instance.Settings[visualizationIndex].EqualizerConfiguration.LoadInto(equalizer);
                    equalizer.PropertyChanged += (sender, args) => ApplicationManager.Instance.Settings[visualizationIndex].EqualizerConfiguration.SaveFrom(equalizer);
                    visualizationProvider = new FrequencyBarsVisualizationProvider(ApplicationManager.Instance.Settings[visualizationIndex].GetConfiguration<FrequencyBarsVisualizationProviderConfiguration>(visualizationType), GetAudioProcessor<FourierSpectrumProvider>()) { Equalizer = equalizer };
                    break;

                case VisualizationType.Level:
                    visualizationProvider = new LevelVisualizationProvider(ApplicationManager.Instance.Settings[visualizationIndex].GetConfiguration<LevelVisualizationProviderConfiguration>(visualizationType), _audioBuffer);
                    break;

                case VisualizationType.Beat:
                    visualizationProvider = new BeatVisualizationProvider(ApplicationManager.Instance.Settings[visualizationIndex].GetConfiguration<BeatVisualizationProviderConfiguration>(visualizationType), GetAudioProcessor<FourierSpectrumProvider>());
                    break;
            }

            visualizationProvider?.Initialize();
            return visualizationProvider;
        }

        public void Dispose() => _audioInput.Dispose();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/EqualizerBand.cs
================================================
using KeyboardAudioVisualizer.Helper;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.AudioProcessing.Equalizer
{
    public class EqualizerBand : AbstractBindable
    {
        #region Properties & Fields

        private float _offset;
        public float Offset
        {
            get => _offset;
            set
            {
                if (!IsFixedOffset)
                    SetProperty(ref _offset, float.IsNaN(value) ? 0 : MathHelper.Clamp(value, 0, 1));
            }
        }

        private float _value;
        public float Value
        {
            get => _value;
            set => SetProperty(ref _value, float.IsNaN(value) ? 0 : MathHelper.Clamp(value, -1, 1));
        }

        public bool IsFixedOffset { get; set; }

        #endregion

        #region Constructors

        public EqualizerBand() : this(0) { }

        public EqualizerBand(float offset, float value = 0, bool fixedOffset = false)
        {
            this.Offset = offset;
            this.Value = value;
            this.IsFixedOffset = fixedOffset;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/IEqualizer.cs
================================================
using System.Collections.ObjectModel;

namespace KeyboardAudioVisualizer.AudioProcessing.Equalizer
{
    public interface IEqualizer
    {
        bool IsEnabled { get; set; }

        ObservableCollection<EqualizerBand> Bands { get; }
        
        float[] CalculateValues(int count);

        EqualizerBand AddBand(float offset, float modification);
        void RemoveBandBand(EqualizerBand band);

        void Reset();
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/MultiBandEqualizer.cs
================================================
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.AudioProcessing.Equalizer
{
    public class MultiBandEqualizer : AbstractBindable, IEqualizer
    {
        #region Properties & Fields

        public ObservableCollection<EqualizerBand> Bands { get; } = new ObservableCollection<EqualizerBand>();

        private readonly Dictionary<int, float[]> _values = new Dictionary<int, float[]>();

        private bool _isEnabled;
        public bool IsEnabled
        {
            get => _isEnabled;
            set => SetProperty(ref _isEnabled, value);
        }

        #endregion

        #region Constructors

        public MultiBandEqualizer()
        {
            Reset();
        }

        #endregion

        #region Methods

        public EqualizerBand AddBand(float offset, float modification) => AddBand(offset, modification, false);

        public EqualizerBand AddBand(float offset, float modification, bool isFixedFrequency)
        {
            EqualizerBand band = new EqualizerBand(offset, modification, isFixedFrequency);
            band.PropertyChanged += (sender, args) => InvalidateCache();
            Bands.Add(band);

            InvalidateCache();

            return band;
        }

        public void RemoveBandBand(EqualizerBand band)
        {
            if (!band.IsFixedOffset)
                Bands.Remove(band);

            InvalidateCache();
        }

        public void Reset()
        {
            Bands.Clear();
            AddBand(0, 0, true);
            AddBand(1, 0, true);
        }

        public float[] CalculateValues(int count)
        {
            if (!_values.TryGetValue(count, out float[] values))
            {
                values = RecalculateValues(count);
                _values[count] = values;
            }
            return values;
        }

        private float[] RecalculateValues(int count)
        {
            float[] values = new float[count];

            List<EqualizerBand> orderedBands = Bands.OrderBy(x => x.Offset).ToList();
            if (orderedBands.Count < 2) return values;

            for (int i = 0; i < count; i++)
            {
                float offset = (i / (float)count);
                EqualizerBand bandBefore = orderedBands.Last(n => n.Offset <= offset);
                EqualizerBand bandAfter = orderedBands.First(n => n.Offset >= offset);
                offset = (bandAfter.Offset <= 0) || (Math.Abs(bandAfter.Offset - bandBefore.Offset) < 0.0001)
                    ? 0 : (offset - bandBefore.Offset) / (bandAfter.Offset - bandBefore.Offset);
                float value = (float)((3.0 * (offset * offset)) - (2.0 * (offset * offset * offset)));
                values[i] = bandBefore.Value + (value * (bandAfter.Value - bandBefore.Value));
            }

            return values;
        }

        private void InvalidateCache()
        {
            _values.Clear();

            // ReSharper disable once ExplicitCallerInfoArgument
            OnPropertyChanged(nameof(Bands));
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/IAudioProcessor.cs
================================================
using System;

namespace KeyboardAudioVisualizer.AudioProcessing
{
    public interface IAudioProcessor : IDisposable
    {
        bool IsActive { get; set; }

        void Initialize();
        void Update();
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/AbstractSpectrum.cs
================================================
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public abstract class AbstractSpectrum : ISpectrum
    {
        #region Properties & Fields

        protected Band[] Bands { get; set; }
        public int BandCount => Bands.Length;

        public Band this[int index] => Bands[index];
        public Band this[float frequency] => Bands.FirstOrDefault(band => (band.LowerFrequency <= frequency) && (band.UpperFrequency >= frequency));
        public Band[] this[float minFrequency, float maxFrequency] => Bands.Where(band => (band.LowerFrequency > minFrequency) && (band.UpperFrequency < maxFrequency)).ToArray();

        #endregion

        #region Methods

        public IEnumerator<Band> GetEnumerator() => Bands.AsEnumerable().GetEnumerator();
        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/Band.cs
================================================
using System.Linq;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class Band
    {
        #region Properties & Fields

        private readonly float[] _data;
        private readonly float _resolution;

        public float LowerFrequency { get; }
        public float UpperFrequency { get; }
        public float CenterFrequency { get; }

        private float? _average = null;
        public float Average => _average ?? (_average = _data.Average()).Value;

        private float? _min = null;
        public float Min => _min ?? (_min = _data.Min()).Value;

        private float? _max = null;
        public float Max => _max ?? (_max = _data.Max()).Value;

        private float? _sum = null;
        public float Sum => _sum ?? (_sum = _data.Sum()).Value;

        public float this[int index] => _data[index];
        public float this[float frequency] => _data[(int)((frequency - LowerFrequency) / _resolution)];

        #endregion

        #region Constructors

        public Band(float lowerFrequency, float upperFrequency, float[] data)
        {
            this.LowerFrequency = lowerFrequency;
            this.UpperFrequency = upperFrequency;
            this.CenterFrequency = (LowerFrequency + UpperFrequency) / 2f; //TODO DarthAffe 12.08.2017: Is this valid for logarithmic scaling?
            this._data = data;

            _resolution = (UpperFrequency - LowerFrequency) / data.Length;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/FourierSpectrumProvider.cs
================================================
using System;
using KeyboardAudioVisualizer.AudioCapture;
using MathNet.Numerics;
using MathNet.Numerics.IntegralTransforms;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class FourierSpectrumProvider : AbstractAudioProcessor, ISpectrumProvider
    {
        #region Properties & Fields

        private readonly AudioBuffer _audioBuffer;

        private float[] _sampleData;
        private double[] _hamming;
        private Complex32[] _complexBuffer;

        private float[] _spectrum;
        private int _usableDataLength;

        #endregion

        #region Constructors

        public FourierSpectrumProvider(AudioBuffer audioBuffer)
        {
            this._audioBuffer = audioBuffer;
        }

        #endregion

        #region Methods

        public override void Initialize()
        {
            _hamming = Window.Hamming(_audioBuffer.Size);
            _sampleData = new float[_audioBuffer.Size];
            _complexBuffer = new Complex32[_audioBuffer.Size];
            _usableDataLength = (_audioBuffer.Size / 2) + 1;
            _spectrum = new float[_usableDataLength];
        }

        public override void Update()
        {
            _audioBuffer.CopyMixInto(ref _sampleData, 0);

            ApplyHamming(ref _sampleData);
            CreateSpectrum(ref _sampleData);
        }

        private void ApplyHamming(ref float[] data)
        {
            for (int i = 0; i < data.Length; i++)
                data[i] = (float)(data[i] * _hamming[i]);
        }

        private void CreateSpectrum(ref float[] data)
        {
            for (int i = 0; i < data.Length; i++)
                _complexBuffer[i] = new Complex32(data[i], 0);

            Fourier.Forward(_complexBuffer, FourierOptions.NoScaling);

            for (int i = 0; i < _spectrum.Length; i++)
            {
                Complex32 fourierData = _complexBuffer[i];
                _spectrum[i] = (float)Math.Sqrt(fourierData.Real * fourierData.Real) + (fourierData.Imaginary * fourierData.Imaginary);
            }
        }

        public ISpectrum GetLinearSpectrum(int bands = 64, float minFrequency = -1, float maxFrequency = -1) => new LinearSpectrum(_spectrum, bands, minFrequency, maxFrequency);

        public ISpectrum GetLogarithmicSpectrum(int bands = 12, float minFrequency = -1, float maxFrequency = -1) => new LogarithmicSpectrum(_spectrum, bands, minFrequency, maxFrequency);

        public ISpectrum GetGammaSpectrum(int bands = 64, float gamma = 2, float minFrequency = -1, float maxFrequency = -1) => new GammaSpectrum(_spectrum, bands, gamma, minFrequency, maxFrequency);

        public ISpectrum GetRawSpectrum() => new RawSpectrumProvider(_spectrum);

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/GammaSpectrum.cs
================================================
using System;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class GammaSpectrum : AbstractSpectrum
    {
        #region Constructors

        public GammaSpectrum(float[] data, int bands, float gamma = 2, float minFrequency = -1, float maxFrequency = -1)
        {
            int dataReferenceCount = (data.Length - 1) * 2;

            int fromIndex = minFrequency < 0 ? 0 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(minFrequency, dataReferenceCount), 0, data.Length - 1 - bands); // -bands since we need at least enough data to get our bands
            int toIndex = maxFrequency < 0 ? data.Length - 1 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(maxFrequency, dataReferenceCount), fromIndex, data.Length - 1);

            int usableSourceData = Math.Max(bands, (toIndex - fromIndex) + 1);

            Bands = new Band[bands];

            int index = fromIndex;
            for (int i = 0; i < Bands.Length; i++)
            {
                int count = Math.Max(1, (((int)(Math.Pow((i + 1f) / Bands.Length, gamma) * usableSourceData))) - index);

                float[] bandData = new float[count];
                Array.Copy(data, index, bandData, 0, count);
                Bands[i] = new Band(FrequencyHelper.GetFrequencyOfIndex(index, dataReferenceCount),
                                    FrequencyHelper.GetFrequencyOfIndex(index + count, dataReferenceCount),
                                    bandData);

                index += count;
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrum.cs
================================================
using System.Collections.Generic;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public interface ISpectrum : IEnumerable<Band>
    {
        int BandCount { get; }

        Band this[int index] { get; }
        Band this[float frequency] { get; }
        Band[] this[float minFrequency, float maxFrequency] { get; }
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrumProvider.cs
================================================
namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public interface ISpectrumProvider : IAudioProcessor
    {
        ISpectrum GetLinearSpectrum(int bands = 64, float minFrequency = -1, float maxFrequency = -1);
        ISpectrum GetLogarithmicSpectrum(int bands = 1, float minFrequency = -1, float maxFrequency = -1);
        ISpectrum GetGammaSpectrum(int bands = 1, float gamma = 2, float minFrequency = -1, float maxFrequency = -1);
        ISpectrum GetRawSpectrum();
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/LinearSpectrum.cs
================================================
using System;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class LinearSpectrum : AbstractSpectrum
    {
        #region Constructors

        public LinearSpectrum(float[] data, int bands, float minFrequency = -1, float maxFrequency = -1)
        {
            int dataReferenceCount = (data.Length - 1) * 2;

            int fromIndex = minFrequency < 0 ? 0 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(minFrequency, dataReferenceCount), 0, data.Length - 1 - bands); // -bands since we need at least enough data to get our bands
            int toIndex = maxFrequency < 0 ? data.Length - 1 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(maxFrequency, dataReferenceCount), fromIndex, data.Length - 1);

            int usableSourceData = Math.Max(bands, (toIndex - fromIndex) + 1);

            Bands = new Band[bands];

            double frequenciesPerBand = (double)usableSourceData / bands;
            double frequencyCounter = 0;

            int index = fromIndex;
            for (int i = 0; i < Bands.Length; i++)
            {
                frequencyCounter += frequenciesPerBand;
                int count = (int)frequencyCounter;

                float[] bandData = new float[count];
                Array.Copy(data, index, bandData, 0, count);
                Bands[i] = new Band(FrequencyHelper.GetFrequencyOfIndex(index, dataReferenceCount),
                                    FrequencyHelper.GetFrequencyOfIndex(index + count, dataReferenceCount),
                                    bandData);

                index += count;
                frequencyCounter -= count;
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/LogarithmicSpectrum.cs
================================================
using System;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class LogarithmicSpectrum : AbstractSpectrum
    {
        #region Constructors

        public LogarithmicSpectrum(float[] data, int bands, float minFrequency = -1, float maxFrequency = -1)
        {
            int dataReferenceCount = (data.Length - 1) * 2;

            int fromIndex = minFrequency < 0 ? 0 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(minFrequency, dataReferenceCount), 0, data.Length - 1 - bands); // -bands since we need at least enough data to get our bands
            int toIndex = maxFrequency < 0 ? data.Length - 1 : MathHelper.Clamp(FrequencyHelper.GetIndexOfFrequency(maxFrequency, dataReferenceCount), fromIndex, data.Length - 1);

            int usableSourceData = Math.Max(bands, (toIndex - fromIndex) + 1);

            Bands = new Band[bands];

            double ratio = Math.Pow(usableSourceData, 1.0 / bands);
            double calculation = 1;

            int index = fromIndex;
            for (int i = 0; i < Bands.Length; i++)
            {
                calculation *= ratio;
                int count = Math.Max(1, ((int)calculation) - index);

                float[] bandData = new float[count];
                Array.Copy(data, index, bandData, 0, count);
                Bands[i] = new Band(FrequencyHelper.GetFrequencyOfIndex(index, dataReferenceCount),
                                    FrequencyHelper.GetFrequencyOfIndex(index + count, dataReferenceCount),
                                    bandData);

                index += count;
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/RawSpectrumProvider.cs
================================================
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum
{
    public class RawSpectrumProvider : AbstractSpectrum
    {
        #region Constructors

        public RawSpectrumProvider(float[] data)
        {
            int dataReferenceCount = (data.Length - 1) * 2;

            Bands = new Band[data.Length];

            for (int i = 0; i < Bands.Length; i++)
                Bands[i] = new Band(FrequencyHelper.GetFrequencyOfIndex(i, dataReferenceCount), FrequencyHelper.GetFrequencyOfIndex(i, dataReferenceCount), new[] { data[i] });
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/FrequencyBarsVisualizationProvider.cs
================================================
using System;
using KeyboardAudioVisualizer.AudioProcessing.Equalizer;
using KeyboardAudioVisualizer.AudioProcessing.Spectrum;
using KeyboardAudioVisualizer.Configuration;

namespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider
{
    #region Configuration

    public enum ValueMode { Max, Average, Sum }
    public enum SpectrumMode { Gamma, Logarithmic, Linear }

    public class FrequencyBarsVisualizationProviderConfiguration : AbstractConfiguration
    {
        private ValueMode _valueMode = ValueMode.Sum;
        public ValueMode ValueMode
        {
            get => _valueMode;
            set => SetProperty(ref _valueMode, value);
        }

        private SpectrumMode _spectrumMode = SpectrumMode.Logarithmic;
        public SpectrumMode SpectrumMode
        {
            get => _spectrumMode;
            set => SetProperty(ref _spectrumMode, value);
        }

        private int _bars = 48;
        public int Bars
        {
            get => _bars;
            set => SetProperty(ref _bars, value);
        }

        private double _smoothing = 3;
        public double Smoothing
        {
            get => _smoothing;
            set => SetProperty(ref _smoothing, value);
        }

        private double _minFrequency = 60;
        public double MinFrequency
        {
            get => _minFrequency;
            set => SetProperty(ref _minFrequency, value);
        }

        private double _maxFrequency = 15000;
        public double MaxFrequency
        {
            get => _maxFrequency;
            set => SetProperty(ref _maxFrequency, value);
        }

        private double _referenceLevel = 90;
        public double ReferenceLevel
        {
            get => _referenceLevel;
            set => SetProperty(ref _referenceLevel, value);
        }

        private double _emphasisePeaks = 0.5f;
        public double EmphasisePeaks
        {
            get => _emphasisePeaks;
            set => SetProperty(ref _emphasisePeaks, value);
        }

        private int _gamma = 2;
        public int Gamma
        {
            get => _gamma;
            set => SetProperty(ref _gamma, value);
        }
    }

    #endregion

    public class FrequencyBarsVisualizationProvider : AbstractAudioProcessor, IVisualizationProvider
    {
        #region Properties & Fields

        private readonly FrequencyBarsVisualizationProviderConfiguration _configuration;
        private readonly ISpectrumProvider _spectrumProvider;

        private double _smoothingFactor;
        private double _emphasiseFactor;

        public IEqualizer Equalizer { get; set; }
        public IConfiguration Configuration => _configuration;
        public float[] VisualizationData { get; private set; }

        #endregion

        #region Constructors

        public FrequencyBarsVisualizationProvider(FrequencyBarsVisualizationProviderConfiguration configuration, ISpectrumProvider spectrumProvider)
        {
            this._configuration = configuration;
            this._spectrumProvider = spectrumProvider;

            configuration.PropertyChanged += (sender, args) => RecalculateConfigValues(args.PropertyName);
        }

        #endregion

        #region Methods

        public override void Initialize() => RecalculateConfigValues(null);

        private void RecalculateConfigValues(string changedPropertyName)
        {
            if ((changedPropertyName == null) || (changedPropertyName == nameof(FrequencyBarsVisualizationProviderConfiguration.Bars)))
                VisualizationData = new float[_configuration.Bars];

            if ((changedPropertyName == null) || (changedPropertyName == nameof(FrequencyBarsVisualizationProviderConfiguration.Smoothing)))
                _smoothingFactor = Math.Log10(_configuration.Smoothing);

            if ((changedPropertyName == null) || (changedPropertyName == nameof(FrequencyBarsVisualizationProviderConfiguration.EmphasisePeaks)))
                _emphasiseFactor = (0.75 * (1 + _configuration.EmphasisePeaks));
        }

        public override void Update()
        {
            ISpectrum spectrum = GetSpectrum();
            if (spectrum == null) return;

            float[] equalizerValues = Equalizer?.IsEnabled == true ? Equalizer.CalculateValues(spectrum.BandCount) : null;

            for (int i = 0; i < spectrum.BandCount; i++)
            {
                double binPower = GetBandValue(spectrum[i]);

                if (equalizerValues != null)
                {
                    float equalizerValue = equalizerValues[i];
                    equalizerValue *= 10; //TODO DarthAffe 13.08.2017: Equalizer-Scale through setting?
                    if (Math.Abs(equalizerValue) > 0.000001)
                    {
                        bool lower = equalizerValue < 0;
                        equalizerValue = 1 + (equalizerValue * equalizerValue);
                        binPower *= lower ? 1f / equalizerValue : equalizerValue;
                    }
                }

                binPower = Math.Max(0, 20 * Math.Log10(binPower));

                binPower = Math.Max(0, binPower);
                binPower /= _configuration.ReferenceLevel;
                if (_configuration.EmphasisePeaks > 0.001)
                    binPower = Math.Pow(binPower, 1 + _configuration.EmphasisePeaks) * _emphasiseFactor;

                if (i < VisualizationData.Length)
                {
                    VisualizationData[i] = (float)((VisualizationData[i] * _smoothingFactor) + (binPower * (1.0 - _smoothingFactor)));
                    if (float.IsNaN(VisualizationData[i])) VisualizationData[i] = 0;
                }
            }
        }

        private ISpectrum GetSpectrum()
        {
            switch (_configuration.SpectrumMode)
            {
                case SpectrumMode.Gamma:
                    return _spectrumProvider.GetGammaSpectrum(_configuration.Bars, _configuration.Gamma, (float)_configuration.MinFrequency, (float)_configuration.MaxFrequency);
                case SpectrumMode.Logarithmic:
                    return _spectrumProvider.GetLogarithmicSpectrum(_configuration.Bars, (float)_configuration.MinFrequency, (float)_configuration.MaxFrequency);
                case SpectrumMode.Linear:
                    return _spectrumProvider.GetLinearSpectrum(_configuration.Bars, (float)_configuration.MinFrequency, (float)_configuration.MaxFrequency);
                default:
                    return null;
            }
        }

        private float GetBandValue(Band band)
        {
            switch (_configuration.ValueMode)
            {
                case ValueMode.Max: return band.Max;
                case ValueMode.Average: return band.Average;
                case ValueMode.Sum: return band.Sum;
                default: return 0;
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/IVisualizationProvider.cs
================================================
using KeyboardAudioVisualizer.Configuration;

namespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider
{
    public interface IVisualizationProvider
    {
        IConfiguration Configuration { get; }
        float[] VisualizationData { get; }

        void Initialize();
        void Update();
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/BeatVisualizationProvider.cs
================================================
using KeyboardAudioVisualizer.AudioProcessing.Spectrum;
using KeyboardAudioVisualizer.Configuration;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider
{
    #region Configuration

    public class BeatVisualizationProviderConfiguration : AbstractConfiguration
    {
        //TODO DarthAffe 12.08.2017: Check if there is something usefull to configure here
    }

    #endregion

    public class BeatVisualizationProvider : AbstractAudioProcessor, IVisualizationProvider
    {
        #region Properties & Fields

        private readonly BeatVisualizationProviderConfiguration _configuration;
        private readonly ISpectrumProvider _specturProvider;

        private RingBuffer[] _history;

        public IConfiguration Configuration => _configuration;
        public float[] VisualizationData { get; } = new float[1];

        #endregion

        #region Constructors

        public BeatVisualizationProvider(BeatVisualizationProviderConfiguration configuration, ISpectrumProvider specturProvider)
        {
            this._configuration = configuration;
            this._specturProvider = specturProvider;
        }

        #endregion

        #region Methods

        public override void Initialize()
        {
            _history = new RingBuffer[64];
            for (int i = 0; i < _history.Length; i++)
                _history[i] = new RingBuffer(32);
        }

        public override void Update()
        {
            VisualizationData[0] = 0;

            ISpectrum spectrum = _specturProvider.GetLogarithmicSpectrum(64);
            for (int i = 0; i < 32; i++)
            {
                float currentEnergy = spectrum[i].Average;
                float averageEnergy = _history[i].Average;
                _history[i].Put(currentEnergy);

                if (currentEnergy > (35 * averageEnergy))
                {
                    VisualizationData[0] = 1;
                    break;
                }
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/LevelVisualizationProvider.cs
================================================
using System;
using System.Linq;
using KeyboardAudioVisualizer.AudioCapture;
using KeyboardAudioVisualizer.Configuration;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider
{
    #region Configuration

    public enum ConversionMode
    {
        Linear, Logarithmic, Exponential
    }

    public class LevelVisualizationProviderConfiguration : AbstractConfiguration
    {
        private ConversionMode _conversionMode = ConversionMode.Logarithmic;
        public ConversionMode ConversionMode
        {
            get => _conversionMode;
            set => SetProperty(ref _conversionMode, value);
        }

        private double _smoothing = 3;
        public double Smoothing
        {
            get => _smoothing;
            set => SetProperty(ref _smoothing, value);
        }

        private double _scale = 8;
        public double Scale
        {
            get => _scale;
            set => SetProperty(ref _scale, value);
        }

        private double _referenceLevel = 90;
        public double ReferenceLevel
        {
            get => _referenceLevel;
            set => SetProperty(ref _referenceLevel, value);
        }
    }

    #endregion

    public class LevelVisualizationProvider : AbstractAudioProcessor, IVisualizationProvider
    {
        #region Properties & Fields

        private readonly LevelVisualizationProviderConfiguration _configuration;
        private readonly AudioBuffer _audioBuffer;

        private float[] _sampleDataLeft;
        private float[] _sampleDataRight;
        private float[] _sampleDataMix;
        private double _smoothingFactor;
        private double _scalingFactor;

        public IConfiguration Configuration => _configuration;
        public float[] VisualizationData { get; } = new float[3];

        #endregion

        #region Constructors

        public LevelVisualizationProvider(LevelVisualizationProviderConfiguration configuration, AudioBuffer audioBuffer)
        {
            this._configuration = configuration;
            this._audioBuffer = audioBuffer;

            configuration.PropertyChanged += (sender, args) => RecalculateConfigValues(args.PropertyName);
        }

        #endregion

        #region Methods

        public override void Initialize()
        {
            _sampleDataLeft = new float[2048];
            _sampleDataRight = new float[2048];
            _sampleDataMix = new float[2048];

            RecalculateConfigValues(null);
        }

        private void RecalculateConfigValues(string changedPropertyName)
        {
            if ((changedPropertyName == null) || (changedPropertyName == nameof(LevelVisualizationProviderConfiguration.Smoothing)))
                _smoothingFactor = Math.Log10(MathHelper.Clamp(_configuration.Smoothing, 0.001, 9.5));

            if ((changedPropertyName == null) || (changedPropertyName == nameof(LevelVisualizationProviderConfiguration.Scale))
                                              || (changedPropertyName == nameof(LevelVisualizationProviderConfiguration.ConversionMode)))
            {
                switch (_configuration.ConversionMode)
                {
                    case ConversionMode.Linear:
                        _scalingFactor = _configuration.Scale / 2.5f;
                        break;
                    case ConversionMode.Logarithmic:
                        _scalingFactor = _configuration.Scale * 2.5f;
                        break;
                    case ConversionMode.Exponential:
                        _scalingFactor = _configuration.Scale;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
        }

        public override void Update()
        {
            _audioBuffer.CopyLeftInto(ref _sampleDataLeft, 0);
            _audioBuffer.CopyRightInto(ref _sampleDataRight, 0);
            _audioBuffer.CopyMixInto(ref _sampleDataMix, 0);

            float levelLeft = Convert(GetRms(ref _sampleDataLeft));
            float levelRight = Convert(GetRms(ref _sampleDataRight));
            float levelMix = Convert(GetRms(ref _sampleDataMix));

            UpdateData(0, levelLeft);
            UpdateData(1, levelRight);
            UpdateData(2, levelMix);
        }

        private float GetRms(ref float[] data) => (float)Math.Sqrt(data.Average(x => x * x));

        private float Convert(float level)
        {
            // DarthAffe 12.08.2017: The naming here is a bit off, but as long as it loos good :p
            switch (_configuration.ConversionMode)
            {
                case ConversionMode.Exponential:
                    return level * level;

                case ConversionMode.Logarithmic:
                    return (float)Math.Max(0, (Math.Pow(_configuration.ReferenceLevel, level) - 1) / _configuration.ReferenceLevel);

                default: return level;
            }
        }

        private void UpdateData(int index, float level)
        {
            VisualizationData[index] = (float)((VisualizationData[index] * _smoothingFactor) + (level * _scalingFactor * (1.0 - _smoothingFactor)));
            if (double.IsNaN(VisualizationData[index])) VisualizationData[index] = 0;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/VisualizationType.cs
================================================
using KeyboardAudioVisualizer.Attributes;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider
{
    public enum VisualizationType
    {
        None,

        [VisualizerFor(RGBDeviceType.Keyboard | RGBDeviceType.LedMatrix)]
        [DisplayName("Frequency Bars")]
        FrequencyBars,

        [VisualizerFor(RGBDeviceType.Keyboard | RGBDeviceType.LedMatrix | RGBDeviceType.LedStripe | RGBDeviceType.Mousepad)]
        Level,

        Beat,
    }
}


================================================
FILE: KeyboardAudioVisualizer/Configuration/AbstractConfiguration.cs
================================================
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Configuration
{
    public class AbstractConfiguration : AbstractBindable, IConfiguration, INotifyPropertyChanged
    {
        #region Methods

        protected override bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
        {
            if ((typeof(T) == typeof(double)) || (typeof(T) == typeof(float)))
            {
                if (Math.Abs((double)(object)storage - (double)(object)value) < 0.000001) return false;
            }
            else
            {
                if (Equals(storage, value)) return false;
            }

            storage = value;
            // ReSharper disable once ExplicitCallerInfoArgument
            OnPropertyChanged(propertyName);
            return true;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Configuration/ColorSerializer.cs
================================================
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Configuration
{
    public class ColorSerializer : JsonConverter
    {
        #region Methods

        public override bool CanConvert(Type objectType) => objectType == typeof(Color);

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            if (!(value is Color color)) return;

            writer.WriteStartObject();
            writer.WritePropertyName("A");
            writer.WriteValue(color.A);
            writer.WritePropertyName("R");
            writer.WriteValue(color.R);
            writer.WritePropertyName("G");
            writer.WriteValue(color.G);
            writer.WritePropertyName("B");
            writer.WriteValue(color.B);
            writer.WriteEndObject();
        }

        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JObject jsonObject = JObject.Load(reader);
            if (jsonObject.Property("A").Value.ToObject<double>() > 1.0) //DarthAffe 09.06.2019: Convert old Settings
                return new Color(jsonObject.Property("A").Value.ToObject<byte>(),
                                 jsonObject.Property("R").Value.ToObject<byte>(),
                                 jsonObject.Property("G").Value.ToObject<byte>(),
                                 jsonObject.Property("B").Value.ToObject<byte>());
            else
                return new Color(jsonObject.Property("A").Value.ToObject<double>(),
                                 jsonObject.Property("R").Value.ToObject<double>(),
                                 jsonObject.Property("G").Value.ToObject<double>(),
                                 jsonObject.Property("B").Value.ToObject<double>());
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Configuration/EqualizerConfiguration.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using KeyboardAudioVisualizer.AudioProcessing.Equalizer;

namespace KeyboardAudioVisualizer.Configuration
{
    public class EqualizerConfiguration : AbstractConfiguration
    {
        #region Properties & Fields

        public bool IsEnabled { get; set; } = false;

        public List<EqualizerBand> Bands { get; set; } = new List<EqualizerBand>();

        #endregion

        #region Methods

        public void LoadInto(IEqualizer equalizer)
        {
            equalizer.IsEnabled = IsEnabled;

            foreach (EqualizerBand band in Bands)
            {
                if (band.IsFixedOffset)
                {
                    EqualizerBand bandToUpdate = equalizer.Bands.FirstOrDefault(b => b.IsFixedOffset && (Math.Abs(b.Offset - band.Offset) < 0.01));
                    if (bandToUpdate != null)
                        bandToUpdate.Value = band.Value;
                }
                else
                    equalizer.AddBand(band.Offset, band.Value);
            }
        }

        public void SaveFrom(IEqualizer equalizer)
        {
            IsEnabled = equalizer.IsEnabled;

            Bands.Clear();
            foreach (EqualizerBand band in equalizer.Bands)
                Bands.Add(new EqualizerBand(band.Offset, band.Value, band.IsFixedOffset));
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Configuration/IConfiguration.cs
================================================
using System.ComponentModel;

namespace KeyboardAudioVisualizer.Configuration
{
    public interface IConfiguration : INotifyPropertyChanged
    { }
}


================================================
FILE: KeyboardAudioVisualizer/Configuration/Settings.cs
================================================
using System;
using System.Collections.Generic;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using KeyboardAudioVisualizer.Helper;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Configuration
{
    public class Settings
    {
        #region Constants

        public const int CURRENT_VERSION = 1;

        #endregion

        #region Properties & Fields

        public int Version { get; set; } = 0;

        public double UpdateRate { get; set; } = 40.0;

        public bool EnableAudioPrescale { get; set; } = false;

        public LinearGradient Background { get; set; }

        public Dictionary<VisualizationIndex, VisualizationSettings> Visualizations { get; set; } = new Dictionary<VisualizationIndex, VisualizationSettings>();

        public VisualizationSettings this[VisualizationIndex visualizationIndex]
        {
            get
            {
                if (!Visualizations.TryGetValue(visualizationIndex, out VisualizationSettings settings))
                    Visualizations[visualizationIndex] = (settings = new VisualizationSettings(visualizationIndex));
                return settings;
            }
        }

        #endregion
    }

    public class VisualizationSettings
    {
        #region Properties & Fields

        public VisualizationType SelectedVisualization { get; set; }

        public LinearGradient Gradient { get; set; }

        public EqualizerConfiguration EqualizerConfiguration { get; set; } = new EqualizerConfiguration();

        public FrequencyBarsVisualizationProviderConfiguration FrequencyBarsConfiguration { get; set; } = new FrequencyBarsVisualizationProviderConfiguration();
        public LevelVisualizationProviderConfiguration LevelConfiguration { get; set; } = new LevelVisualizationProviderConfiguration();
        public BeatVisualizationProviderConfiguration BeatConfiguration { get; set; } = new BeatVisualizationProviderConfiguration();

        public IConfiguration this[VisualizationType visualizationType]
        {
            get
            {
                switch (visualizationType)
                {
                    case VisualizationType.None:
                        return null;

                    case VisualizationType.FrequencyBars:
                        return FrequencyBarsConfiguration;

                    case VisualizationType.Level:
                        return LevelConfiguration;

                    case VisualizationType.Beat:
                        return BeatConfiguration;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(visualizationType), visualizationType, null);
                }
            }
        }

        #endregion

        #region Constructors

        public VisualizationSettings(VisualizationIndex visualizationIndex)
        {
            switch (visualizationIndex)
            {
                case VisualizationIndex.Primary:
                    SelectedVisualization = VisualizationType.FrequencyBars;
                    Gradient = new LinearGradient(new GradientStop(0, HSVColor.Create(300, 1, 1)),
                                                  new GradientStop(0.20, HSVColor.Create(225, 1, 1)),
                                                  new GradientStop(0.35, HSVColor.Create(180, 1, 1)),
                                                  new GradientStop(0.50, HSVColor.Create(135, 1, 1)),
                                                  new GradientStop(0.65, HSVColor.Create(90, 1, 1)),
                                                  new GradientStop(0.80, HSVColor.Create(45, 1, 1)),
                                                  new GradientStop(0.95, HSVColor.Create(0, 1, 1)));
                    break;

                case VisualizationIndex.Secondary:
                    SelectedVisualization = VisualizationType.Beat;
                    Gradient = new LinearGradient(new GradientStop(0.5, new Color(255, 255, 255)));
                    break;

                case VisualizationIndex.Tertiary:
                    SelectedVisualization = VisualizationType.Level;
                    Gradient = new LinearGradient(new GradientStop(0, new Color(0, 0, 255)),
                                                  new GradientStop(1, new Color(255, 0, 0)));
                    break;
            }
        }

        #endregion

        #region Methods

        public T GetConfiguration<T>(VisualizationType visualizationType)
            where T : IConfiguration, new() => (T)this[visualizationType];

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Controls/BlurredDecorationWindow.cs
================================================
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace KeyboardAudioVisualizer.Controls
{
    [TemplatePart(Name = "PART_Decoration", Type = typeof(FrameworkElement))]
    [TemplatePart(Name = "PART_Content", Type = typeof(FrameworkElement))]
    [TemplatePart(Name = "PART_CloseButton", Type = typeof(Button))]
    [TemplatePart(Name = "PART_MinimizeButton", Type = typeof(Button))]
    [TemplatePart(Name = "PART_IconButton", Type = typeof(Button))]
    public class BlurredDecorationWindow : Window
    {
        #region DependencyProperties
        // ReSharper disable InconsistentNaming

        public static readonly DependencyProperty BackgroundImageProperty = DependencyProperty.Register(
            "BackgroundImage", typeof(ImageSource), typeof(BlurredDecorationWindow), new PropertyMetadata(default(ImageSource)));

        public ImageSource BackgroundImage
        {
            get => (ImageSource)GetValue(BackgroundImageProperty);
            set => SetValue(BackgroundImageProperty, value);
        }

        public static readonly DependencyProperty DecorationHeightProperty = DependencyProperty.Register(
            "DecorationHeight", typeof(double), typeof(BlurredDecorationWindow), new PropertyMetadata(20.0));

        public double DecorationHeight
        {
            get => (double)GetValue(DecorationHeightProperty);
            set => SetValue(DecorationHeightProperty, value);
        }

        public static readonly DependencyProperty IconToolTipProperty = DependencyProperty.Register(
            "IconToolTip", typeof(string), typeof(BlurredDecorationWindow), new PropertyMetadata(default(string)));

        public string IconToolTip
        {
            get => (string)GetValue(IconToolTipProperty);
            set => SetValue(IconToolTipProperty, value);
        }

        public static readonly DependencyProperty IconCommandProperty = DependencyProperty.Register(
            "IconCommand", typeof(ICommand), typeof(BlurredDecorationWindow), new PropertyMetadata(default(ICommand)));

        public ICommand IconCommand
        {
            get => (ICommand)GetValue(IconCommandProperty);
            set => SetValue(IconCommandProperty, value);
        }

        // ReSharper restore InconsistentNaming
        #endregion

        #region Constructors

        static BlurredDecorationWindow()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(BlurredDecorationWindow), new FrameworkPropertyMetadata(typeof(BlurredDecorationWindow)));
        }

        #endregion

        #region Methods

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            FrameworkElement decoration = GetTemplateChild("PART_Decoration") as FrameworkElement;
            if (decoration != null)
                decoration.MouseLeftButtonDown += (sender, args) => DragMove();

            Button closeButton = GetTemplateChild("PART_CloseButton") as Button;
            if (closeButton != null)
                closeButton.Click += (sender, args) => ApplicationManager.Instance.ExitCommand.Execute(null);

            Button minimizeButton = GetTemplateChild("PART_MinimizeButton") as Button;
            if (minimizeButton != null)
                minimizeButton.Click += (sender, args) => Hide();

            Button iconButton = GetTemplateChild("PART_IconButton") as Button;
            if (iconButton != null)
                iconButton.Click += (sender, args) => IconCommand?.Execute(null);
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Controls/ColorSelector.cs
================================================
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using RGB.NET.Core;
using Color = RGB.NET.Core.Color;
using Point = System.Windows.Point;
using Rectangle = System.Windows.Shapes.Rectangle;
using WpfColor = System.Windows.Media.Color;

namespace KeyboardAudioVisualizer.Controls
{
    [TemplatePart(Name = "PART_Selector", Type = typeof(Panel))]
    [TemplatePart(Name = "PART_SliderAlpha", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderRed", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderGreen", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderBlue", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderHue", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderSaturation", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_SliderValue", Type = typeof(Slider))]
    [TemplatePart(Name = "PART_Preview", Type = typeof(Rectangle))]
    public class ColorSelector : Control
    {
        #region Properties & Fields

        private bool _ignorePropertyChanged;
        private bool _dragSelector;

        private byte _a;
        private byte _r;
        private byte _g;
        private byte _b;
        private double _hue;
        private double _saturation;
        private double _value;

        private Panel _selector;
        private Rectangle _selectorColor;
        private Grid _selectorGrip;
        private Slider _sliderAlpha;
        private Slider _sliderRed;
        private Slider _sliderGreen;
        private Slider _sliderBlue;
        private Slider _sliderHue;
        private Slider _sliderSaturation;
        private Slider _sliderValue;
        private Rectangle _preview;

        private SolidColorBrush _previewBrush;
        private SolidColorBrush _selectorBrush;
        private LinearGradientBrush _alphaBrush;
        private LinearGradientBrush _redBrush;
        private LinearGradientBrush _greenBrush;
        private LinearGradientBrush _blueBrush;
        private LinearGradientBrush _hueBrush;
        private LinearGradientBrush _saturationBrush;
        private LinearGradientBrush _valueBrush;

        #endregion

        #region DependencyProperties

        public static readonly DependencyProperty SelectedColorProperty = DependencyProperty.Register(
            "SelectedColor", typeof(Color), typeof(ColorSelector), new FrameworkPropertyMetadata(new Color(255, 0, 0),
                                                                                                 FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                                                                                 SelectedColorChanged));

        public Color SelectedColor
        {
            get => (Color)GetValue(SelectedColorProperty);
            set => SetValue(SelectedColorProperty, value);
        }

        #endregion

        #region Methods

        public override void OnApplyTemplate()
        {
            if ((_selector = GetTemplateChild("PART_Selector") as Panel) != null)
            {
                _selectorBrush = new SolidColorBrush();
                _selectorColor = new Rectangle
                {
                    VerticalAlignment = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    SnapsToDevicePixels = true,
                    StrokeThickness = 0,
                    Fill = _selectorBrush
                };
                _selector.Children.Add(_selectorColor);

                Rectangle selectorWhite = new Rectangle
                {
                    VerticalAlignment = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    SnapsToDevicePixels = true,
                    StrokeThickness = 0,
                    Fill = new LinearGradientBrush(WpfColor.FromRgb(255, 255, 255), WpfColor.FromArgb(0, 255, 255, 255), new Point(0, 0.5), new Point(1, 0.5))
                };
                _selector.Children.Add(selectorWhite);

                Rectangle selectorBlack = new Rectangle
                {
                    VerticalAlignment = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    SnapsToDevicePixels = true,
                    StrokeThickness = 0,
                    Fill = new LinearGradientBrush(WpfColor.FromRgb(0, 0, 0), WpfColor.FromArgb(0, 0, 0, 0), new Point(0.5, 1), new Point(0.5, 0))
                };
                _selector.Children.Add(selectorBlack);

                _selectorGrip = new Grid
                {
                    VerticalAlignment = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    SnapsToDevicePixels = true
                };
                _selectorGrip.Children.Add(new Ellipse
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    SnapsToDevicePixels = true,
                    Stroke = new SolidColorBrush(WpfColor.FromRgb(0, 0, 0)),
                    StrokeThickness = 2,
                    Fill = null,
                    Width = 12,
                    Height = 12
                });
                _selectorGrip.Children.Add(new Ellipse
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    SnapsToDevicePixels = true,
                    Stroke = new SolidColorBrush(WpfColor.FromRgb(255, 255, 255)),
                    StrokeThickness = 1,
                    Fill = null,
                    Width = 10,
                    Height = 10
                });
                _selector.Children.Add(_selectorGrip);

                _selector.SizeChanged += (sender, args) => UpdateSelector();
                _selector.MouseLeftButtonDown += (sender, args) =>
                                                 {
                                                     _dragSelector = true;
                                                     UpdateSelectorValue(args.GetPosition(_selector));
                                                 };
                _selector.MouseEnter += (sender, args) =>
                                        {
                                            if (args.LeftButton == MouseButtonState.Pressed)
                                            {
                                                _dragSelector = true;
                                                UpdateSelectorValue(args.GetPosition(_selector));
                                            }
                                        };
                _selector.MouseLeftButtonUp += (sender, args) => _dragSelector = false;
                _selector.MouseLeave += (sender, args) => _dragSelector = false;
                _selector.MouseMove += (sender, args) => UpdateSelectorValue(args.GetPosition(_selector));
                _selector.ClipToBounds = true;
            }

            if ((_sliderAlpha = GetTemplateChild("PART_SliderAlpha") as Slider) != null)
            {
                _alphaBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                         new GradientStop(new WpfColor(), 1) }));
                _sliderAlpha.Background = _alphaBrush;
                _sliderAlpha.ValueChanged += AChanged;
            }

            if ((_sliderRed = GetTemplateChild("PART_SliderRed") as Slider) != null)
            {
                _redBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                       new GradientStop(new WpfColor(), 1) }));
                _sliderRed.Background = _redBrush;
                _sliderRed.ValueChanged += RChanged;
            }

            if ((_sliderGreen = GetTemplateChild("PART_SliderGreen") as Slider) != null)
            {
                _greenBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                         new GradientStop(new WpfColor(), 1) }));
                _sliderGreen.Background = _greenBrush;
                _sliderGreen.ValueChanged += GChanged;
            }

            if ((_sliderBlue = GetTemplateChild("PART_SliderBlue") as Slider) != null)
            {
                _blueBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                        new GradientStop(new WpfColor(), 1) }));
                _sliderBlue.Background = _blueBrush;
                _sliderBlue.ValueChanged += BChanged;
            }

            if ((_sliderHue = GetTemplateChild("PART_SliderHue") as Slider) != null)
            {
                _hueBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                       new GradientStop(new WpfColor(), 1.0 / 6.0),
                                                                                       new GradientStop(new WpfColor(), 2.0 / 6.0),
                                                                                       new GradientStop(new WpfColor(), 3.0 / 6.0),
                                                                                       new GradientStop(new WpfColor(), 4.0 / 6.0),
                                                                                       new GradientStop(new WpfColor(), 5.0 / 6.0),
                                                                                       new GradientStop(new WpfColor(), 1) }));
                _sliderHue.Background = _hueBrush;
                _sliderHue.ValueChanged += HueChanged;
            }

            if ((_sliderSaturation = GetTemplateChild("PART_SliderSaturation") as Slider) != null)
            {
                _saturationBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                              new GradientStop(new WpfColor(), 1) }));
                _sliderSaturation.Background = _saturationBrush;
                _sliderSaturation.ValueChanged += SaturationChanged;
            }

            if ((_sliderValue = GetTemplateChild("PART_SliderValue") as Slider) != null)
            {
                _valueBrush = new LinearGradientBrush(new GradientStopCollection(new[] { new GradientStop(new WpfColor(), 0),
                                                                                         new GradientStop(new WpfColor(), 1) }));
                _sliderValue.Background = _valueBrush;
                _sliderValue.ValueChanged += ValueChanged;
            }

            if ((_preview = GetTemplateChild("PART_Preview") as Rectangle) != null)
            {
                _previewBrush = new SolidColorBrush();
                _preview.Fill = _previewBrush;
            }

            SetColor(SelectedColor);
        }

        private static void SelectedColorChanged(DependencyObject dependencyObject,
                                                 DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (!(dependencyObject is ColorSelector cs) || !(dependencyPropertyChangedEventArgs.NewValue is Color color)) return;
            cs.SetColor(color);
        }

        private void SetColor(Color color)
        {
            if (_ignorePropertyChanged) return;

            SetA(color);
            SetRGB(color);
            SetHSV(color);

            UpdateSelector();
            UpdateUIColors();
        }

        private void AChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _a = (byte)routedPropertyChangedEventArgs.NewValue.Clamp(0, byte.MaxValue);
            Color color = new Color(_a, _r, _g, _b);
            UpdateSelectedColor(color);
            UpdateUIColors();
            UpdateSelector();
        }

        private void RChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _r = (byte)routedPropertyChangedEventArgs.NewValue.Clamp(0, byte.MaxValue);
            RGBChanged();
        }

        private void GChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _g = (byte)routedPropertyChangedEventArgs.NewValue.Clamp(0, byte.MaxValue);
            RGBChanged();
        }

        private void BChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _b = (byte)routedPropertyChangedEventArgs.NewValue.Clamp(0, byte.MaxValue);
            RGBChanged();
        }

        private void RGBChanged()
        {
            Color color = new Color(_a, _r, _g, _b);
            UpdateSelectedColor(color);
            SetHSV(color);
            UpdateUIColors();
            UpdateSelector();
        }

        private void HueChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _hue = routedPropertyChangedEventArgs.NewValue.Clamp(0, 360);
            HSVChanged();
        }

        private void SaturationChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _saturation = routedPropertyChangedEventArgs.NewValue.Clamp(0, 1);
            HSVChanged();
        }

        private void ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
        {
            if (_ignorePropertyChanged) return;

            _value = routedPropertyChangedEventArgs.NewValue.Clamp(0, 1);
            HSVChanged();
        }

        private void HSVChanged()
        {
            Color color = HSVColor.Create(_a, _hue, _saturation, _value);
            UpdateSelectedColor(color);
            SetRGB(color);
            UpdateUIColors();
            UpdateSelector();
        }

        private void SetA(Color color)
        {
            _ignorePropertyChanged = true;

            _a = color.GetA();
            if (_sliderAlpha != null)
                _sliderAlpha.Value = _a;

            _ignorePropertyChanged = false;
        }

        private void SetRGB(Color color)
        {
            _ignorePropertyChanged = true;

            _r = color.GetR();
            if (_sliderRed != null)
                _sliderRed.Value = _r;

            _g = color.GetG();
            if (_sliderGreen != null)
                _sliderGreen.Value = _g;

            _b = color.GetB();
            if (_sliderBlue != null)
                _sliderBlue.Value = _b;

            _ignorePropertyChanged = false;
        }

        private void SetHSV(Color color)
        {
            _ignorePropertyChanged = true;

            _hue = color.GetHue();
            if (_sliderHue != null)
                _sliderHue.Value = _hue;

            _saturation = color.GetSaturation();
            if (_sliderSaturation != null)
                _sliderSaturation.Value = _saturation;

            _value = color.GetValue();
            if (_sliderValue != null)
                _sliderValue.Value = _value;

            _ignorePropertyChanged = false;
        }

        private void UpdateSelectedColor(Color color)
        {
            _ignorePropertyChanged = true;

            SelectedColor = color;

            _ignorePropertyChanged = false;
        }

        private void UpdateSelector()
        {
            if (_selector == null) return;

            double selectorX = (_selector.ActualWidth * _saturation) - (_selectorGrip.ActualWidth / 2);
            double selectorY = (_selector.ActualHeight * _value) - (_selectorGrip.ActualHeight / 2);
            if (!double.IsNaN(selectorX) && !double.IsNaN(selectorY))
                _selectorGrip.Margin = new Thickness(selectorX, 0, 0, selectorY);
        }

        private void UpdateSelectorValue(Point mouseLocation)
        {
            if (!_dragSelector) return;

            double saturation = mouseLocation.X / _selector.ActualWidth;
            double value = 1 - (mouseLocation.Y / _selector.ActualHeight);
            if (!double.IsNaN(saturation) && !double.IsNaN(value))
            {
                _saturation = saturation;
                _value = value;
                HSVChanged();
            }
        }

        private void UpdateUIColors()
        {
            Color hueColor = HSVColor.Create(_hue, 1, 1);

            if (_previewBrush != null)
                _previewBrush.Color = WpfColor.FromArgb(_a, _r, _g, _b);

            if (_selectorBrush != null)
                _selectorBrush.Color = WpfColor.FromRgb(hueColor.GetR(), hueColor.GetG(), hueColor.GetB());

            if (_alphaBrush != null)
            {
                _alphaBrush.GradientStops[0].Color = WpfColor.FromArgb(0, _r, _g, _b);
                _alphaBrush.GradientStops[1].Color = WpfColor.FromArgb(255, _r, _g, _b);
            }

            if (_redBrush != null)
            {
                _redBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 0, _g, _b);
                _redBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, 255, _g, _b);
            }

            if (_greenBrush != null)
            {
                _greenBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, _r, 0, _b);
                _greenBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, _r, 255, _b);
            }

            if (_blueBrush != null)
            {
                _blueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, _r, _g, 0);
                _blueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, _r, _g, 255);
            }

            if (_hueBrush != null)
            {
                Color referenceColor1 = HSVColor.Create(0, _saturation, _value);
                Color referenceColor2 = HSVColor.Create(60, _saturation, _value);
                Color referenceColor3 = HSVColor.Create(120, _saturation, _value);
                Color referenceColor4 = HSVColor.Create(180, _saturation, _value);
                Color referenceColor5 = HSVColor.Create(240, _saturation, _value);
                Color referenceColor6 = HSVColor.Create(300, _saturation, _value);

                _hueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, referenceColor1.GetR(), referenceColor1.GetG(), referenceColor1.GetB());
                _hueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor2.GetR(), referenceColor2.GetG(), referenceColor2.GetB());
                _hueBrush.GradientStops[2].Color = WpfColor.FromArgb(_a, referenceColor3.GetR(), referenceColor3.GetG(), referenceColor3.GetB());
                _hueBrush.GradientStops[3].Color = WpfColor.FromArgb(_a, referenceColor4.GetR(), referenceColor4.GetG(), referenceColor4.GetB());
                _hueBrush.GradientStops[4].Color = WpfColor.FromArgb(_a, referenceColor5.GetR(), referenceColor5.GetG(), referenceColor5.GetB());
                _hueBrush.GradientStops[5].Color = WpfColor.FromArgb(_a, referenceColor6.GetR(), referenceColor6.GetG(), referenceColor6.GetB());
                _hueBrush.GradientStops[6].Color = WpfColor.FromArgb(_a, referenceColor1.GetR(), referenceColor1.GetG(), referenceColor1.GetB());
            }

            if (_saturationBrush != null)
            {
                Color referenceColor = HSVColor.Create(_hue, 1, _value);

                _saturationBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 255, 255, 255);
                _saturationBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
            }

            if (_valueBrush != null)
            {
                Color referenceColor = HSVColor.Create(_hue, _saturation, 1);

                _valueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 0, 0, 0);
                _valueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
            }
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Controls/Form.cs
================================================
using System;
using System.Windows;
using System.Windows.Controls;

namespace KeyboardAudioVisualizer.Controls
{
    public class Form : Panel
    {
        #region DependencyProperties
        // ReSharper disable InconsistentNaming

        public static readonly DependencyProperty RowHeightProperty = DependencyProperty.Register("RowHeight", typeof(double), typeof(Form),
            new FrameworkPropertyMetadata(24.0, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public double RowHeight
        {
            get => (double)GetValue(RowHeightProperty);
            set
            {
                if (value < 0) throw new ArgumentOutOfRangeException(nameof(RowHeight), "Row height can't be negative");
                SetValue(RowHeightProperty, value);
            }
        }

        public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register("LabelWidth", typeof(double), typeof(Form),
            new FrameworkPropertyMetadata(100.0, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public double LabelWidth
        {
            get => (double)GetValue(LabelWidthProperty);
            set
            {
                if (value < 0) throw new ArgumentOutOfRangeException(nameof(RowHeight), "Label width can't be negative");
                SetValue(LabelWidthProperty, value);
            }
        }

        public static readonly DependencyProperty ElementSpacingProperty = DependencyProperty.Register("ElementSpacing", typeof(double), typeof(Form),
            new FrameworkPropertyMetadata(default(double), FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public double ElementSpacing
        {
            get => (double)GetValue(ElementSpacingProperty);
            set => SetValue(ElementSpacingProperty, value);
        }

        public static readonly DependencyProperty RowSpacingProperty = DependencyProperty.Register("RowSpacing", typeof(double), typeof(Form),
            new FrameworkPropertyMetadata(default(double), FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public double RowSpacing
        {
            get => (double)GetValue(RowSpacingProperty);
            set => SetValue(RowSpacingProperty, value);
        }

        // ReSharper restore InconsistentNaming
        #endregion

        #region AttachedProperties
        // ReSharper disable InconsistentNaming

        public static readonly DependencyProperty IsLabelProperty = DependencyProperty.RegisterAttached("IsLabel", typeof(bool), typeof(Form),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public static void SetIsLabel(UIElement element, bool value) => element.SetValue(IsLabelProperty, value);
        public static bool GetIsLabel(UIElement element) => (bool)element.GetValue(IsLabelProperty);

        public static readonly DependencyProperty LineBreaksProperty = DependencyProperty.RegisterAttached("LineBreaks", typeof(int), typeof(Form),
            new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public static void SetLineBreaks(UIElement element, int value) => element.SetValue(LineBreaksProperty, value);
        public static int GetLineBreaks(UIElement element) => (int)element.GetValue(LineBreaksProperty);

        public static readonly DependencyProperty RowSpanProperty = DependencyProperty.RegisterAttached("RowSpan", typeof(int), typeof(Form),
            new FrameworkPropertyMetadata(1, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public static void SetRowSpan(DependencyObject element, int value) => element.SetValue(RowSpanProperty, value);
        public static int GetRowSpan(DependencyObject element) => (int)element.GetValue(RowSpanProperty);

        public static readonly DependencyProperty FillProperty = DependencyProperty.RegisterAttached("Fill", typeof(bool), typeof(Form),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));

        public static void SetFill(DependencyObject element, bool value) => element.SetValue(FillProperty, value);
        public static bool GetFill(DependencyObject element) => (bool)element.GetValue(FillProperty);

        // ReSharper restore InconsistentNaming
        #endregion

        #region Methods

        protected override Size MeasureOverride(Size availableSize)
        {
            if (InternalChildren.Count == 0) return new Size(0, 0);

            FormLayout layout = new FormLayout(RowHeight, LabelWidth, ElementSpacing, RowSpacing);

            foreach (UIElement child in InternalChildren)
            {
                child.Measure(availableSize);
                layout.AddElement(child, 0);
            }

            return new Size(layout.Width, layout.Height);
        }

        protected override Size ArrangeOverride(Size finalSize)
        {
            if (InternalChildren.Count == 0) return new Size(0, 0);

            FormLayout layout = new FormLayout(RowHeight, LabelWidth, ElementSpacing, RowSpacing);

            foreach (UIElement child in InternalChildren)
                child.Arrange(layout.AddElement(child, finalSize.Width));

            return new Size(finalSize.Width, layout.Height);
        }

        #endregion

        #region Data

        private class FormLayout
        {
            #region Properties & Fields

            private readonly double _rowHeight;
            private readonly double _labelWidth;
            private readonly double _elementSpacing;
            private readonly double _rowSpacing;

            private double _currentRowWidth;

            private int _newRows = 0;
            private int _rows = -1;
            private double _currentMaxWidth;
            public double Width => Math.Max((Math.Max(_currentMaxWidth, _currentRowWidth) - _elementSpacing), 0);
            public double Height => ((_rows + 1) * _rowHeight) + (_rows * _rowSpacing);

            #endregion

            #region Constructors

            public FormLayout(double rowHeight, double labelWidth, double elementSpacing, double rowSpacing)
            {
                this._rowHeight = rowHeight;
                this._labelWidth = labelWidth;
                this._elementSpacing = elementSpacing;
                this._rowSpacing = rowSpacing;
            }

            #endregion

            #region Methods

            public Rect AddElement(UIElement element, double targetWidth)
            {
                bool isLabel = GetIsLabel(element);
                int lineBreaks = GetLineBreaks(element);
                int rowSpan = GetRowSpan(element);

                double elementWidth = isLabel ? _labelWidth : element.DesiredSize.Width;
                double height = _rowHeight;

                if (_newRows > 0)
                {
                    AddLineBreaks(_newRows);
                    _newRows = 0;
                }

                if (lineBreaks > 0) AddLineBreaks(lineBreaks);
                else if (isLabel) AddLineBreaks(1);
                else if (_rows < 0) _rows = 0;

                if (!isLabel && (_currentRowWidth < _labelWidth))
                    _currentRowWidth = _labelWidth + _elementSpacing;

                if (rowSpan > 1)
                {
                    height = (rowSpan * _rowHeight) + ((rowSpan - 1) * _rowSpacing);
                    _newRows = Math.Max(_newRows, rowSpan - 1);
                }

                if (element is FrameworkElement fe)
                    fe.MaxHeight = height;

                double width = elementWidth;
                if ((targetWidth >= 1) && GetFill(element))
                    width = targetWidth - _currentRowWidth;

                Rect rect = new Rect(new Point(_currentRowWidth, (_rows * _rowHeight) + (_rows * _rowSpacing)), new Size(width, height));

                _currentRowWidth += width + _elementSpacing;

                return rect;
            }

            private void AddLineBreaks(int count)
            {
                if (count <= 0) return;

                _currentMaxWidth = Math.Max(_currentMaxWidth, _currentRowWidth);

                _currentRowWidth = 0;
                _rows += count;
            }

            #endregion
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Controls/GradientEditor.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;
using Color = System.Windows.Media.Color;
using Point = System.Windows.Point;
using Size = System.Windows.Size;
using Rectangle = System.Windows.Shapes.Rectangle;
using GradientStop = RGB.NET.Brushes.Gradients.GradientStop;

namespace KeyboardAudioVisualizer.Controls
{
    [TemplatePart(Name = "PART_Gradient", Type = typeof(Canvas))]
    [TemplatePart(Name = "PART_Stops", Type = typeof(Canvas))]
    public class GradientEditor : Control
    {
        #region Properties & Fields

        private Canvas _gradientContainer;
        private Canvas _stopContainer;
        private readonly List<Rectangle> _previewRectangles = new List<Rectangle>();
        private readonly Dictionary<GradientStop, ContentControl> _stops = new Dictionary<GradientStop, ContentControl>();
        private ContentControl _draggingStop;
        private AdornerLayer _adornerLayer;
        private ColorPickerAdorner _adorner;
        private Window _window;

        #endregion

        #region DepdencyProperties

        public static readonly DependencyProperty GradientProperty = DependencyProperty.Register(
            "Gradient", typeof(LinearGradient), typeof(GradientEditor), new FrameworkPropertyMetadata(null,
                                                                                                      FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                                                                                      OnGradientChanged));

        public LinearGradient Gradient
        {
            get => (LinearGradient)GetValue(GradientProperty);
            set => SetValue(GradientProperty, value);
        }

        public static readonly DependencyProperty GradientStopStyleProperty = DependencyProperty.Register(
            "GradientStopStyle", typeof(Style), typeof(GradientEditor), new PropertyMetadata(default(Style)));

        public Style GradientStopStyle
        {
            get => (Style)GetValue(GradientStopStyleProperty);
            set => SetValue(GradientStopStyleProperty, value);
        }

        public static readonly DependencyProperty SelectedStopProperty = DependencyProperty.Register(
            "SelectedStop", typeof(GradientStop), typeof(GradientEditor), new PropertyMetadata(default(GradientStop), SelectedStopChanged));

        public GradientStop SelectedStop
        {
            get => (GradientStop)GetValue(SelectedStopProperty);
            set => SetValue(SelectedStopProperty, value);
        }

        public static readonly DependencyProperty ColorSelectorTemplateProperty = DependencyProperty.Register(
            "ColorSelectorTemplate", typeof(DataTemplate), typeof(GradientEditor), new PropertyMetadata(default(DataTemplate)));

        public DataTemplate ColorSelectorTemplate
        {
            get => (DataTemplate)GetValue(ColorSelectorTemplateProperty);
            set => SetValue(ColorSelectorTemplateProperty, value);
        }

        public static readonly DependencyProperty CanAddOrDeleteStopsProperty = DependencyProperty.Register(
            "CanAddOrDeleteStops", typeof(bool), typeof(GradientEditor), new PropertyMetadata(true));

        public bool CanAddOrDeleteStops
        {
            get => (bool)GetValue(CanAddOrDeleteStopsProperty);
            set => SetValue(CanAddOrDeleteStopsProperty, value);
        }

        #endregion

        #region AttachedProperties

        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.RegisterAttached(
            "IsSelected", typeof(bool), typeof(GradientEditor), new PropertyMetadata(default(bool)));

        public static void SetIsSelected(DependencyObject element, bool value) => element.SetValue(IsSelectedProperty, value);
        public static bool GetIsSelected(DependencyObject element) => (bool)element.GetValue(IsSelectedProperty);

        #endregion

        #region Constructors

        public GradientEditor()
        {
            if (Gradient == null)
                Gradient = new LinearGradient();
        }

        #endregion

        #region Methods

        public override void OnApplyTemplate()
        {
            if ((_gradientContainer = GetTemplateChild("PART_Gradient") as Canvas) != null)
            {
                _gradientContainer.SizeChanged += (sender, args) => UpdateGradientPreview();
                _gradientContainer.MouseDown += GradientContainerOnMouseDown;
            }

            if ((_stopContainer = GetTemplateChild("PART_Stops") as Canvas) != null)
                _stopContainer.SizeChanged += (sender, args) => UpdateGradientStops();

            _adornerLayer = AdornerLayer.GetAdornerLayer(this);
            _window = Window.GetWindow(this);
            if (_window != null)
            {
                _window.PreviewMouseDown += WindowMouseDown;
                _window.PreviewKeyDown += (sender, args) =>
                {
                    if (args.Key == Key.Escape)
                        SelectedStop = null;
                };
            }

            UpdateGradientPreview();
            UpdateGradientStops();
        }

        private void UpdateGradientPreview()
        {
            if ((_gradientContainer == null) || (Gradient == null)) return;

            List<GradientStop> gradientStops = Gradient.GradientStops.OrderBy(x => x.Offset).ToList();
            if (gradientStops.Count == 0)
                UpdatePreviewRectangleCount(gradientStops.Count);
            else if (gradientStops.Count == 1)
            {
                UpdatePreviewRectangleCount(gradientStops.Count);
                GradientStop firstStop = gradientStops[0];
                UpdatePreviewRectangle(_previewRectangles[0], _gradientContainer.ActualWidth, _gradientContainer.ActualHeight, 0, 1, firstStop.Color, firstStop.Color);
            }
            else
            {
                UpdatePreviewRectangleCount(gradientStops.Count + 1);

                GradientStop firstStop = gradientStops[0];
                UpdatePreviewRectangle(_previewRectangles[0], _gradientContainer.ActualWidth, _gradientContainer.ActualHeight, 0, firstStop.Offset, firstStop.Color, firstStop.Color);
                for (int i = 0; i < (gradientStops.Count - 1); i++)
                {
                    GradientStop stop = gradientStops[i];
                    GradientStop nextStop = gradientStops[i + 1];
                    Rectangle rect = _previewRectangles[i + 1];
                    UpdatePreviewRectangle(rect, _gradientContainer.ActualWidth, _gradientContainer.ActualHeight, stop.Offset, nextStop.Offset, stop.Color, nextStop.Color);
                }
                GradientStop lastStop = gradientStops[gradientStops.Count - 1];
                UpdatePreviewRectangle(_previewRectangles[_previewRectangles.Count - 1], _gradientContainer.ActualWidth, _gradientContainer.ActualHeight, lastStop.Offset, 1, lastStop.Color, lastStop.Color);
            }
        }

        private void UpdatePreviewRectangle(Rectangle rect, double referenceWidth, double referenceHeight, double from, double to,
                                            RGB.NET.Core.Color startColor, RGB.NET.Core.Color endColor)
        {
            rect.Fill = new LinearGradientBrush(Color.FromArgb(startColor.GetA(), startColor.GetR(), startColor.GetG(), startColor.GetB()),
                                                Color.FromArgb(endColor.GetA(), endColor.GetR(), endColor.GetG(), endColor.GetB()),
                                                new Point(0, 0.5), new Point(1, 0.5));

            //DarthAffe 09.02.2018: Forced rounding to prevent render issues on resize
            Canvas.SetLeft(rect, Math.Floor(referenceWidth * from.Clamp(0, 1)));
            rect.Width = Math.Ceiling(referenceWidth * (to.Clamp(0, 1) - from.Clamp(0, 1)));

            Canvas.SetTop(rect, 0);
            rect.Height = referenceHeight;
        }

        private void UpdatePreviewRectangleCount(int gradientCount)
        {
            int countDiff = gradientCount - _previewRectangles.Count;
            if (countDiff > 0)
                for (int i = 0; i < countDiff; i++)
                {
                    Rectangle rect = new Rectangle { VerticalAlignment = VerticalAlignment.Stretch };
                    _previewRectangles.Add(rect);
                    _gradientContainer.Children.Add(rect);
                }

            if (countDiff < 0)
                for (int i = 0; i < Math.Abs(countDiff); i++)
                {
                    int index = _previewRectangles.Count - i - 1;
                    Rectangle rect = _previewRectangles[index];
                    _previewRectangles.RemoveAt(index);
                    _gradientContainer.Children.Remove(rect);
                }
        }

        private void UpdateGradientStops()
        {
            if (Gradient == null) return;

            List<GradientStop> gradientStops = Gradient.GradientStops.OrderBy(x => x.Offset).ToList();
            UpdateGradientStopsCount(gradientStops);
            foreach (GradientStop stop in gradientStops)
                UpdateGradientStop(_stops[stop], _stopContainer.ActualWidth, _stopContainer.ActualHeight, stop);
        }

        private void UpdateGradientStop(ContentControl control, double referenceWidth, double referenceHeight, GradientStop stop)
        {
            control.Background = new SolidColorBrush(Color.FromArgb(stop.Color.GetA(), stop.Color.GetR(), stop.Color.GetG(), stop.Color.GetB()));

            Canvas.SetLeft(control, (referenceWidth * stop.Offset.Clamp(0, 1)) - (control.Width / 2.0));

            Canvas.SetTop(control, 0);
            control.Height = referenceHeight;
        }

        private void UpdateGradientStopsCount(List<GradientStop> gradientStops)
        {
            foreach (GradientStop stop in gradientStops)
            {
                if (!_stops.ContainsKey(stop))
                {
                    ContentControl control = new ContentControl
                    {
                        VerticalAlignment = VerticalAlignment.Stretch,
                        Style = GradientStopStyle,
                        Content = stop
                    };
                    control.MouseDown += GradientStopOnMouseDown;
                    _stops.Add(stop, control);
                    _stopContainer.Children.Add(control);
                }
            }

            List<GradientStop> stopsToRemove = new List<GradientStop>();
            foreach (KeyValuePair<GradientStop, ContentControl> stopPair in _stops)
                if (!gradientStops.Contains(stopPair.Key))
                {
                    ContentControl control = stopPair.Value;
                    control.MouseDown -= GradientStopOnMouseDown;
                    stopsToRemove.Add(stopPair.Key);
                    _stopContainer.Children.Remove(control);
                }

            foreach (GradientStop stop in stopsToRemove)
                _stops.Remove(stop);
        }

        private void AttachGradient(AbstractGradient gradient) => gradient.GradientChanged += GradientChanged;
        private void DetachGradient(AbstractGradient gradient) => gradient.GradientChanged -= GradientChanged;

        private void GradientChanged(object o, EventArgs eventArgs)
        {
            UpdateGradientPreview();
            UpdateGradientStops();
        }

        private static void OnGradientChanged(DependencyObject dependencyObject,
                                              DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (!(dependencyObject is GradientEditor ge)) return;

            if (dependencyPropertyChangedEventArgs.OldValue is AbstractGradient oldGradient)
                ge.DetachGradient(oldGradient);

            if (dependencyPropertyChangedEventArgs.NewValue is AbstractGradient newGradient)
                ge.AttachGradient(newGradient);
        }

        private void GradientContainerOnMouseDown(object o, MouseButtonEventArgs mouseButtonEventArgs)
        {
            if ((mouseButtonEventArgs.ChangedButton != MouseButton.Left) || (Gradient == null) || !CanAddOrDeleteStops) return;

            double offset = mouseButtonEventArgs.GetPosition(_gradientContainer).X / _gradientContainer.ActualWidth;
            RGB.NET.Core.Color color = Gradient.GetColor(offset);
            GradientStop newStop = new GradientStop(offset, color);
            Gradient.GradientStops.Add(newStop);
            SelectedStop = newStop;
        }

        private void GradientStopOnMouseDown(object o, MouseButtonEventArgs mouseButtonEventArgs)
        {
            if (!((o as ContentControl)?.Content is GradientStop stop) || (Gradient == null)) return;

            if (mouseButtonEventArgs.ChangedButton == MouseButton.Right)
            {
                if (CanAddOrDeleteStops)
                    Gradient.GradientStops.Remove(stop);
            }
            else if (mouseButtonEventArgs.ChangedButton == MouseButton.Left)
            {
                SelectedStop = stop;
                _draggingStop = (ContentControl)o;
            }
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (_draggingStop?.Content is GradientStop stop)
            {
                double location = e.GetPosition(_gradientContainer).X;
                stop.Offset = (location / _gradientContainer.ActualWidth).Clamp(0, 1);
            }
        }

        protected override void OnMouseLeave(MouseEventArgs e)
        {
            base.OnMouseLeave(e);

            _draggingStop = null;
        }

        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonUp(e);

            _draggingStop = null;
        }

        private static void SelectedStopChanged(DependencyObject dependencyObject,
                                                DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (!(dependencyObject is GradientEditor gradientEditor)) return;

            if (gradientEditor._adorner != null)
                gradientEditor._adornerLayer.Remove(gradientEditor._adorner);

            if (dependencyPropertyChangedEventArgs.OldValue is GradientStop oldStop)
            {
                if (gradientEditor._stops.TryGetValue(oldStop, out ContentControl oldcontrol))
                    SetIsSelected(oldcontrol, false);
            }

            if (dependencyPropertyChangedEventArgs.NewValue is GradientStop stop)
            {
                ContentControl stopContainer = gradientEditor._stops[stop];
                SetIsSelected(stopContainer, true);

                if (gradientEditor._adornerLayer != null)
                {
                    ContentControl contentControl = new ContentControl
                    {
                        ContentTemplate = gradientEditor.ColorSelectorTemplate,
                        Content = stop
                    };

                    ColorPickerAdorner adorner = new ColorPickerAdorner(stopContainer, contentControl);
                    gradientEditor._adorner = adorner;
                    gradientEditor._adornerLayer.Add(adorner);
                }
            }
        }

        private void WindowMouseDown(object o, MouseButtonEventArgs mouseButtonEventArgs)
        {
            if ((_adorner != null) && (VisualTreeHelper.HitTest(_adorner, mouseButtonEventArgs.GetPosition(_adorner)) == null))
                SelectedStop = null;
        }

        #endregion
    }

    public class ColorPickerAdorner : Adorner
    {
        #region Properties & Fields

        private readonly VisualCollection _visualChildren;
        private readonly FrameworkElement _colorSelector;
        protected override int VisualChildrenCount => 1;
        protected override Visual GetVisualChild(int index) => _colorSelector;

        #endregion

        #region Constructors

        public ColorPickerAdorner(UIElement adornedElement, FrameworkElement colorSelector)
            : base(adornedElement)
        {
            this._colorSelector = colorSelector;

            _visualChildren = new VisualCollection(this) { colorSelector };
        }

        #endregion

        #region Methods

        protected override Size ArrangeOverride(Size finalSize)
        {
            Window referenceWindow = Window.GetWindow(AdornedElement);
            Point referenceLocation = AdornedElement.TranslatePoint(new Point(0, 0), referenceWindow);

            double referenceWidth = ((FrameworkElement)AdornedElement).ActualWidth / 2.0;
            double referenceHeight = ((FrameworkElement)AdornedElement).Height;
            double referenceX = referenceLocation.X + referenceWidth;
            double halfWidth = finalSize.Width / 2.0;
            double maxOffset = referenceWindow.Width - halfWidth;

            double offset = (referenceX < halfWidth ? referenceX
                                                    : (((referenceX + (referenceWidth * 2)) > maxOffset)
                                                        ? halfWidth - ((maxOffset - referenceX) - (referenceWidth * 2))
                                                        : halfWidth));

            _colorSelector.Arrange(new Rect(new Point(referenceWidth - offset, referenceHeight), finalSize));
            return _colorSelector.RenderSize;
        }

        protected override Size MeasureOverride(Size constraint)
        {
            _colorSelector.Measure(constraint);
            return _colorSelector.DesiredSize;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Controls/ImageButton.cs
================================================
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace KeyboardAudioVisualizer.Controls
{
    public class ImageButton : Button
    {
        #region Properties & Fields
        // ReSharper disable InconsistentNaming

        public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(
            "Image", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));

        public ImageSource Image
        {
            get => (ImageSource)GetValue(ImageProperty);
            set => SetValue(ImageProperty, value);
        }

        public static readonly DependencyProperty HoverImageProperty = DependencyProperty.Register(
            "HoverImage", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));

        public ImageSource HoverImage
        {
            get => (ImageSource)GetValue(HoverImageProperty);
            set => SetValue(HoverImageProperty, value);
        }

        public static readonly DependencyProperty PressedImageProperty = DependencyProperty.Register(
            "PressedImage", typeof(ImageSource), typeof(ImageButton), new PropertyMetadata(default(ImageSource)));

        public ImageSource PressedImage
        {
            get => (ImageSource)GetValue(PressedImageProperty);
            set => SetValue(PressedImageProperty, value);
        }

        // ReSharper restore InconsistentNaming
        #endregion

        #region Constructors

        static ImageButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(typeof(ImageButton)));
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/BoolToVisibilityConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace KeyboardAudioVisualizer.Converter
{
    [ValueConversion(typeof(bool), typeof(Visibility))]
    public class BoolToVisibilityConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            => (value as bool?) == true ? Visibility.Visible
            : (string.Equals(parameter?.ToString(), "true", StringComparison.OrdinalIgnoreCase) ? Visibility.Hidden : Visibility.Collapsed);

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => value as Visibility? == Visibility.Visible;

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/EqualizerBandsToPointsConverter.cs
================================================
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using KeyboardAudioVisualizer.AudioProcessing.Equalizer;

namespace KeyboardAudioVisualizer.Converter
{
    public class EqualizerBandsToPointsConverter : IMultiValueConverter
    {
        #region Methods

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            PointCollection points = new PointCollection();

            if ((values.Length != 4) || (parameter == DependencyProperty.UnsetValue)
                || (values[0] == null) || (values[0] == DependencyProperty.UnsetValue)
                || (values[1] == null) || (values[1] == DependencyProperty.UnsetValue) //HACK DarthAffe 13.08.2017: I need this only to update the binding
                || (values[2] == null) || (values[2] == DependencyProperty.UnsetValue)
                || (values[3] == null) || (values[3] == DependencyProperty.UnsetValue))
                return points;

            IEqualizer equalizer = (IEqualizer)values[0];
            double width = (double)values[2];
            double height = (double)values[3];
            int valueCount = int.Parse(parameter.ToString());
            double halfHeight = height / 2.0;

            List<(float offset, float value)> pointValues = equalizer.Bands.Select(b => (b.Offset, b.Value)).ToList();
            float[] calculatedValues = equalizer.CalculateValues(valueCount);
            for (int i = 0; i < calculatedValues.Length; i++)
                pointValues.Add(((float)i / calculatedValues.Length, calculatedValues[i]));

            foreach ((float offset, float value) in pointValues.OrderBy(x => x.offset))
                points.Add(new Point(offset * width, GetPosY(value, halfHeight)));

            return points;
        }

        private double GetPosY(float offset, double halfHeight)
        {
            if (offset < 0)
                return halfHeight + (-offset * halfHeight);

            if (offset > 0)
                return halfHeight - (offset * halfHeight);

            return halfHeight;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotSupportedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/EqualsToBoolConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows.Data;

namespace KeyboardAudioVisualizer.Converter
{
    [ValueConversion(typeof(object), typeof(bool))]
    public class EqualsToBoolConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => Equals(value, parameter);

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/OffsetToPosXConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace KeyboardAudioVisualizer.Converter
{
    public class OffsetToPosXConverter : IMultiValueConverter
    {
        #region Methods

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if ((values.Length != 2) || (parameter == DependencyProperty.UnsetValue)
                || (values[0] == null) || (values[0] == DependencyProperty.UnsetValue)
                || (values[1] == null) || (values[1] == DependencyProperty.UnsetValue))
                return 0;

            float offset = (float)values[0];
            double width = (double)values[1];
            double correction = double.Parse(parameter.ToString());

            return (offset * width) - correction;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/ValueToPosYConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace KeyboardAudioVisualizer.Converter
{
    public class ValueToPosYConverter : IMultiValueConverter
    {
        #region Methods

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if ((values.Length != 2) || (parameter == DependencyProperty.UnsetValue)
                || (values[0] == null) || (values[0] == DependencyProperty.UnsetValue)
                || (values[1] == null) || (values[1] == DependencyProperty.UnsetValue))
                return 0;

            float offset = (float)values[0];
            double height = (double)values[1];
            double correction = double.Parse(parameter.ToString());

            double halfHeight = height / 2.0;
            
            if (offset < 0)
                return (halfHeight + (-offset * halfHeight)) - correction;

            if (offset > 0)
                return (halfHeight - (offset * halfHeight)) - correction;

            return halfHeight - correction;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/VisualizationProviderDisplayNameConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows.Data;
using KeyboardAudioVisualizer.Attributes;
using KeyboardAudioVisualizer.Helper;
using VisualizationType = KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider.VisualizationType;

namespace KeyboardAudioVisualizer.Converter
{
    [ValueConversion(typeof(VisualizationType), typeof(string))]
    public class VisualizationProviderDisplayNameConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is VisualizationType visualizationType)) return null;
            return visualizationType.GetAttribute<DisplayNameAttribute>()?.DisplayName ?? visualizationType.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/VisualizationToLastChildFillConverter.cs
================================================
using System;
using System.Globalization;
using System.Windows.Data;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using KeyboardAudioVisualizer.UI.Visualization;

namespace KeyboardAudioVisualizer.Converter
{
    [ValueConversion(typeof(IVisualizationProvider), typeof(bool))]
    public class VisualizationToLastChildFillConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value is FrequencyBarsVisualizationProvider;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Converter/VisualizationTypeSelectableConverter.cs
================================================
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
using KeyboardAudioVisualizer.Attributes;
using KeyboardAudioVisualizer.Helper;
using RGB.NET.Core;
using VisualizationType = KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider.VisualizationType;

namespace KeyboardAudioVisualizer.Converter
{
    [ValueConversion(typeof(IEnumerable<VisualizationType>), typeof(IEnumerable<VisualizationType>))]
    public class VisualizationTypeSelectableConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is IEnumerable<VisualizationType> visualizationProviders) || !(parameter is RGBDeviceType targetDevice)) return new List<VisualizationType>();
            return visualizationProviders.Where(x => x.GetAttribute<VisualizerForAttribute>()?.VisualizerFor.HasFlag(targetDevice) ?? true).ToList();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Decorators/BeatDecorator.cs
================================================
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Decorators
{
    public class BeatDecorator : AbstractUpdateAwareDecorator, IBrushDecorator
    {
        #region Properties & Fields

        private readonly IVisualizationProvider _visualizationProvider;

        #endregion

        #region Constructors

        public BeatDecorator(IVisualizationProvider visualizationProvider)
        {
            this._visualizationProvider = visualizationProvider;
        }

        #endregion

        #region Methods

        protected override void Update(double deltaTime) => _visualizationProvider.Update();

        #endregion

        public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color) => color.SetA(color.A * _visualizationProvider.VisualizationData[0]);
    }
}


================================================
FILE: KeyboardAudioVisualizer/Decorators/FrequencyBarsDecorator.cs
================================================
using System;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using RGB.NET.Core;
using Color = RGB.NET.Core.Color;
using Rectangle = RGB.NET.Core.Rectangle;

namespace KeyboardAudioVisualizer.Decorators
{
    public class FrequencyBarsDecorator : AbstractUpdateAwareDecorator, IBrushDecorator
    {
        #region Properties & Fields

        private readonly IVisualizationProvider _visualizationProvider;

        #endregion

        #region Constructors

        public FrequencyBarsDecorator(IVisualizationProvider visualizationProvider)
        {
            this._visualizationProvider = visualizationProvider;
        }

        #endregion

        #region Methods

        protected override void Update(double deltaTime) => _visualizationProvider.Update();

        public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
        {
            int barSampleIndex = Math.Min(_visualizationProvider.VisualizationData.Length, (int)Math.Floor(_visualizationProvider.VisualizationData.Length * (renderTarget.Point.X / (rectangle.Location.X + rectangle.Size.Width))));
            double curBarHeight = 1.0 - Math.Max(0f, _visualizationProvider.VisualizationData[barSampleIndex]);
            double verticalPos = (renderTarget.Point.Y / rectangle.Size.Height);

            return curBarHeight > verticalPos ? color.SetA(0) : color;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Decorators/LevelBarDecorator.cs
================================================
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;

namespace KeyboardAudioVisualizer.Decorators
{
    public class LevelBarDecorator : AbstractUpdateAwareDecorator, IBrushDecorator
    {
        #region Properties & Fields

        private readonly IVisualizationProvider _visualizationProvider;
        public LevelBarDirection Direction { get; set; }
        public int DataIndex { get; set; }
        public LinearGradient Gradient { get; set; }

        #endregion

        #region Constructors

        public LevelBarDecorator(IVisualizationProvider visualizationProvider, LevelBarDirection direction, int dataIndex, LinearGradient gradient)
        {
            this._visualizationProvider = visualizationProvider;
            this.Direction = direction;
            this.DataIndex = dataIndex;
            this.Gradient = gradient;
        }

        #endregion

        #region Methods

        protected override void Update(double deltaTime) => _visualizationProvider.Update();

        public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
        {
            double offset = CalculateOffset(rectangle, renderTarget);

            if (Direction == LevelBarDirection.Horizontal)
            {
                
                if (offset < 0)
                {
                    offset = (-offset * 2);
                    if (offset >= _visualizationProvider.VisualizationData[0])
                        return color.SetA(0);
                    else
                        return Gradient.GetColor(offset);
                }
                else
                {
                    offset *= 2;
                    if (offset >= _visualizationProvider.VisualizationData[1])
                        return color.SetA(0);
                    else
                        return Gradient.GetColor(offset);
                }
            }
            else
            {
                if (offset >= _visualizationProvider.VisualizationData[DataIndex])
                    return color.SetA(0);
            }

            return color;
        }

        private double CalculateOffset(Rectangle rectangle, BrushRenderTarget renderTarget)
        {
            switch (Direction)
            {
                case LevelBarDirection.Left:
                    return (rectangle.Size.Width - renderTarget.Rectangle.Center.X) / rectangle.Size.Width;

                case LevelBarDirection.Right:
                    return renderTarget.Rectangle.Center.X / rectangle.Size.Width;

                case LevelBarDirection.Top:
                    return (rectangle.Size.Height - renderTarget.Rectangle.Center.Y) / rectangle.Size.Height;

                case LevelBarDirection.Bottom:
                    return renderTarget.Rectangle.Center.Y / rectangle.Size.Height;

                case LevelBarDirection.Horizontal:
                    return (renderTarget.Rectangle.Center.X / rectangle.Size.Width) - 0.5;

                default:
                    return -1;
            }
        }

        #endregion
    }

    #region Data

    public enum LevelBarDirection
    {
        Left, Right, Top, Bottom,

        //HACK DarthAffe 12.09.2017: Just a bad workaround ...
        Horizontal
    }

    #endregion
}


================================================
FILE: KeyboardAudioVisualizer/Helper/ActionCommand.cs
================================================
using System;
using System.Windows.Input;

namespace KeyboardAudioVisualizer.Helper
{
    public class ActionCommand : ICommand
    {
        #region Properties & Fields

        private readonly Func<bool> _canExecute;
        private readonly Action _command;

        #endregion

        #region Events

        public event EventHandler CanExecuteChanged;

        #endregion

        #region Constructors

        public ActionCommand(Action command, Func<bool> canExecute = null)
        {
            this._command = command;
            this._canExecute = canExecute;
        }

        #endregion

        #region Methods

        public bool CanExecute(object parameter)
        {
            return _canExecute?.Invoke() ?? true;
        }

        public void Execute(object parameter)
        {
            _command?.Invoke();
        }

        public void RaiseCanExecuteChanged()
        {
            CanExecuteChanged?.Invoke(this, new EventArgs());
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/EnumExtension.cs
================================================
using System;
using System.Linq;

namespace KeyboardAudioVisualizer.Helper
{
    public static class EnumExtension
    {
        #region Methods

        public static T GetAttribute<T>(this Enum e)
            where T : Attribute => e.GetType().GetMember(e.ToString()).FirstOrDefault()?.GetCustomAttributes(typeof(T), false).FirstOrDefault() as T;

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/ExceptionExtension.cs
================================================
using System;

namespace KeyboardAudioVisualizer.Helper
{
    public static class ExceptionExtension
    {
        #region Methods

        public static string GetFullMessage(this Exception ex, string message = "")
        {
            if (ex == null) return string.Empty;

            message += ex.Message;

            if (ex.InnerException != null)
                message += "\r\nInnerException: " + GetFullMessage(ex.InnerException);

            return message;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/FrequencyHelper.cs
================================================
using System;

namespace KeyboardAudioVisualizer.Helper
{
    public static class FrequencyHelper
    {
        #region Constants

        private const int SAMPLE_RATE = 44100; // Right now this is fixed

        #endregion

        #region Methods

        public static float GetFrequencyOfIndex(int index, int count) => index * ((float)SAMPLE_RATE / count);
        public static int GetIndexOfFrequency(float frequency, int count) => (int)(frequency / ((float)SAMPLE_RATE / count));

        public static double CalculatedBAForFrequency(float frequency)
        {
            double ra = (Math.Pow(12194, 2) * Math.Pow(frequency, 4)) / ((Math.Pow(frequency, 2) + Math.Pow(20.6, 2)) * Math.Sqrt((Math.Pow(frequency, 2) + Math.Pow(107.7, 2)) * (Math.Pow(frequency, 2) + Math.Pow(737.9, 2))) * (Math.Pow(frequency, 2) + Math.Pow(12194, 2)));
            return (20 * Math.Log10(ra)) + 2;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/MathHelper.cs
================================================
using System;

namespace KeyboardAudioVisualizer.Helper
{
    public static class MathHelper
    {
        #region Methods

        public static double Clamp(double value, double min, double max) => Math.Max(min, Math.Min(max, value));
        public static float Clamp(float value, float min, float max) => (float)Clamp((double)value, min, max);
        public static int Clamp(int value, int min, int max) => Math.Max(min, Math.Min(max, value));

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/ObservableDictionary.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using RGB.NET.Core;

// Taken from https://codereview.stackexchange.com/questions/116562/custom-implementation-of-observabledictionary
namespace KeyboardAudioVisualizer.Helper
{
    public class ObservableDictionary<TKey, TValue> : AbstractBindable, IDictionary<TKey, TValue>, INotifyCollectionChanged
    {
        #region Constants

        private const string INDEXER_NAME = "Item[]";

        #endregion

        #region Properties & Fields

        private readonly IList<TValue> _values;
        private readonly IDictionary<TKey, int> _indexMap;

        private readonly SimpleMonitor _monitor = new SimpleMonitor();

        #endregion

        #region Constructor

        public ObservableDictionary()
        {
            _values = new List<TValue>();
            _indexMap = new Dictionary<TKey, int>();
        }

        public ObservableDictionary(IDictionary<TKey, TValue> dictionary)
        {
            _values = new List<TValue>();
            _indexMap = new Dictionary<TKey, int>();

            int idx = 0;
            foreach (KeyValuePair<TKey, TValue> kvp in dictionary)
            {
                _indexMap.Add(kvp.Key, idx);
                _values.Add(kvp.Value);

                idx++;
            }
        }

        public ObservableDictionary(int capacity)
        {
            _values = new List<TValue>(capacity);
            _indexMap = new Dictionary<TKey, int>(capacity);
        }

        #endregion

        #region Virtual Add/Remove/Change Control Methods

        protected virtual void AddItem(TKey key, TValue value)
        {
            CheckReentrancy();

            int index = _values.Count;
            _indexMap.Add(key, index);
            _values.Add(value);

            OnPropertyChanged(nameof(Count));
            OnPropertyChanged(nameof(Keys));
            OnPropertyChanged(nameof(Values));
            OnPropertyChanged(INDEXER_NAME);
            OnCollectionChanged(NotifyCollectionChangedAction.Add, key, value, index);
        }

        protected virtual bool RemoveItem(TKey key)
        {
            CheckReentrancy();

            int index = _indexMap[key];
            TValue value = _values[index];

            if (_indexMap.Remove(key))
            {
                _values.RemoveAt(index);

                List<TKey> keys = _indexMap.Keys.ToList();

                foreach (TKey existingKey in keys)
                {
                    if (_indexMap[existingKey] > index)
                        _indexMap[existingKey]--;
                }

                OnPropertyChanged(nameof(Count));
                OnPropertyChanged(nameof(Keys));
                OnPropertyChanged(nameof(Values));
                OnPropertyChanged(INDEXER_NAME);
                OnCollectionChanged(NotifyCollectionChangedAction.Remove, key, value, index);

                return true;
            }

            return false;
        }

        protected virtual bool RemoveItem(KeyValuePair<TKey, TValue> item)
        {
            CheckReentrancy();

            if (_indexMap.ContainsKey(item.Key) && _values[_indexMap[item.Key]].Equals(item.Value))
            {
                int index = _indexMap[item.Key];
                TValue value = _values[index];

                _indexMap.Remove(item.Key);
                _values.RemoveAt(index);

                List<TKey> keys = _indexMap.Keys.ToList();

                foreach (TKey existingKey in keys)
                {
                    if (_indexMap[existingKey] > index)
                        _indexMap[existingKey]--;
                }

                OnPropertyChanged(nameof(Count));
                OnPropertyChanged(nameof(Keys));
                OnPropertyChanged(nameof(Values));
                OnPropertyChanged(INDEXER_NAME);
                OnCollectionChanged(NotifyCollectionChangedAction.Remove, item.Key, item.Value, index);

                return true;
            }

            return false;
        }

        protected virtual void RemoveAllItems()
        {

            CheckReentrancy();
            _values.Clear();
            _indexMap.Clear();

            OnPropertyChanged(nameof(Count));
            OnPropertyChanged(nameof(Keys));
            OnPropertyChanged(nameof(Values));
            OnPropertyChanged(INDEXER_NAME);
            OnCollectionChanged(NotifyCollectionChangedAction.Reset);
        }

        protected virtual void ChangeItem(TKey key, TValue newValue)
        {

            CheckReentrancy();

            if (!_indexMap.ContainsKey(key))
                AddItem(key, newValue);
            else
            {
                int index = _indexMap[key];
                TValue oldValue = _values[index];
                _values[index] = newValue;

                OnPropertyChanged(nameof(Values));
                OnPropertyChanged(INDEXER_NAME);
                OnCollectionChanged(NotifyCollectionChangedAction.Replace, key, oldValue, newValue, index);
            }
        }

        protected IDisposable BlockReentrancy()
        {
            _monitor.Enter();
            return (IDisposable)_monitor;
        }

        protected void CheckReentrancy()
        {
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            if (_monitor.Busy && CollectionChanged != null && CollectionChanged.GetInvocationList().Length > 1)
                throw new InvalidOperationException("ObservableCollectionReentrancyNotAllowed");
        }


        #endregion

        #region IDictionary<TKey,TValue> Members

        public void Add(TKey key, TValue value) => AddItem(key, value);

        public bool ContainsKey(TKey key) => _indexMap.ContainsKey(key);

        public bool Remove(TKey key) => RemoveItem(key);

        public bool TryGetValue(TKey key, out TValue value)
        {
            if (_indexMap.TryGetValue(key, out int index))
            {
                value = _values[index];
                return true;
            }
            else
            {
                value = default;
                return false;
            }
        }


        public ICollection<TKey> Keys => _indexMap.Keys;

        public ICollection<TValue> Values => _values;

        public TValue this[TKey key]
        {
            get
            {
                int index = _indexMap[key];
                return _values[index];
            }
            set => ChangeItem(key, value);
        }

        #endregion

        #region ICollection<KeyValuePair<TKey,TValue>> Members

        public void Clear() => RemoveAllItems();

        public int Count => _indexMap.Count;

        void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item) => Add(item.Key, item.Value);

        bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item) => _indexMap.ContainsKey(item.Key) && _values[_indexMap[item.Key]].Equals(item.Value);

        void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
        {
            foreach (KeyValuePair<TKey, int> kvp in _indexMap)
            {
                array[arrayIndex] = new KeyValuePair<TKey, TValue>(kvp.Key, _values[kvp.Value]);
                arrayIndex++;
            }
        }

        bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => false;

        bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item) => RemoveItem(item);

        #endregion

        #region IEnumerable<KeyValuePair<TKey,TValue>> Members

        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
        {
            foreach (KeyValuePair<TKey, int> kvp in _indexMap)
            {
                KeyValuePair<TKey, TValue> pair = new KeyValuePair<TKey, TValue>(kvp.Key, _values[kvp.Value]);
                yield return pair;
            }
        }

        #endregion

        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

        #endregion

        #region INotifyCollectionChanged Members

        public event NotifyCollectionChangedEventHandler CollectionChanged;

        protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            NotifyCollectionChangedEventHandler handler = CollectionChanged;

            using (BlockReentrancy())
                handler?.Invoke(this, e);
        }

        protected void OnCollectionChanged(NotifyCollectionChangedAction action) => OnCollectionChanged(new NotifyCollectionChangedEventArgs(action));

        protected void OnCollectionChanged(NotifyCollectionChangedAction action, TKey key, TValue value, int index) => OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, new KeyValuePair<TKey, TValue>(key, value), index));

        protected void OnCollectionChanged(NotifyCollectionChangedAction action, TKey key, TValue oldValue, TValue newValue, int index)
        {
            KeyValuePair<TKey, TValue> newPair = new KeyValuePair<TKey, TValue>(key, newValue);
            KeyValuePair<TKey, TValue> oldPair = new KeyValuePair<TKey, TValue>(key, oldValue);

            OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, newPair, oldPair, index));
        }

        #endregion

        private class SimpleMonitor : IDisposable
        {
            private int _busyCount;

            public bool Busy => _busyCount > 0;

            public void Enter() => _busyCount = _busyCount + 1;

            public void Dispose() => _busyCount = _busyCount - 1;
        }
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/RingBuffer.cs
================================================
using System.Linq;

namespace KeyboardAudioVisualizer.Helper
{
    public class RingBuffer
    {
        #region Properties & Fields

        private readonly int _capacity;
        private readonly float[] _buffer;
        private int _currentIndex;

        public int Size => _capacity;

        public float Average => _buffer.Average();
        public float Min => _buffer.Min();
        public float Max => _buffer.Max();
        public float Sum => _buffer.Sum();

        #endregion

        #region Constructors

        public RingBuffer(int capacity)
        {
            this._capacity = capacity;

            _buffer = new float[capacity];
        }

        #endregion

        #region Methods

        public void Put(float value) => Put(new[] { value }, 0, 1);

        public void Put(float[] src, int offset, int count)
        {
            lock (_buffer)
            {
                if (count > _capacity)
                {
                    offset += count - _capacity;
                    count = _capacity;
                }

                for (int i = 0; i < count; i++)
                {
                    _currentIndex++;
                    if (_currentIndex >= _capacity) _currentIndex = 0;

                    _buffer[_currentIndex] = src[offset + i];
                }
            }
        }


        public void CopyInto(ref float[] data, int offset) => CopyInto(ref data, offset, _capacity);
        public void CopyInto(ref float[] data, int offset, int count)
        {
            lock (_buffer)
                for (int i = _capacity - count; i < count; i++)
                    data[offset + i] = _buffer[(_currentIndex + i) % _capacity];
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/VisualizationIndex.cs
================================================
namespace KeyboardAudioVisualizer.Helper
{
    public enum VisualizationIndex
    {
        Primary,
        Secondary,
        Tertiary
    }
}


================================================
FILE: KeyboardAudioVisualizer/Helper/WPFHelper.cs
================================================
using System.Windows;
using System.Windows.Media;

namespace KeyboardAudioVisualizer.Helper
{
    public static class WPFHelper
    {
        #region Methods

        public static T GetVisualChild<T>(this DependencyObject parent)
            where T : Visual
        {
            T child = default(T);

            int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
            for (int i = 0; i < numVisuals; i++)
            {
                Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
                child = v as T;

                if (child == null)
                    child = GetVisualChild<T>(v);

                if (child != null)
                    break;
            }
            return child;
        }

        #endregion
    }
}


================================================
FILE: KeyboardAudioVisualizer/KeyboardAudioVisualizer.csproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{0AC4E8B1-4D4D-447F-B9FD-38A74ED1F243}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>KeyboardAudioVisualizer</RootNamespace>
    <AssemblyName>KeyboardAudioVisualizer</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="CSCore, Version=1.2.1.2, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
      <HintPath>..\packages\CSCore.1.2.1.2\lib\net35-client\CSCore.dll</HintPath>
    </Reference>
    <Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
    </Reference>
    <Reference Include="HidSharp, Version=2.0.5.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\HidSharp.2.0.5\lib\net35\HidSharp.dll</HintPath>
    </Reference>
    <Reference Include="Interop.AuraServiceLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Asus.0.1.31\lib\net45\Interop.AuraServiceLib.dll</HintPath>
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </Reference>
    <Reference Include="MathNet.Numerics, Version=4.7.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\MathNet.Numerics.4.7.0\lib\net461\MathNet.Numerics.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Brushes, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Brushes.0.1.31\lib\net45\RGB.NET.Brushes.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Core, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Core.0.1.31\lib\net45\RGB.NET.Core.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Decorators, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Decorators.0.1.31\lib\net45\RGB.NET.Decorators.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.Asus, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Asus.0.1.31\lib\net45\RGB.NET.Devices.Asus.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.CoolerMaster, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.CoolerMaster.0.1.31\lib\net45\RGB.NET.Devices.CoolerMaster.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.Corsair, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Corsair.0.1.31\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.Logitech, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Logitech.0.1.31\lib\net45\RGB.NET.Devices.Logitech.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.Novation, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Novation.0.1.31\lib\net45\RGB.NET.Devices.Novation.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.Razer, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.Razer.0.1.31\lib\net45\RGB.NET.Devices.Razer.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Devices.SteelSeries, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Devices.SteelSeries.0.1.31\lib\netstandard2.0\RGB.NET.Devices.SteelSeries.dll</HintPath>
    </Reference>
    <Reference Include="RGB.NET.Groups, Version=0.1.31.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\RGB.NET.Groups.0.1.31\lib\net45\RGB.NET.Groups.dll</HintPath>
    </Reference>
    <Reference Include="Sanford.Multimedia.Midi, Version=6.6.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\Sanford.Multimedia.Midi.6.6.0\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Management" />
    <Reference Include="System.Numerics" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
    </Reference>
    <Reference Include="System.Xml" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="Transitionals">
      <HintPath>..\libs\Transitionals.dll</HintPath>
    </Reference>
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Compile Include="Attached\SliderValue.cs" />
    <Compile Include="Attached\SliderValueAdorner.cs" />
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="ApplicationManager.cs" />
    <Compile Include="Attributes\DisplayNameAttribute.cs" />
    <Compile Include="Attributes\VisualizerForAttribute.cs" />
    <Compile Include="AudioCapture\AudioBuffer.cs" />
    <Compile Include="AudioCapture\CSCoreAudioInput.cs" />
    <Compile Include="AudioCapture\IAudioInput.cs" />
    <Compile Include="AudioProcessing\AbstractAudioProcessor.cs" />
    <Compile Include="AudioProcessing\AudioVisualizationFactory.cs" />
    <Compile Include="AudioProcessing\Equalizer\EqualizerBand.cs" />
    <Compile Include="AudioProcessing\Equalizer\IEqualizer.cs" />
    <Compile Include="AudioProcessing\Equalizer\MultiBandEqualizer.cs" />
    <Compile Include="AudioProcessing\IAudioProcessor.cs" />
    <Compile Include="AudioProcessing\Spectrum\Band.cs" />
    <Compile Include="AudioProcessing\Spectrum\AbstractSpectrum.cs" />
    <Compile Include="AudioProcessing\Spectrum\GammaSpectrum.cs" />
    <Compile Include="AudioProcessing\Spectrum\ISpectrum.cs" />
    <Compile Include="AudioProcessing\Spectrum\ISpectrumProvider.cs" />
    <Compile Include="AudioProcessing\Spectrum\FourierSpectrumProvider.cs" />
    <Compile Include="AudioProcessing\Spectrum\LogarithmicSpectrum.cs" />
    <Compile Include="AudioProcessing\Spectrum\LinearSpectrum.cs" />
    <Compile Include="AudioProcessing\VisualizationProvider\BeatVisualizationProvider.cs" />
    <Compile Include="AudioProcessing\VisualizationProvider\FrequencyBarsVisualizationProvider.cs" />
    <Compile Include="AudioProcessing\VisualizationProvider\IVisualizationProvider.cs" />
    <Compile Include="AudioProcessing\VisualizationProvider\LevelVisualizationProvider.cs" />
    <Compile Include="AudioProcessing\Spectrum\RawSpectrumProvider.cs" />
    <Compile Include="AudioProcessing\VisualizationProvider\VisualizationType.cs" />
    <Compile Include="Configuration\ColorSerializer.cs" />
    <Compile Include="Controls\ColorSelector.cs" />
    <Compile Include="Controls\GradientEditor.cs" />
    <Compile Include="Converter\VisualizationProviderDisplayNameConverter.cs" />
    <Compile Include="Converter\VisualizationToLastChildFillConverter.cs" />
    <Compile Include="Converter\VisualizationTypeSelectableConverter.cs" />
    <Compile Include="Decorators\BeatDecorator.cs" />
    <Compile Include="Decorators\FrequencyBarsDecorator.cs" />
    <Compile Include="Decorators\LevelBarDecorator.cs" />
    <Compile Include="Configuration\AbstractConfiguration.cs" />
    <Compile Include="Configuration\EqualizerConfiguration.cs" />
    <Compile Include="Configuration\IConfiguration.cs" />
    <Compile Include="Controls\Form.cs" />
    <Compile Include="Controls\ImageButton.cs" />
    <Compile Include="Converter\BoolToVisibilityConverter.cs" />
    <Compile Include="Converter\EqualizerBandsToPointsConverter.cs" />
    <Compile Include="Converter\EqualsToBoolConverter.cs" />
    <Compile Include="Converter\OffsetToPosXConverter.cs" />
    <Compile Include="Converter\ValueToPosYConverter.cs" />
    <Compile Include="Helper\ActionCommand.cs" />
    <Compile Include="Helper\EnumExtension.cs" />
    <Compile Include="Helper\ExceptionExtension.cs" />
    <Compile Include="Helper\FrequencyHelper.cs" />
    <Compile Include="Helper\MathHelper.cs" />
    <Compile Include="Helper\ObservableDictionary.cs" />
    <Compile Include="Helper\RingBuffer.cs" />
    <Compile Include="Helper\VisualizationIndex.cs" />
    <Compile Include="Helper\WPFHelper.cs" />
    <Compile Include="Configuration\Settings.cs" />
    <Compile Include="Controls\BlurredDecorationWindow.cs" />
    <Compile Include="Legacy\ConfigurationMigrator.cs" />
    <Compile Include="Legacy\ConfigurationUpdates.cs" />
    <Compile Include="Legacy\Settings.cs" />
    <Compile Include="Styles\CachedResourceDictionary.cs" />
    <Compile Include="UI\ConfigurationWindow.xaml.cs">
      <DependentUpon>ConfigurationWindow.xaml</DependentUpon>
    </Compile>
    <Compile Include="UI\ConfigurationViewModel.cs" />
    <Compile Include="UI\Visualization\BeatVisualizer.cs" />
    <Compile Include="UI\Visualization\EqualizerVisualizer.cs" />
    <Compile Include="UI\Visualization\FrequencyBarsVisualizer.cs" />
    <Compile Include="UI\Visualization\LevelVisualizer.cs" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Legacy\SerializationHelper.cs" />
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <None Include="packages.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Resource Include="Resources\navigation.ttf" />
    <Resource Include="Resources\font.ttf" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <Resource Include="Resources\Icon.ico" />
  </ItemGroup>
  <ItemGroup>
    <Page Include="Resources\KeyboardAudioVisualizer.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\BlurredDecorationWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\ColorSelector.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\FrameworkElement.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\ComboBox.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\Button.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\GradientEditor.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\Slider.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\ImageButton.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\Theme.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\Navigation.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\GroupBox.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\Form.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="Styles\ToolTip.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\ConfigurationWindow.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\Configuration\BeatConfiguration.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Configuration\LevelConfiguration.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Configuration\FrequencyBarsConfiguration.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Visualization\BeatVisualization.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Visualization\EqualizerVisualization.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Visualization\FrequencyBarsVisualization.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Page Include="UI\Visualization\LevelVisualization.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Resource Include="Resources\background.png" />
    <Resource Include="Resources\close.png" />
    <Resource Include="Resources\minimize.png" />
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.Novation.0.1.0\build\RGB.NET.Resources.Novation.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Novation.0.1.0\build\RGB.NET.Resources.Novation.targets'))" />
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.CoolerMaster.0.2.0\build\RGB.NET.Resources.CoolerMaster.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.CoolerMaster.0.2.0\build\RGB.NET.Resources.CoolerMaster.targets'))" />
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets'))" />
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.Logitech.0.3.0\build\RGB.NET.Resources.Logitech.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Logitech.0.3.0\build\RGB.NET.Resources.Logitech.targets'))" />
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.Razer.0.3.2.4\build\RGB.NET.Resources.Razer.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Razer.0.3.2.4\build\RGB.NET.Resources.Razer.targets'))" />
    <Error Condition="!Exists('..\packages\RGB.NET.Resources.Asus.0.3.0\build\RGB.NET.Resources.Asus.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Asus.0.3.0\build\RGB.NET.Resources.Asus.targets'))" />
  </Target>
  <Import Project="..\packages\RGB.NET.Resources.Novation.0.1.0\build\RGB.NET.Resources.Novation.targets" Condition="Exists('..\packages\RGB.NET.Resources.Novation.0.1.0\build\RGB.NET.Resources.Novation.targets')" />
  <Import Project="..\packages\RGB.NET.Resources.CoolerMaster.0.2.0\build\RGB.NET.Resources.CoolerMaster.targets" Condition="Exists('..\packages\RGB.NET.Resources.CoolerMaster.0.2.0\build\RGB.NET.Resources.CoolerMaster.targets')" />
  <Import Project="..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" />
  <Import Project="..\packages\RGB.NET.Resources.Logitech.0.3.0\build\RGB.NET.Resources.Logitech.targets" Condition="Exists('..\packages\RGB.NET.Resources.Logitech.0.3.0\build\RGB.NET.Resources.Logitech.targets')" />
  <Import Project="..\packages\RGB.NET.Resources.Razer.0.3.2.4\build\RGB.NET.Resources.Razer.targets" Condition="Exists('..\packages\RGB.NET.Resources.Razer.0.3.2.4\build\RGB.NET.Resources.Razer.targets')" />
  <Import Project="..\packages\RGB.NET.Resources.Asus.0.3.0\build\RGB.NET.Resources.Asus.targets" Condition="Exists('..\packages\RGB.NET.Resources.Asus.0.3.0\build\RGB.NET.Resources.Asus.targets')" />
</Project>

================================================
FILE: KeyboardAudioVisualizer/KeyboardAudioVisualizer.csproj.DotSettings
================================================
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
	<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary>

================================================
FILE: KeyboardAudioVisualizer/Legacy/ConfigurationMigrator.cs
================================================
using System.IO;
using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;
using KeyboardAudioVisualizer.Helper;

namespace KeyboardAudioVisualizer.Legacy
{
    public static class Conf
Download .txt
gitextract_124yql35/

├── .gitattributes
├── .gitignore
├── KeyboardAudioVisualizer/
│   ├── App.config
│   ├── App.xaml
│   ├── App.xaml.cs
│   ├── ApplicationManager.cs
│   ├── Attached/
│   │   ├── SliderValue.cs
│   │   └── SliderValueAdorner.cs
│   ├── Attributes/
│   │   ├── DisplayNameAttribute.cs
│   │   └── VisualizerForAttribute.cs
│   ├── AudioCapture/
│   │   ├── AudioBuffer.cs
│   │   ├── CSCoreAudioInput.cs
│   │   └── IAudioInput.cs
│   ├── AudioProcessing/
│   │   ├── AbstractAudioProcessor.cs
│   │   ├── AudioVisualizationFactory.cs
│   │   ├── Equalizer/
│   │   │   ├── EqualizerBand.cs
│   │   │   ├── IEqualizer.cs
│   │   │   └── MultiBandEqualizer.cs
│   │   ├── IAudioProcessor.cs
│   │   ├── Spectrum/
│   │   │   ├── AbstractSpectrum.cs
│   │   │   ├── Band.cs
│   │   │   ├── FourierSpectrumProvider.cs
│   │   │   ├── GammaSpectrum.cs
│   │   │   ├── ISpectrum.cs
│   │   │   ├── ISpectrumProvider.cs
│   │   │   ├── LinearSpectrum.cs
│   │   │   ├── LogarithmicSpectrum.cs
│   │   │   └── RawSpectrumProvider.cs
│   │   ├── VisualizationPRovider/
│   │   │   ├── FrequencyBarsVisualizationProvider.cs
│   │   │   └── IVisualizationProvider.cs
│   │   └── VisualizationProvider/
│   │       ├── BeatVisualizationProvider.cs
│   │       ├── LevelVisualizationProvider.cs
│   │       └── VisualizationType.cs
│   ├── Configuration/
│   │   ├── AbstractConfiguration.cs
│   │   ├── ColorSerializer.cs
│   │   ├── EqualizerConfiguration.cs
│   │   ├── IConfiguration.cs
│   │   └── Settings.cs
│   ├── Controls/
│   │   ├── BlurredDecorationWindow.cs
│   │   ├── ColorSelector.cs
│   │   ├── Form.cs
│   │   ├── GradientEditor.cs
│   │   └── ImageButton.cs
│   ├── Converter/
│   │   ├── BoolToVisibilityConverter.cs
│   │   ├── EqualizerBandsToPointsConverter.cs
│   │   ├── EqualsToBoolConverter.cs
│   │   ├── OffsetToPosXConverter.cs
│   │   ├── ValueToPosYConverter.cs
│   │   ├── VisualizationProviderDisplayNameConverter.cs
│   │   ├── VisualizationToLastChildFillConverter.cs
│   │   └── VisualizationTypeSelectableConverter.cs
│   ├── Decorators/
│   │   ├── BeatDecorator.cs
│   │   ├── FrequencyBarsDecorator.cs
│   │   └── LevelBarDecorator.cs
│   ├── Helper/
│   │   ├── ActionCommand.cs
│   │   ├── EnumExtension.cs
│   │   ├── ExceptionExtension.cs
│   │   ├── FrequencyHelper.cs
│   │   ├── MathHelper.cs
│   │   ├── ObservableDictionary.cs
│   │   ├── RingBuffer.cs
│   │   ├── VisualizationIndex.cs
│   │   └── WPFHelper.cs
│   ├── KeyboardAudioVisualizer.csproj
│   ├── KeyboardAudioVisualizer.csproj.DotSettings
│   ├── Legacy/
│   │   ├── ConfigurationMigrator.cs
│   │   ├── ConfigurationUpdates.cs
│   │   ├── SerializationHelper.cs
│   │   └── Settings.cs
│   ├── Properties/
│   │   ├── AssemblyInfo.cs
│   │   ├── Resources.Designer.cs
│   │   ├── Resources.resx
│   │   ├── Settings.Designer.cs
│   │   └── Settings.settings
│   ├── Resources/
│   │   └── KeyboardAudioVisualizer.xaml
│   ├── Styles/
│   │   ├── BlurredDecorationWindow.xaml
│   │   ├── Button.xaml
│   │   ├── CachedResourceDictionary.cs
│   │   ├── ColorSelector.xaml
│   │   ├── ComboBox.xaml
│   │   ├── Form.xaml
│   │   ├── FrameworkElement.xaml
│   │   ├── GradientEditor.xaml
│   │   ├── GroupBox.xaml
│   │   ├── ImageButton.xaml
│   │   ├── Navigation.xaml
│   │   ├── Slider.xaml
│   │   ├── Theme.xaml
│   │   └── ToolTip.xaml
│   ├── UI/
│   │   ├── Configuration/
│   │   │   ├── BeatConfiguration.xaml
│   │   │   ├── FrequencyBarsConfiguration.xaml
│   │   │   └── LevelConfiguration.xaml
│   │   ├── ConfigurationViewModel.cs
│   │   ├── ConfigurationWindow.xaml
│   │   ├── ConfigurationWindow.xaml.cs
│   │   └── Visualization/
│   │       ├── BeatVisualization.xaml
│   │       ├── BeatVisualizer.cs
│   │       ├── EqualizerVisualization.xaml
│   │       ├── EqualizerVisualizer.cs
│   │       ├── FrequencyBarsVisualization.xaml
│   │       ├── FrequencyBarsVisualizer.cs
│   │       ├── LevelVisualization.xaml
│   │       └── LevelVisualizer.cs
│   └── packages.config
├── KeyboardAudioVisualizer.sln
├── KeyboardAudioVisualizer.sln.DotSettings
├── LICENSE
├── NuGet.Config
└── README.md
Download .txt
SYMBOL INDEX (376 symbols across 72 files)

FILE: KeyboardAudioVisualizer/App.xaml.cs
  class App (line 17) | public partial class App : Application
    method OnStartup (line 33) | protected override void OnStartup(StartupEventArgs e)
    method OnExit (line 83) | protected override void OnExit(ExitEventArgs e)

FILE: KeyboardAudioVisualizer/ApplicationManager.cs
  class ApplicationManager (line 24) | public class ApplicationManager
    method ApplicationManager (line 57) | private ApplicationManager() { }
    method InitializeDevices (line 63) | public void InitializeDevices()
    method LoadDevices (line 155) | private void LoadDevices(RGBSurface surface, IRGBDeviceProvider device...
    method ApplyVisualization (line 164) | public void ApplyVisualization(VisualizationIndex visualizationIndex, ...
    method CreateDecorator (line 182) | private IBrushDecorator CreateDecorator(VisualizationType visualizatio...
    method OpenConfiguration (line 196) | private void OpenConfiguration()
    method Exit (line 202) | private void Exit()

FILE: KeyboardAudioVisualizer/Attached/SliderValue.cs
  class SliderValue (line 10) | public static class SliderValue
    method SetUnit (line 18) | public static void SetUnit(DependencyObject element, string value) => ...
    method GetUnit (line 19) | public static string GetUnit(DependencyObject element) => (string)elem...
    method SetIsShown (line 24) | public static void SetIsShown(DependencyObject element, bool value) =>...
    method GetIsShown (line 25) | public static bool GetIsShown(DependencyObject element) => (bool)eleme...
    method SetBorderBrush (line 30) | public static void SetBorderBrush(DependencyObject element, Brush valu...
    method GetBorderBrush (line 31) | public static Brush GetBorderBrush(DependencyObject element) => (Brush...
    method SetBackground (line 36) | public static void SetBackground(DependencyObject element, Brush value...
    method GetBackground (line 37) | public static Brush GetBackground(DependencyObject element) => (Brush)...
    method SetForeground (line 42) | public static void SetForeground(DependencyObject element, Brush value...
    method GetForeground (line 43) | public static Brush GetForeground(DependencyObject element) => (Brush)...
    method SetFont (line 48) | public static void SetFont(DependencyObject element, FontFamily value)...
    method GetFont (line 49) | public static FontFamily GetFont(DependencyObject element) => (FontFam...
    method SetFontSize (line 54) | public static void SetFontSize(DependencyObject element, double value)...
    method GetFontSize (line 55) | public static double GetFontSize(DependencyObject element) => (double)...
    method IsShownChanged (line 62) | private static void IsShownChanged(DependencyObject dependencyObject, ...
    method SliderOnMouseEnter (line 79) | private static void SliderOnMouseEnter(object sender, MouseEventArgs m...
    method SliderOnMouseLeave (line 92) | private static void SliderOnMouseLeave(object sender, MouseEventArgs m...
    method RemoveAdorner (line 98) | private static void RemoveAdorner(Slider slider)

FILE: KeyboardAudioVisualizer/Attached/SliderValueAdorner.cs
  class SliderValueAdorner (line 10) | public class SliderValueAdorner : System.Windows.Documents.Adorner
    method SliderValueAdorner (line 29) | public SliderValueAdorner(UIElement adornedElement, string unit)
    method Cleanup (line 46) | public void Cleanup()
    method OnButtonSizeChanged (line 51) | private void OnButtonSizeChanged(object sender, SizeChangedEventArgs s...
    method OnRender (line 53) | protected override void OnRender(DrawingContext drawingContext)
    method GetText (line 64) | private string GetText()
    method CreateBorder (line 73) | private Geometry CreateBorder(double offset, double width, double height)

FILE: KeyboardAudioVisualizer/Attributes/DisplayNameAttribute.cs
  class DisplayNameAttribute (line 5) | public class DisplayNameAttribute : Attribute
    method DisplayNameAttribute (line 15) | public DisplayNameAttribute(string displayName)

FILE: KeyboardAudioVisualizer/Attributes/VisualizerForAttribute.cs
  class VisualizerForAttribute (line 6) | public class VisualizerForAttribute : Attribute
    method VisualizerForAttribute (line 16) | public VisualizerForAttribute(RGBDeviceType visualizerFor)

FILE: KeyboardAudioVisualizer/AudioCapture/AudioBuffer.cs
  class AudioBuffer (line 5) | public class AudioBuffer
    method AudioBuffer (line 22) | public AudioBuffer(int capacity)
    method Put (line 34) | public void Put(float left, float right)
    method Put (line 43) | public void Put(float[] src, int offset, int count)
    method CopyLeftInto (line 71) | public void CopyLeftInto(ref float[] data, int offset) => CopyLeftInto...
    method CopyLeftInto (line 72) | public void CopyLeftInto(ref float[] data, int offset, int count)
    method CopyRightInto (line 79) | public void CopyRightInto(ref float[] data, int offset) => CopyRightIn...
    method CopyRightInto (line 80) | public void CopyRightInto(ref float[] data, int offset, int count)
    method CopyMixInto (line 87) | public void CopyMixInto(ref float[] data, int offset) => CopyMixInto(r...
    method CopyMixInto (line 88) | public void CopyMixInto(ref float[] data, int offset, int count)

FILE: KeyboardAudioVisualizer/AudioCapture/CSCoreAudioInput.cs
  class CSCoreAudioInput (line 9) | public class CSCoreAudioInput : IAudioInput
    method Initialize (line 32) | public void Initialize()
    method Dispose (line 66) | public void Dispose()
    method StreamOnSingleBlockRead (line 72) | private void StreamOnSingleBlockRead(object sender, SingleBlockReadEve...

FILE: KeyboardAudioVisualizer/AudioCapture/IAudioInput.cs
  type IAudioInput (line 7) | public interface IAudioInput : IDisposable
    method Initialize (line 14) | void Initialize();

FILE: KeyboardAudioVisualizer/AudioProcessing/AbstractAudioProcessor.cs
  class AbstractAudioProcessor (line 3) | public abstract class AbstractAudioProcessor : IAudioProcessor
    method Initialize (line 13) | public abstract void Initialize();
    method Update (line 15) | public abstract void Update();
    method Dispose (line 17) | public virtual void Dispose() { }

FILE: KeyboardAudioVisualizer/AudioProcessing/AudioVisualizationFactory.cs
  class AudioVisualizationFactory (line 12) | public class AudioVisualizationFactory : IDisposable
    method AudioVisualizationFactory (line 26) | private AudioVisualizationFactory() { }
    method Update (line 32) | public void Update()
    method Initialize (line 43) | public static void Initialize()
    method InitializeInstance (line 51) | private void InitializeInstance()
    method GetAudioProcessor (line 65) | private T GetAudioProcessor<T>() => (T)_processors.FirstOrDefault(x =>...
    method CreateVisualizationProvider (line 67) | public IVisualizationProvider CreateVisualizationProvider(Visualizatio...
    method Dispose (line 92) | public void Dispose() => _audioInput.Dispose();

FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/EqualizerBand.cs
  class EqualizerBand (line 6) | public class EqualizerBand : AbstractBindable
    method EqualizerBand (line 34) | public EqualizerBand() : this(0) { }
    method EqualizerBand (line 36) | public EqualizerBand(float offset, float value = 0, bool fixedOffset =...

FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/IEqualizer.cs
  type IEqualizer (line 5) | public interface IEqualizer
    method CalculateValues (line 11) | float[] CalculateValues(int count);
    method AddBand (line 13) | EqualizerBand AddBand(float offset, float modification);
    method RemoveBandBand (line 14) | void RemoveBandBand(EqualizerBand band);
    method Reset (line 16) | void Reset();

FILE: KeyboardAudioVisualizer/AudioProcessing/Equalizer/MultiBandEqualizer.cs
  class MultiBandEqualizer (line 9) | public class MultiBandEqualizer : AbstractBindable, IEqualizer
    method MultiBandEqualizer (line 28) | public MultiBandEqualizer()
    method AddBand (line 37) | public EqualizerBand AddBand(float offset, float modification) => AddB...
    method AddBand (line 39) | public EqualizerBand AddBand(float offset, float modification, bool is...
    method RemoveBandBand (line 50) | public void RemoveBandBand(EqualizerBand band)
    method Reset (line 58) | public void Reset()
    method CalculateValues (line 65) | public float[] CalculateValues(int count)
    method RecalculateValues (line 75) | private float[] RecalculateValues(int count)
    method InvalidateCache (line 96) | private void InvalidateCache()

FILE: KeyboardAudioVisualizer/AudioProcessing/IAudioProcessor.cs
  type IAudioProcessor (line 5) | public interface IAudioProcessor : IDisposable
    method Initialize (line 9) | void Initialize();
    method Update (line 10) | void Update();

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/AbstractSpectrum.cs
  class AbstractSpectrum (line 7) | public abstract class AbstractSpectrum : ISpectrum
    method GetEnumerator (line 22) | public IEnumerator<Band> GetEnumerator() => Bands.AsEnumerable().GetEn...
    method GetEnumerator (line 23) | IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/Band.cs
  class Band (line 5) | public class Band
    method Band (line 35) | public Band(float lowerFrequency, float upperFrequency, float[] data)

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/FourierSpectrumProvider.cs
  class FourierSpectrumProvider (line 8) | public class FourierSpectrumProvider : AbstractAudioProcessor, ISpectrum...
    method FourierSpectrumProvider (line 25) | public FourierSpectrumProvider(AudioBuffer audioBuffer)
    method Initialize (line 34) | public override void Initialize()
    method Update (line 43) | public override void Update()
    method ApplyHamming (line 51) | private void ApplyHamming(ref float[] data)
    method CreateSpectrum (line 57) | private void CreateSpectrum(ref float[] data)
    method GetLinearSpectrum (line 71) | public ISpectrum GetLinearSpectrum(int bands = 64, float minFrequency ...
    method GetLogarithmicSpectrum (line 73) | public ISpectrum GetLogarithmicSpectrum(int bands = 12, float minFrequ...
    method GetGammaSpectrum (line 75) | public ISpectrum GetGammaSpectrum(int bands = 64, float gamma = 2, flo...
    method GetRawSpectrum (line 77) | public ISpectrum GetRawSpectrum() => new RawSpectrumProvider(_spectrum);

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/GammaSpectrum.cs
  class GammaSpectrum (line 6) | public class GammaSpectrum : AbstractSpectrum
    method GammaSpectrum (line 10) | public GammaSpectrum(float[] data, int bands, float gamma = 2, float m...

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrum.cs
  type ISpectrum (line 5) | public interface ISpectrum : IEnumerable<Band>

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrumProvider.cs
  type ISpectrumProvider (line 3) | public interface ISpectrumProvider : IAudioProcessor
    method GetLinearSpectrum (line 5) | ISpectrum GetLinearSpectrum(int bands = 64, float minFrequency = -1, f...
    method GetLogarithmicSpectrum (line 6) | ISpectrum GetLogarithmicSpectrum(int bands = 1, float minFrequency = -...
    method GetGammaSpectrum (line 7) | ISpectrum GetGammaSpectrum(int bands = 1, float gamma = 2, float minFr...
    method GetRawSpectrum (line 8) | ISpectrum GetRawSpectrum();

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/LinearSpectrum.cs
  class LinearSpectrum (line 6) | public class LinearSpectrum : AbstractSpectrum
    method LinearSpectrum (line 10) | public LinearSpectrum(float[] data, int bands, float minFrequency = -1...

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/LogarithmicSpectrum.cs
  class LogarithmicSpectrum (line 6) | public class LogarithmicSpectrum : AbstractSpectrum
    method LogarithmicSpectrum (line 10) | public LogarithmicSpectrum(float[] data, int bands, float minFrequency...

FILE: KeyboardAudioVisualizer/AudioProcessing/Spectrum/RawSpectrumProvider.cs
  class RawSpectrumProvider (line 5) | public class RawSpectrumProvider : AbstractSpectrum
    method RawSpectrumProvider (line 9) | public RawSpectrumProvider(float[] data)

FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/FrequencyBarsVisualizationProvider.cs
  type ValueMode (line 10) | public enum ValueMode { Max, Average, Sum }
  type SpectrumMode (line 11) | public enum SpectrumMode { Gamma, Logarithmic, Linear }
  class FrequencyBarsVisualizationProviderConfiguration (line 13) | public class FrequencyBarsVisualizationProviderConfiguration : AbstractC...
  class FrequencyBarsVisualizationProvider (line 81) | public class FrequencyBarsVisualizationProvider : AbstractAudioProcessor...
    method FrequencyBarsVisualizationProvider (line 99) | public FrequencyBarsVisualizationProvider(FrequencyBarsVisualizationPr...
    method Initialize (line 111) | public override void Initialize() => RecalculateConfigValues(null);
    method RecalculateConfigValues (line 113) | private void RecalculateConfigValues(string changedPropertyName)
    method Update (line 125) | public override void Update()
    method GetSpectrum (line 163) | private ISpectrum GetSpectrum()
    method GetBandValue (line 178) | private float GetBandValue(Band band)

FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/IVisualizationProvider.cs
  type IVisualizationProvider (line 5) | public interface IVisualizationProvider
    method Initialize (line 10) | void Initialize();
    method Update (line 11) | void Update();

FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/BeatVisualizationProvider.cs
  class BeatVisualizationProviderConfiguration (line 9) | public class BeatVisualizationProviderConfiguration : AbstractConfiguration
  class BeatVisualizationProvider (line 16) | public class BeatVisualizationProvider : AbstractAudioProcessor, IVisual...
    method BeatVisualizationProvider (line 32) | public BeatVisualizationProvider(BeatVisualizationProviderConfiguratio...
    method Initialize (line 42) | public override void Initialize()
    method Update (line 49) | public override void Update()

FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/LevelVisualizationProvider.cs
  type ConversionMode (line 11) | public enum ConversionMode
  class LevelVisualizationProviderConfiguration (line 16) | public class LevelVisualizationProviderConfiguration : AbstractConfigura...
  class LevelVisualizationProvider (line 49) | public class LevelVisualizationProvider : AbstractAudioProcessor, IVisua...
    method LevelVisualizationProvider (line 69) | public LevelVisualizationProvider(LevelVisualizationProviderConfigurat...
    method Initialize (line 81) | public override void Initialize()
    method RecalculateConfigValues (line 90) | private void RecalculateConfigValues(string changedPropertyName)
    method Update (line 115) | public override void Update()
    method GetRms (line 130) | private float GetRms(ref float[] data) => (float)Math.Sqrt(data.Averag...
    method Convert (line 132) | private float Convert(float level)
    method UpdateData (line 147) | private void UpdateData(int index, float level)

FILE: KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/VisualizationType.cs
  type VisualizationType (line 6) | public enum VisualizationType

FILE: KeyboardAudioVisualizer/Configuration/AbstractConfiguration.cs
  class AbstractConfiguration (line 8) | public class AbstractConfiguration : AbstractBindable, IConfiguration, I...
    method SetProperty (line 12) | protected override bool SetProperty<T>(ref T storage, T value, [Caller...

FILE: KeyboardAudioVisualizer/Configuration/ColorSerializer.cs
  class ColorSerializer (line 8) | public class ColorSerializer : JsonConverter
    method CanConvert (line 12) | public override bool CanConvert(Type objectType) => objectType == type...
    method WriteJson (line 14) | public override void WriteJson(JsonWriter writer, object value, JsonSe...
    method ReadJson (line 30) | public override object ReadJson(JsonReader reader, Type objectType, ob...

FILE: KeyboardAudioVisualizer/Configuration/EqualizerConfiguration.cs
  class EqualizerConfiguration (line 8) | public class EqualizerConfiguration : AbstractConfiguration
    method LoadInto (line 20) | public void LoadInto(IEqualizer equalizer)
    method SaveFrom (line 37) | public void SaveFrom(IEqualizer equalizer)

FILE: KeyboardAudioVisualizer/Configuration/IConfiguration.cs
  type IConfiguration (line 5) | public interface IConfiguration : INotifyPropertyChanged

FILE: KeyboardAudioVisualizer/Configuration/Settings.cs
  class Settings (line 10) | public class Settings
  class VisualizationSettings (line 43) | public class VisualizationSettings
    method VisualizationSettings (line 85) | public VisualizationSettings(VisualizationIndex visualizationIndex)
    method GetConfiguration (line 117) | public T GetConfiguration<T>(VisualizationType visualizationType)

FILE: KeyboardAudioVisualizer/Controls/BlurredDecorationWindow.cs
  class BlurredDecorationWindow (line 8) | [TemplatePart(Name = "PART_Decoration", Type = typeof(FrameworkElement))]
    method BlurredDecorationWindow (line 59) | static BlurredDecorationWindow()
    method OnApplyTemplate (line 68) | public override void OnApplyTemplate()

FILE: KeyboardAudioVisualizer/Controls/ColorSelector.cs
  class ColorSelector (line 14) | [TemplatePart(Name = "PART_Selector", Type = typeof(Panel))]
    method OnApplyTemplate (line 79) | public override void OnApplyTemplate()
    method SelectedColorChanged (line 234) | private static void SelectedColorChanged(DependencyObject dependencyOb...
    method SetColor (line 241) | private void SetColor(Color color)
    method AChanged (line 253) | private void AChanged(object sender, RoutedPropertyChangedEventArgs<do...
    method RChanged (line 264) | private void RChanged(object sender, RoutedPropertyChangedEventArgs<do...
    method GChanged (line 272) | private void GChanged(object sender, RoutedPropertyChangedEventArgs<do...
    method BChanged (line 280) | private void BChanged(object sender, RoutedPropertyChangedEventArgs<do...
    method RGBChanged (line 288) | private void RGBChanged()
    method HueChanged (line 297) | private void HueChanged(object sender, RoutedPropertyChangedEventArgs<...
    method SaturationChanged (line 305) | private void SaturationChanged(object sender, RoutedPropertyChangedEve...
    method ValueChanged (line 313) | private void ValueChanged(object sender, RoutedPropertyChangedEventArg...
    method HSVChanged (line 321) | private void HSVChanged()
    method SetA (line 330) | private void SetA(Color color)
    method SetRGB (line 341) | private void SetRGB(Color color)
    method SetHSV (line 360) | private void SetHSV(Color color)
    method UpdateSelectedColor (line 379) | private void UpdateSelectedColor(Color color)
    method UpdateSelector (line 388) | private void UpdateSelector()
    method UpdateSelectorValue (line 398) | private void UpdateSelectorValue(Point mouseLocation)
    method UpdateUIColors (line 412) | private void UpdateUIColors()

FILE: KeyboardAudioVisualizer/Controls/Form.cs
  class Form (line 7) | public class Form : Panel
    method SetIsLabel (line 65) | public static void SetIsLabel(UIElement element, bool value) => elemen...
    method GetIsLabel (line 66) | public static bool GetIsLabel(UIElement element) => (bool)element.GetV...
    method SetLineBreaks (line 71) | public static void SetLineBreaks(UIElement element, int value) => elem...
    method GetLineBreaks (line 72) | public static int GetLineBreaks(UIElement element) => (int)element.Get...
    method SetRowSpan (line 77) | public static void SetRowSpan(DependencyObject element, int value) => ...
    method GetRowSpan (line 78) | public static int GetRowSpan(DependencyObject element) => (int)element...
    method SetFill (line 83) | public static void SetFill(DependencyObject element, bool value) => el...
    method GetFill (line 84) | public static bool GetFill(DependencyObject element) => (bool)element....
    method MeasureOverride (line 91) | protected override Size MeasureOverride(Size availableSize)
    method ArrangeOverride (line 106) | protected override Size ArrangeOverride(Size finalSize)
    class FormLayout (line 122) | private class FormLayout
      method FormLayout (line 143) | public FormLayout(double rowHeight, double labelWidth, double elemen...
      method AddElement (line 155) | public Rect AddElement(UIElement element, double targetWidth)
      method AddLineBreaks (line 197) | private void AddLineBreaks(int count)

FILE: KeyboardAudioVisualizer/Controls/GradientEditor.cs
  class GradientEditor (line 19) | [TemplatePart(Name = "PART_Gradient", Type = typeof(Canvas))]
    method SetIsSelected (line 92) | public static void SetIsSelected(DependencyObject element, bool value)...
    method GetIsSelected (line 93) | public static bool GetIsSelected(DependencyObject element) => (bool)el...
    method GradientEditor (line 99) | public GradientEditor()
    method OnApplyTemplate (line 109) | public override void OnApplyTemplate()
    method UpdateGradientPreview (line 136) | private void UpdateGradientPreview()
    method UpdatePreviewRectangle (line 167) | private void UpdatePreviewRectangle(Rectangle rect, double referenceWi...
    method UpdatePreviewRectangleCount (line 182) | private void UpdatePreviewRectangleCount(int gradientCount)
    method UpdateGradientStops (line 203) | private void UpdateGradientStops()
    method UpdateGradientStop (line 213) | private void UpdateGradientStop(ContentControl control, double referen...
    method UpdateGradientStopsCount (line 223) | private void UpdateGradientStopsCount(List<GradientStop> gradientStops)
    method AttachGradient (line 255) | private void AttachGradient(AbstractGradient gradient) => gradient.Gra...
    method DetachGradient (line 256) | private void DetachGradient(AbstractGradient gradient) => gradient.Gra...
    method GradientChanged (line 258) | private void GradientChanged(object o, EventArgs eventArgs)
    method OnGradientChanged (line 264) | private static void OnGradientChanged(DependencyObject dependencyObject,
    method GradientContainerOnMouseDown (line 276) | private void GradientContainerOnMouseDown(object o, MouseButtonEventAr...
    method GradientStopOnMouseDown (line 287) | private void GradientStopOnMouseDown(object o, MouseButtonEventArgs mo...
    method OnMouseMove (line 303) | protected override void OnMouseMove(MouseEventArgs e)
    method OnMouseLeave (line 314) | protected override void OnMouseLeave(MouseEventArgs e)
    method OnMouseLeftButtonUp (line 321) | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
    method SelectedStopChanged (line 328) | private static void SelectedStopChanged(DependencyObject dependencyObj...
    method WindowMouseDown (line 362) | private void WindowMouseDown(object o, MouseButtonEventArgs mouseButto...
  class ColorPickerAdorner (line 371) | public class ColorPickerAdorner : Adorner
    method GetVisualChild (line 378) | protected override Visual GetVisualChild(int index) => _colorSelector;
    method ColorPickerAdorner (line 384) | public ColorPickerAdorner(UIElement adornedElement, FrameworkElement c...
    method ArrangeOverride (line 396) | protected override Size ArrangeOverride(Size finalSize)
    method MeasureOverride (line 416) | protected override Size MeasureOverride(Size constraint)

FILE: KeyboardAudioVisualizer/Controls/ImageButton.cs
  class ImageButton (line 7) | public class ImageButton : Button
    method ImageButton (line 44) | static ImageButton()

FILE: KeyboardAudioVisualizer/Converter/BoolToVisibilityConverter.cs
  class BoolToVisibilityConverter (line 8) | [ValueConversion(typeof(bool), typeof(Visibility))]
    method Convert (line 13) | public object Convert(object value, Type targetType, object parameter,...
    method ConvertBack (line 17) | public object ConvertBack(object value, Type targetType, object parame...

FILE: KeyboardAudioVisualizer/Converter/EqualizerBandsToPointsConverter.cs
  class EqualizerBandsToPointsConverter (line 13) | public class EqualizerBandsToPointsConverter : IMultiValueConverter
    method Convert (line 17) | public object Convert(object[] values, Type targetType, object paramet...
    method GetPosY (line 45) | private double GetPosY(float offset, double halfHeight)
    method ConvertBack (line 56) | public object[] ConvertBack(object value, Type[] targetTypes, object p...

FILE: KeyboardAudioVisualizer/Converter/EqualsToBoolConverter.cs
  class EqualsToBoolConverter (line 7) | [ValueConversion(typeof(object), typeof(bool))]
    method Convert (line 12) | public object Convert(object value, Type targetType, object parameter,...
    method ConvertBack (line 14) | public object ConvertBack(object value, Type targetType, object parame...

FILE: KeyboardAudioVisualizer/Converter/OffsetToPosXConverter.cs
  class OffsetToPosXConverter (line 8) | public class OffsetToPosXConverter : IMultiValueConverter
    method Convert (line 12) | public object Convert(object[] values, Type targetType, object paramet...
    method ConvertBack (line 26) | public object[] ConvertBack(object value, Type[] targetTypes, object p...

FILE: KeyboardAudioVisualizer/Converter/ValueToPosYConverter.cs
  class ValueToPosYConverter (line 8) | public class ValueToPosYConverter : IMultiValueConverter
    method Convert (line 12) | public object Convert(object[] values, Type targetType, object paramet...
    method ConvertBack (line 34) | public object[] ConvertBack(object value, Type[] targetTypes, object p...

FILE: KeyboardAudioVisualizer/Converter/VisualizationProviderDisplayNameConverter.cs
  class VisualizationProviderDisplayNameConverter (line 10) | [ValueConversion(typeof(VisualizationType), typeof(string))]
    method Convert (line 15) | public object Convert(object value, Type targetType, object parameter,...
    method ConvertBack (line 21) | public object ConvertBack(object value, Type targetType, object parame...

FILE: KeyboardAudioVisualizer/Converter/VisualizationToLastChildFillConverter.cs
  class VisualizationToLastChildFillConverter (line 9) | [ValueConversion(typeof(IVisualizationProvider), typeof(bool))]
    method Convert (line 14) | public object Convert(object value, Type targetType, object parameter,...
    method ConvertBack (line 19) | public object ConvertBack(object value, Type targetType, object parame...

FILE: KeyboardAudioVisualizer/Converter/VisualizationTypeSelectableConverter.cs
  class VisualizationTypeSelectableConverter (line 13) | [ValueConversion(typeof(IEnumerable<VisualizationType>), typeof(IEnumera...
    method Convert (line 18) | public object Convert(object value, Type targetType, object parameter,...
    method ConvertBack (line 24) | public object ConvertBack(object value, Type targetType, object parame...

FILE: KeyboardAudioVisualizer/Decorators/BeatDecorator.cs
  class BeatDecorator (line 6) | public class BeatDecorator : AbstractUpdateAwareDecorator, IBrushDecorator
    method BeatDecorator (line 16) | public BeatDecorator(IVisualizationProvider visualizationProvider)
    method Update (line 25) | protected override void Update(double deltaTime) => _visualizationProv...
    method ManipulateColor (line 29) | public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget re...

FILE: KeyboardAudioVisualizer/Decorators/FrequencyBarsDecorator.cs
  class FrequencyBarsDecorator (line 9) | public class FrequencyBarsDecorator : AbstractUpdateAwareDecorator, IBru...
    method FrequencyBarsDecorator (line 19) | public FrequencyBarsDecorator(IVisualizationProvider visualizationProv...
    method Update (line 28) | protected override void Update(double deltaTime) => _visualizationProv...
    method ManipulateColor (line 30) | public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget re...

FILE: KeyboardAudioVisualizer/Decorators/LevelBarDecorator.cs
  class LevelBarDecorator (line 7) | public class LevelBarDecorator : AbstractUpdateAwareDecorator, IBrushDec...
    method LevelBarDecorator (line 20) | public LevelBarDecorator(IVisualizationProvider visualizationProvider,...
    method Update (line 32) | protected override void Update(double deltaTime) => _visualizationProv...
    method ManipulateColor (line 34) | public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget re...
    method CalculateOffset (line 67) | private double CalculateOffset(Rectangle rectangle, BrushRenderTarget ...
  type LevelBarDirection (line 96) | public enum LevelBarDirection

FILE: KeyboardAudioVisualizer/Helper/ActionCommand.cs
  class ActionCommand (line 6) | public class ActionCommand : ICommand
    method ActionCommand (line 23) | public ActionCommand(Action command, Func<bool> canExecute = null)
    method CanExecute (line 33) | public bool CanExecute(object parameter)
    method Execute (line 38) | public void Execute(object parameter)
    method RaiseCanExecuteChanged (line 43) | public void RaiseCanExecuteChanged()

FILE: KeyboardAudioVisualizer/Helper/EnumExtension.cs
  class EnumExtension (line 6) | public static class EnumExtension
    method GetAttribute (line 10) | public static T GetAttribute<T>(this Enum e)

FILE: KeyboardAudioVisualizer/Helper/ExceptionExtension.cs
  class ExceptionExtension (line 5) | public static class ExceptionExtension
    method GetFullMessage (line 9) | public static string GetFullMessage(this Exception ex, string message ...

FILE: KeyboardAudioVisualizer/Helper/FrequencyHelper.cs
  class FrequencyHelper (line 5) | public static class FrequencyHelper
    method GetFrequencyOfIndex (line 15) | public static float GetFrequencyOfIndex(int index, int count) => index...
    method GetIndexOfFrequency (line 16) | public static int GetIndexOfFrequency(float frequency, int count) => (...
    method CalculatedBAForFrequency (line 18) | public static double CalculatedBAForFrequency(float frequency)

FILE: KeyboardAudioVisualizer/Helper/MathHelper.cs
  class MathHelper (line 5) | public static class MathHelper
    method Clamp (line 9) | public static double Clamp(double value, double min, double max) => Ma...
    method Clamp (line 10) | public static float Clamp(float value, float min, float max) => (float...
    method Clamp (line 11) | public static int Clamp(int value, int min, int max) => Math.Max(min, ...

FILE: KeyboardAudioVisualizer/Helper/ObservableDictionary.cs
  class ObservableDictionary (line 11) | public class ObservableDictionary<TKey, TValue> : AbstractBindable, IDic...
    method ObservableDictionary (line 30) | public ObservableDictionary()
    method ObservableDictionary (line 36) | public ObservableDictionary(IDictionary<TKey, TValue> dictionary)
    method ObservableDictionary (line 51) | public ObservableDictionary(int capacity)
    method AddItem (line 61) | protected virtual void AddItem(TKey key, TValue value)
    method RemoveItem (line 76) | protected virtual bool RemoveItem(TKey key)
    method RemoveItem (line 107) | protected virtual bool RemoveItem(KeyValuePair<TKey, TValue> item)
    method RemoveAllItems (line 139) | protected virtual void RemoveAllItems()
    method ChangeItem (line 153) | protected virtual void ChangeItem(TKey key, TValue newValue)
    method BlockReentrancy (line 172) | protected IDisposable BlockReentrancy()
    method CheckReentrancy (line 178) | protected void CheckReentrancy()
    method Add (line 191) | public void Add(TKey key, TValue value) => AddItem(key, value);
    method ContainsKey (line 193) | public bool ContainsKey(TKey key) => _indexMap.ContainsKey(key);
    method Remove (line 195) | public bool Remove(TKey key) => RemoveItem(key);
    method TryGetValue (line 197) | public bool TryGetValue(TKey key, out TValue value)
    method Clear (line 230) | public void Clear() => RemoveAllItems();
    method Add (line 234) | void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TV...
    method Contains (line 236) | bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKe...
    method CopyTo (line 238) | void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey,...
    method Remove (line 249) | bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey,...
    method GetEnumerator (line 255) | public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
    method GetEnumerator (line 268) | IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
    method OnCollectionChanged (line 276) | protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    method OnCollectionChanged (line 284) | protected void OnCollectionChanged(NotifyCollectionChangedAction actio...
    method OnCollectionChanged (line 286) | protected void OnCollectionChanged(NotifyCollectionChangedAction actio...
    method OnCollectionChanged (line 288) | protected void OnCollectionChanged(NotifyCollectionChangedAction actio...
    class SimpleMonitor (line 298) | private class SimpleMonitor : IDisposable
      method Enter (line 304) | public void Enter() => _busyCount = _busyCount + 1;
      method Dispose (line 306) | public void Dispose() => _busyCount = _busyCount - 1;

FILE: KeyboardAudioVisualizer/Helper/RingBuffer.cs
  class RingBuffer (line 5) | public class RingBuffer
    method RingBuffer (line 24) | public RingBuffer(int capacity)
    method Put (line 35) | public void Put(float value) => Put(new[] { value }, 0, 1);
    method Put (line 37) | public void Put(float[] src, int offset, int count)
    method CopyInto (line 58) | public void CopyInto(ref float[] data, int offset) => CopyInto(ref dat...
    method CopyInto (line 59) | public void CopyInto(ref float[] data, int offset, int count)

FILE: KeyboardAudioVisualizer/Helper/VisualizationIndex.cs
  type VisualizationIndex (line 3) | public enum VisualizationIndex

FILE: KeyboardAudioVisualizer/Helper/WPFHelper.cs
  class WPFHelper (line 6) | public static class WPFHelper
    method GetVisualChild (line 10) | public static T GetVisualChild<T>(this DependencyObject parent)

FILE: KeyboardAudioVisualizer/Legacy/ConfigurationMigrator.cs
  class ConfigurationMigrator (line 7) | public static class ConfigurationMigrator
    method MigrateOldConfig (line 21) | public static Configuration.Settings MigrateOldConfig()
    method CleanupOldConfigs (line 48) | public static void CleanupOldConfigs()

FILE: KeyboardAudioVisualizer/Legacy/ConfigurationUpdates.cs
  class ConfigurationUpdates (line 7) | public static class ConfigurationUpdates
    method PerformOn (line 11) | public static void PerformOn(Configuration.Settings settings)
    method UpdateTo1 (line 17) | private static void UpdateTo1(Configuration.Settings settings)

FILE: KeyboardAudioVisualizer/Legacy/SerializationHelper.cs
  class SerializationHelper (line 7) | public static class SerializationHelper
    method SaveObjectToFile (line 11) | public static void SaveObjectToFile<T>(T serializableObject, string path)
    method LoadObjectFromFile (line 30) | public static T LoadObjectFromFile<T>(string fileName)

FILE: KeyboardAudioVisualizer/Legacy/Settings.cs
  class Settings (line 6) | public class Settings

FILE: KeyboardAudioVisualizer/Properties/Resources.Designer.cs
  class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
    method Resources (line 32) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...

FILE: KeyboardAudioVisualizer/Properties/Settings.Designer.cs
  class Settings (line 15) | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

FILE: KeyboardAudioVisualizer/Styles/CachedResourceDictionary.cs
  class CachedResourceDictionary (line 8) | public class CachedResourceDictionary : ResourceDictionary
    method UpdateCache (line 36) | private static void UpdateCache(Uri source)
    method CopyDictionaryEntries (line 47) | private static void CopyDictionaryEntries(IDictionary source, IDiction...

FILE: KeyboardAudioVisualizer/UI/ConfigurationViewModel.cs
  class ConfigurationViewModel (line 10) | public class ConfigurationViewModel : AbstractBindable
    method OpenHomepage (line 83) | private void OpenHomepage() => Process.Start("https://github.com/Darth...

FILE: KeyboardAudioVisualizer/UI/ConfigurationWindow.xaml.cs
  class ConfigurationWindow (line 6) | public partial class ConfigurationWindow : BlurredDecorationWindow
    method ConfigurationWindow (line 8) | public ConfigurationWindow() => InitializeComponent();
    method ConfigurationWindow_OnClosed (line 11) | private void ConfigurationWindow_OnClosed(object sender, EventArgs e)

FILE: KeyboardAudioVisualizer/UI/Visualization/BeatVisualizer.cs
  class BeatVisualizer (line 13) | public class BeatVisualizer : Control
    method BeatVisualizer (line 65) | public BeatVisualizer()
    method Update (line 77) | private void Update()
    method VisualizationIndexChanged (line 93) | private static void VisualizationIndexChanged(DependencyObject depende...
    method UpdateGradient (line 100) | private void UpdateGradient()
    method UpdateColor (line 113) | private void UpdateColor()

FILE: KeyboardAudioVisualizer/UI/Visualization/EqualizerVisualizer.cs
  class EqualizerVisualizer (line 10) | [TemplatePart(Name = "PART_Grips", Type = typeof(ItemsControl))]
    method EqualizerVisualizer (line 46) | public EqualizerVisualizer()
    method OnApplyTemplate (line 55) | public override void OnApplyTemplate()
    method OnMouseLeftButtonDown (line 62) | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
    method OnMouseLeftButtonUp (line 71) | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
    method OnMouseLeave (line 78) | protected override void OnMouseLeave(MouseEventArgs e)
    method OnMouseMove (line 85) | protected override void OnMouseMove(MouseEventArgs e)
    method OnMouseRightButtonDown (line 94) | protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
    method UpdateBand (line 110) | private void UpdateBand(EqualizerBand band, Point position)
    method GetClickedBand (line 118) | private EqualizerBand GetClickedBand()

FILE: KeyboardAudioVisualizer/UI/Visualization/FrequencyBarsVisualizer.cs
  class FrequencyBarsVisualizer (line 16) | [TemplatePart(Name = "PART_BarsPanel", Type = typeof(Panel))]
    method FrequencyBarsVisualizer (line 54) | public FrequencyBarsVisualizer()
    method OnApplyTemplate (line 64) | public override void OnApplyTemplate()
    method VisualizationProviderChanged (line 73) | private static void VisualizationProviderChanged(DependencyObject depe...
    method VisualizationIndexChanged (line 87) | private static void VisualizationIndexChanged(DependencyObject depende...
    method UpdateGradient (line 94) | private void UpdateGradient()
    method ConfigurationChanged (line 107) | private void ConfigurationChanged(string changedPropertyName)
    method InitializeBars (line 113) | private void InitializeBars()
    method UpdateSizes (line 132) | private void UpdateSizes()
    method UpdateColors (line 147) | private void UpdateColors()
    method Update (line 158) | private void Update()

FILE: KeyboardAudioVisualizer/UI/Visualization/LevelVisualizer.cs
  class LevelVisualizer (line 17) | public class LevelVisualizer : Control
    method LevelVisualizer (line 87) | public LevelVisualizer()
    method Update (line 96) | private void Update()
    method SetBrushes (line 110) | private void SetBrushes()
    method VisualizationIndexChanged (line 122) | private static void VisualizationIndexChanged(DependencyObject depende...
    method UpdateGradient (line 129) | private void UpdateGradient()
Condensed preview — 109 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (406K chars).
[
  {
    "path": ".gitattributes",
    "chars": 2518,
    "preview": "###############################################################################\n# Set default behavior to automatically "
  },
  {
    "path": ".gitignore",
    "chars": 4832,
    "preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## G"
  },
  {
    "path": "KeyboardAudioVisualizer/App.config",
    "chars": 529,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NE"
  },
  {
    "path": "KeyboardAudioVisualizer/App.xaml",
    "chars": 1596,
    "preview": "<Application x:Class=\"KeyboardAudioVisualizer.App\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/pre"
  },
  {
    "path": "KeyboardAudioVisualizer/App.xaml.cs",
    "chars": 3623,
    "preview": "using System;\nusing System.IO;\nusing System.Windows;\nusing System.Windows.Controls;\nusing Hardcodet.Wpf.TaskbarNotifica"
  },
  {
    "path": "KeyboardAudioVisualizer/ApplicationManager.cs",
    "chars": 10764,
    "preview": "using System.Collections.Generic;\nusing System.Windows;\nusing KeyboardAudioVisualizer.AudioProcessing;\nusing KeyboardAu"
  },
  {
    "path": "KeyboardAudioVisualizer/Attached/SliderValue.cs",
    "chars": 5417,
    "preview": "using System.Linq;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Documents;\nusing System.Wi"
  },
  {
    "path": "KeyboardAudioVisualizer/Attached/SliderValueAdorner.cs",
    "chars": 3620,
    "preview": "using System.Globalization;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Controls.Primitiv"
  },
  {
    "path": "KeyboardAudioVisualizer/Attributes/DisplayNameAttribute.cs",
    "chars": 403,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.Attributes\n{\n    public class DisplayNameAttribute : Attribute\n    {\n "
  },
  {
    "path": "KeyboardAudioVisualizer/Attributes/VisualizerForAttribute.cs",
    "chars": 449,
    "preview": "using System;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisualizer.Attributes\n{\n    public class VisualizerForAttribu"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioCapture/AudioBuffer.cs",
    "chars": 3267,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.AudioCapture\n{\n    public class AudioBuffer\n    {\n        #region Prop"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioCapture/CSCoreAudioInput.cs",
    "chars": 2797,
    "preview": "using System;\nusing CSCore;\nusing CSCore.CoreAudioAPI;\nusing CSCore.SoundIn;\nusing CSCore.Streams;\n\nnamespace KeyboardA"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioCapture/IAudioInput.cs",
    "chars": 324,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.AudioCapture\n{\n    public delegate void AudioData(float left, float ri"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/AbstractAudioProcessor.cs",
    "chars": 414,
    "preview": "namespace KeyboardAudioVisualizer.AudioProcessing\n{\n    public abstract class AbstractAudioProcessor : IAudioProcessor\n"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/AudioVisualizationFactory.cs",
    "chars": 3909,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing KeyboardAudioVisualizer.AudioCapture;\nusing Ke"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Equalizer/EqualizerBand.cs",
    "chars": 1102,
    "preview": "using KeyboardAudioVisualizer.Helper;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Equalizer\n"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Equalizer/IEqualizer.cs",
    "chars": 436,
    "preview": "using System.Collections.ObjectModel;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Equalizer\n{\n    public interfa"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Equalizer/MultiBandEqualizer.cs",
    "chars": 3155,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing RGB.NET."
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/IAudioProcessor.cs",
    "chars": 220,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing\n{\n    public interface IAudioProcessor : IDisposable\n "
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/AbstractSpectrum.cs",
    "chars": 945,
    "preview": "using System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace KeyboardAudioVisualizer.Audio"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/Band.cs",
    "chars": 1478,
    "preview": "using System.Linq;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    public class Band\n    {\n        #r"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/FourierSpectrumProvider.cs",
    "chars": 2744,
    "preview": "using System;\nusing KeyboardAudioVisualizer.AudioCapture;\nusing MathNet.Numerics;\nusing MathNet.Numerics.IntegralTransf"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/GammaSpectrum.cs",
    "chars": 1598,
    "preview": "using System;\nusing KeyboardAudioVisualizer.Helper;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    p"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrum.cs",
    "chars": 345,
    "preview": "using System.Collections.Generic;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    public interface IS"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/ISpectrumProvider.cs",
    "chars": 497,
    "preview": "namespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    public interface ISpectrumProvider : IAudioProcessor\n "
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/LinearSpectrum.cs",
    "chars": 1728,
    "preview": "using System;\nusing KeyboardAudioVisualizer.Helper;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    p"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/LogarithmicSpectrum.cs",
    "chars": 1684,
    "preview": "using System;\nusing KeyboardAudioVisualizer.Helper;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    p"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/Spectrum/RawSpectrumProvider.cs",
    "chars": 622,
    "preview": "using KeyboardAudioVisualizer.Helper;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Spectrum\n{\n    public class Ra"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/FrequencyBarsVisualizationProvider.cs",
    "chars": 6880,
    "preview": "using System;\nusing KeyboardAudioVisualizer.AudioProcessing.Equalizer;\nusing KeyboardAudioVisualizer.AudioProcessing.Sp"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/VisualizationPRovider/IVisualizationProvider.cs",
    "chars": 319,
    "preview": "using KeyboardAudioVisualizer.Configuration;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider\n{"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/BeatVisualizationProvider.cs",
    "chars": 2053,
    "preview": "using KeyboardAudioVisualizer.AudioProcessing.Spectrum;\nusing KeyboardAudioVisualizer.Configuration;\nusing KeyboardAudi"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/LevelVisualizationProvider.cs",
    "chars": 5343,
    "preview": "using System;\nusing System.Linq;\nusing KeyboardAudioVisualizer.AudioCapture;\nusing KeyboardAudioVisualizer.Configuratio"
  },
  {
    "path": "KeyboardAudioVisualizer/AudioProcessing/VisualizationProvider/VisualizationType.cs",
    "chars": 494,
    "preview": "using KeyboardAudioVisualizer.Attributes;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisualizer.AudioProcessing.Visual"
  },
  {
    "path": "KeyboardAudioVisualizer/Configuration/AbstractConfiguration.cs",
    "chars": 928,
    "preview": "using System;\nusing System.ComponentModel;\nusing System.Runtime.CompilerServices;\nusing RGB.NET.Core;\n\nnamespace Keyboa"
  },
  {
    "path": "KeyboardAudioVisualizer/Configuration/ColorSerializer.cs",
    "chars": 1914,
    "preview": "using System;\nusing Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisualizer"
  },
  {
    "path": "KeyboardAudioVisualizer/Configuration/EqualizerConfiguration.cs",
    "chars": 1398,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing KeyboardAudioVisualizer.AudioProcessing.Equali"
  },
  {
    "path": "KeyboardAudioVisualizer/Configuration/IConfiguration.cs",
    "chars": 152,
    "preview": "using System.ComponentModel;\n\nnamespace KeyboardAudioVisualizer.Configuration\n{\n    public interface IConfiguration : I"
  },
  {
    "path": "KeyboardAudioVisualizer/Configuration/Settings.cs",
    "chars": 4628,
    "preview": "using System;\nusing System.Collections.Generic;\nusing KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nus"
  },
  {
    "path": "KeyboardAudioVisualizer/Controls/BlurredDecorationWindow.cs",
    "chars": 3598,
    "preview": "using System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Input;\nusing System.Windows.Media;\n\nnamespace"
  },
  {
    "path": "KeyboardAudioVisualizer/Controls/ColorSelector.cs",
    "chars": 20985,
    "preview": "using System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing Syst"
  },
  {
    "path": "KeyboardAudioVisualizer/Controls/Form.cs",
    "chars": 8707,
    "preview": "using System;\nusing System.Windows;\nusing System.Windows.Controls;\n\nnamespace KeyboardAudioVisualizer.Controls\n{\n    pu"
  },
  {
    "path": "KeyboardAudioVisualizer/Controls/GradientEditor.cs",
    "chars": 17949,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.Windows.Controls;"
  },
  {
    "path": "KeyboardAudioVisualizer/Controls/ImageButton.cs",
    "chars": 1717,
    "preview": "using System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Media;\n\nnamespace KeyboardAudioVisualizer.Con"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/BoolToVisibilityConverter.cs",
    "chars": 769,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows;\nusing System.Windows.Data;\n\nnamespace KeyboardAudioVisu"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/EqualizerBandsToPointsConverter.cs",
    "chars": 2416,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Globalization;\nusing"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/EqualsToBoolConverter.cs",
    "chars": 557,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows.Data;\n\nnamespace KeyboardAudioVisualizer.Converter\n{\n   "
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/OffsetToPosXConverter.cs",
    "chars": 1030,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows;\nusing System.Windows.Data;\n\nnamespace KeyboardAudioVisu"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/ValueToPosYConverter.cs",
    "chars": 1290,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows;\nusing System.Windows.Data;\n\nnamespace KeyboardAudioVisu"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/VisualizationProviderDisplayNameConverter.cs",
    "chars": 966,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows.Data;\nusing KeyboardAudioVisualizer.Attributes;\nusing Ke"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/VisualizationToLastChildFillConverter.cs",
    "chars": 761,
    "preview": "using System;\nusing System.Globalization;\nusing System.Windows.Data;\nusing KeyboardAudioVisualizer.AudioProcessing.Visu"
  },
  {
    "path": "KeyboardAudioVisualizer/Converter/VisualizationTypeSelectableConverter.cs",
    "chars": 1190,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Windows.Dat"
  },
  {
    "path": "KeyboardAudioVisualizer/Decorators/BeatDecorator.cs",
    "chars": 884,
    "preview": "using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisual"
  },
  {
    "path": "KeyboardAudioVisualizer/Decorators/FrequencyBarsDecorator.cs",
    "chars": 1438,
    "preview": "using System;\nusing KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nusing RGB.NET.Core;\nusing Color = RG"
  },
  {
    "path": "KeyboardAudioVisualizer/Decorators/LevelBarDecorator.cs",
    "chars": 3345,
    "preview": "using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nusing RGB.NET.Brushes.Gradients;\nusing RGB.NET.Cor"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/ActionCommand.cs",
    "chars": 1007,
    "preview": "using System;\nusing System.Windows.Input;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public class ActionCommand : "
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/EnumExtension.cs",
    "chars": 378,
    "preview": "using System;\nusing System.Linq;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public static class EnumExtension\n    "
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/ExceptionExtension.cs",
    "chars": 510,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public static class ExceptionExtension\n    {\n        #reg"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/FrequencyHelper.cs",
    "chars": 930,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public static class FrequencyHelper\n    {\n        #region"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/MathHelper.cs",
    "chars": 478,
    "preview": "using System;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public static class MathHelper\n    {\n        #region Meth"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/ObservableDictionary.cs",
    "chars": 9736,
    "preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing S"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/RingBuffer.cs",
    "chars": 1728,
    "preview": "using System.Linq;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public class RingBuffer\n    {\n        #region Proper"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/VisualizationIndex.cs",
    "chars": 146,
    "preview": "namespace KeyboardAudioVisualizer.Helper\n{\n    public enum VisualizationIndex\n    {\n        Primary,\n        Secondary,"
  },
  {
    "path": "KeyboardAudioVisualizer/Helper/WPFHelper.cs",
    "chars": 773,
    "preview": "using System.Windows;\nusing System.Windows.Media;\n\nnamespace KeyboardAudioVisualizer.Helper\n{\n    public static class W"
  },
  {
    "path": "KeyboardAudioVisualizer/KeyboardAudioVisualizer.csproj",
    "chars": 20096,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
  },
  {
    "path": "KeyboardAudioVisualizer/KeyboardAudioVisualizer.csproj.DotSettings",
    "chars": 414,
    "preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
  },
  {
    "path": "KeyboardAudioVisualizer/Legacy/ConfigurationMigrator.cs",
    "chars": 1953,
    "preview": "using System.IO;\nusing KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nusing KeyboardAudioVisualizer.Hel"
  },
  {
    "path": "KeyboardAudioVisualizer/Legacy/ConfigurationUpdates.cs",
    "chars": 1973,
    "preview": "using KeyboardAudioVisualizer.Helper;\nusing RGB.NET.Brushes.Gradients;\nusing RGB.NET.Core;\n\nnamespace KeyboardAudioVisu"
  },
  {
    "path": "KeyboardAudioVisualizer/Legacy/SerializationHelper.cs",
    "chars": 1669,
    "preview": "using System.IO;\nusing System.Xml;\nusing System.Xml.Serialization;\n\nnamespace KeyboardAudioVisualizer.Legacy\n{\n    publ"
  },
  {
    "path": "KeyboardAudioVisualizer/Legacy/Settings.cs",
    "chars": 958,
    "preview": "using KeyboardAudioVisualizer.AudioProcessing.VisualizationProvider;\nusing KeyboardAudioVisualizer.Configuration;\n\nname"
  },
  {
    "path": "KeyboardAudioVisualizer/Properties/AssemblyInfo.cs",
    "chars": 2336,
    "preview": "using System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Windows;\n\n// General Information about an a"
  },
  {
    "path": "KeyboardAudioVisualizer/Properties/Resources.Designer.cs",
    "chars": 2803,
    "preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code w"
  },
  {
    "path": "KeyboardAudioVisualizer/Properties/Resources.resx",
    "chars": 5494,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The prim"
  },
  {
    "path": "KeyboardAudioVisualizer/Properties/Settings.Designer.cs",
    "chars": 1078,
    "preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code w"
  },
  {
    "path": "KeyboardAudioVisualizer/Properties/Settings.settings",
    "chars": 193,
    "preview": "<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"uri:settings\" CurrentProfile=\"(Default)\">\n  <Profiles>\n    "
  },
  {
    "path": "KeyboardAudioVisualizer/Resources/KeyboardAudioVisualizer.xaml",
    "chars": 2799,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/BlurredDecorationWindow.xaml",
    "chars": 7648,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/Button.xaml",
    "chars": 2109,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/CachedResourceDictionary.cs",
    "chars": 1645,
    "preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Windows;\n\nnamespace KeyboardAudi"
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/ColorSelector.xaml",
    "chars": 17777,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/ComboBox.xaml",
    "chars": 7421,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/Form.xaml",
    "chars": 5287,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/FrameworkElement.xaml",
    "chars": 672,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/GradientEditor.xaml",
    "chars": 4616,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/GroupBox.xaml",
    "chars": 1874,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/ImageButton.xaml",
    "chars": 5853,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/Navigation.xaml",
    "chars": 11213,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/Slider.xaml",
    "chars": 1711,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/Theme.xaml",
    "chars": 4396,
    "preview": "<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    xmlns:x=\"http"
  },
  {
    "path": "KeyboardAudioVisualizer/Styles/ToolTip.xaml",
    "chars": 1583,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Configuration/BeatConfiguration.xaml",
    "chars": 1640,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Configuration/FrequencyBarsConfiguration.xaml",
    "chars": 7207,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Configuration/LevelConfiguration.xaml",
    "chars": 3603,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/ConfigurationViewModel.cs",
    "chars": 2969,
    "preview": "using System;\nusing System.Diagnostics;\nusing System.Reflection;\nusing KeyboardAudioVisualizer.AudioProcessing.Visualiz"
  },
  {
    "path": "KeyboardAudioVisualizer/UI/ConfigurationWindow.xaml",
    "chars": 17609,
    "preview": "<controls:BlurredDecorationWindow x:Class=\"KeyboardAudioVisualizer.UI.ConfigurationWindow\"\n                            "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/ConfigurationWindow.xaml.cs",
    "chars": 569,
    "preview": "using System;\nusing KeyboardAudioVisualizer.Controls;\n\nnamespace KeyboardAudioVisualizer.UI\n{\n    public partial class "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/BeatVisualization.xaml",
    "chars": 1994,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/BeatVisualizer.cs",
    "chars": 4676,
    "preview": "using System;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Media;\nusing System.Windows.Thr"
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/EqualizerVisualization.xaml",
    "chars": 8096,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/EqualizerVisualizer.cs",
    "chars": 4092,
    "preview": "using System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing Keyb"
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/FrequencyBarsVisualization.xaml",
    "chars": 2653,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/FrequencyBarsVisualizer.cs",
    "chars": 6551,
    "preview": "using System;\nusing System.ComponentModel;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Me"
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/LevelVisualization.xaml",
    "chars": 4528,
    "preview": "<styles:CachedResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                    "
  },
  {
    "path": "KeyboardAudioVisualizer/UI/Visualization/LevelVisualizer.cs",
    "chars": 5649,
    "preview": "using System;\nusing System.ComponentModel;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Me"
  },
  {
    "path": "KeyboardAudioVisualizer/packages.config",
    "chars": 2204,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"CSCore\" version=\"1.2.1.2\" targetFramework=\"net461\" />\n"
  },
  {
    "path": "KeyboardAudioVisualizer.sln",
    "chars": 1246,
    "preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26430.15\nMin"
  },
  {
    "path": "KeyboardAudioVisualizer.sln.DotSettings",
    "chars": 466,
    "preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
  },
  {
    "path": "LICENSE",
    "chars": 18046,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Fr"
  },
  {
    "path": "NuGet.Config",
    "chars": 282,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n\n  <packageSources>\n    <add key=\"RGB.NET\" value=\"http://nuget.a"
  },
  {
    "path": "README.md",
    "chars": 4547,
    "preview": "This software is no longer actively developed.\n\nConsider checking out [Artemis](https://github.com/Artemis-RGB/Artemis) "
  }
]

About this extraction

This page contains the full source code of the DarthAffe/KeyboardAudioVisualizer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 109 files (373.6 KB), approximately 78.4k tokens, and a symbol index with 376 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!