Pan/EQ: 12-band advanced EQ (add 3 kHz and 6 kHz)

Ed wanted a band between 4 and 8 kHz. Advanced EQ goes from 10 to 12 bands: added 6 kHz (4-8
gap) and 3 kHz (2-4 gap) for even resolution through the presence region. PeerShaping
.AdvancedBandsDb default is now 12; MainForm.NormalizeBands grows an older 10-length array on
load so nothing breaks. (Feature unreleased, so no shipped settings to migrate.) Held for
next release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-07 20:16:21 +01:00
co-authored by Claude Opus 4.8
parent fc4ad3bb92
commit d0d14ab95c
2 changed files with 22 additions and 4 deletions
+16 -1
View File
@@ -3268,8 +3268,23 @@ public sealed class MainForm : Form
private PeerShaping GetOrCreateShaping(string? key) private PeerShaping GetOrCreateShaping(string? key)
{ {
if (key is null) return new PeerShaping(); if (key is null) return NormalizeBands(new PeerShaping());
if (!peerShaping.TryGetValue(key, out var s)) { s = new PeerShaping(); peerShaping[key] = s; } if (!peerShaping.TryGetValue(key, out var s)) { s = new PeerShaping(); peerShaping[key] = s; }
return NormalizeBands(s);
}
// Grow the band-gain arrays to the current band counts (e.g. a profile saved when the advanced EQ
// had 10 bands, now 12) so the new bands can be read and stored. New slots are 0 dB (flat).
private static PeerShaping NormalizeBands(PeerShaping s)
{
if (s.SimpleBandsDb.Length < PeerEqBands.Simple.Length)
{
var a = s.SimpleBandsDb; Array.Resize(ref a, PeerEqBands.Simple.Length); s.SimpleBandsDb = a;
}
if (s.AdvancedBandsDb.Length < PeerEqBands.Advanced.Length)
{
var a = s.AdvancedBandsDb; Array.Resize(ref a, PeerEqBands.Advanced.Length); s.AdvancedBandsDb = a;
}
return s; return s;
} }
+6 -3
View File
@@ -27,9 +27,9 @@ public sealed class PeerShaping
/// (bass, mids, treble). Kept independently of the advanced bands.</summary> /// (bass, mids, treble). Kept independently of the advanced bands.</summary>
public float[] SimpleBandsDb { get; set; } = new float[3]; public float[] SimpleBandsDb { get; set; } = new float[3];
/// <summary>Gains in dB (-12..+12) for the 10 advanced graphic-EQ bands, in the order of /// <summary>Gains in dB (-12..+12) for the 12 advanced graphic-EQ bands, in the order of
/// <see cref="PeerEqBands.Advanced"/>. Kept independently of the simple bands.</summary> /// <see cref="PeerEqBands.Advanced"/>. Kept independently of the simple bands.</summary>
public float[] AdvancedBandsDb { get; set; } = new float[10]; public float[] AdvancedBandsDb { get; set; } = new float[12];
} }
/// <summary>The fixed EQ band layouts. The user sets each band's GAIN; the centre frequencies are /// <summary>The fixed EQ band layouts. The user sets each band's GAIN; the centre frequencies are
@@ -52,7 +52,8 @@ public static class PeerEqBands
("Treble", 8000.0), ("Treble", 8000.0),
]; ];
/// <summary>10-band graphic EQ on ISO octave centres (all peaking).</summary> /// <summary>12-band graphic EQ octave centres low down, finer through the presence region
/// (2/3/4/6/8 kHz) so there's a band between 4 and 8 kHz. All peaking.</summary>
public static readonly (string Label, double Freq)[] Advanced = public static readonly (string Label, double Freq)[] Advanced =
[ [
("31 Hz", 31.0), ("31 Hz", 31.0),
@@ -62,7 +63,9 @@ public static class PeerEqBands
("500 Hz", 500.0), ("500 Hz", 500.0),
("1 kHz", 1000.0), ("1 kHz", 1000.0),
("2 kHz", 2000.0), ("2 kHz", 2000.0),
("3 kHz", 3000.0),
("4 kHz", 4000.0), ("4 kHz", 4000.0),
("6 kHz", 6000.0),
("8 kHz", 8000.0), ("8 kHz", 8000.0),
("16 kHz", 16000.0), ("16 kHz", 16000.0),
]; ];