private void ApplyHorizontal(AudioPropertiesModel settings)
{
var index = 0;
foreach (var audioLayer in _audioLayers)
{
int width;
if (SpectrumData.Count > index)
width = (int) Math.Round(SpectrumData[index]/2.55);
else
width = 0;
// Apply Sensitivity setting
width = width*settings.Sensitivity;
var newWidth = settings.Width/100.0*width;
if (newWidth >= audioLayer.Properties.Width)
audioLayer.Properties.Width = newWidth;
else
audioLayer.Properties.Width = audioLayer.Properties.Width - settings.FadeSpeed;
if (audioLayer.Properties.Width < 0)
audioLayer.Properties.Width = 0;
audioLayer.Properties.Brush = settings.Brush;
audioLayer.Properties.Contain = false;
// Reverse the direction if settings require it
if (settings.Direction == Direction.RightToLeft)
audioLayer.Properties.X = settings.X + (settings.Width - audioLayer.Properties.Width);
audioLayer.Update(null, false, true);
index++;
}
}