Skip to content

Commit

Permalink
Correct EQ maximum finding
Browse files Browse the repository at this point in the history
  • Loading branch information
VoidXH committed Mar 3, 2024
1 parent ea35244 commit 6db7db0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cavern.QuickEQ/Equalization/EQGenerator.Averaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static Equalizer AverageSafe(params Equalizer[] sources) {
/// </summary>
/// <remarks>All <paramref name="sources"/> must have an equal number of bands at the same frequencies.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Equalizer Max(params Equalizer[] sources) => MinMax(sources, true);
public static Equalizer Max(params Equalizer[] sources) => MinMax(sources, false);

/// <summary>
/// Get the minimum at each band for multiple equalizers.
Expand Down Expand Up @@ -97,7 +97,7 @@ static Equalizer MinMax(Equalizer[] sources, bool min) {
IReadOnlyList<Band>[] bands = sources.Select(x => x.Bands).ToArray();
List<Band> output = new List<Band>();
for (int i = 0, c = bands[0].Count; i < c; i++) {
double gain = double.MaxValue;
double gain = min ? double.MaxValue : double.MinValue;
for (int j = 0; j < bands.Length; j++) {
if (min ? gain > bands[j][i].Gain : gain < bands[j][i].Gain) {
gain = bands[j][i].Gain;
Expand Down

0 comments on commit 6db7db0

Please sign in to comment.