diff --git a/src/RemSound.App/MainForm.cs b/src/RemSound.App/MainForm.cs index 5ca974c..c89c733 100644 --- a/src/RemSound.App/MainForm.cs +++ b/src/RemSound.App/MainForm.cs @@ -3268,8 +3268,23 @@ public sealed class MainForm : Form 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; } + 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; } diff --git a/src/RemSound.Core/PeerShaping.cs b/src/RemSound.Core/PeerShaping.cs index 0595e15..ad0efc5 100644 --- a/src/RemSound.Core/PeerShaping.cs +++ b/src/RemSound.Core/PeerShaping.cs @@ -27,9 +27,9 @@ public sealed class PeerShaping /// (bass, mids, treble). Kept independently of the advanced bands. public float[] SimpleBandsDb { get; set; } = new float[3]; - /// Gains in dB (-12..+12) for the 10 advanced graphic-EQ bands, in the order of + /// Gains in dB (-12..+12) for the 12 advanced graphic-EQ bands, in the order of /// . Kept independently of the simple bands. - public float[] AdvancedBandsDb { get; set; } = new float[10]; + public float[] AdvancedBandsDb { get; set; } = new float[12]; } /// 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), ]; - /// 10-band graphic EQ on ISO octave centres (all peaking). + /// 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. public static readonly (string Label, double Freq)[] Advanced = [ ("31 Hz", 31.0), @@ -62,7 +63,9 @@ public static class PeerEqBands ("500 Hz", 500.0), ("1 kHz", 1000.0), ("2 kHz", 2000.0), + ("3 kHz", 3000.0), ("4 kHz", 4000.0), + ("6 kHz", 6000.0), ("8 kHz", 8000.0), ("16 kHz", 16000.0), ];