From 6c84910553d68314985e68bbaa63dfa3c40845b1 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Sun, 8 Feb 2026 17:15:38 -0800 Subject: [PATCH] renaming --- ...utoeq_interpolate.go => eq_interpolate.go} | 20 +++++++++---------- ...rpolate_test.go => eq_interpolate_test.go} | 12 +++++------ ui/dialogs/settingsdialog.go | 20 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) rename backend/{autoeq_interpolate.go => eq_interpolate.go} (88%) rename backend/{autoeq_interpolate_test.go => eq_interpolate_test.go} (94%) diff --git a/backend/autoeq_interpolate.go b/backend/eq_interpolate.go similarity index 88% rename from backend/autoeq_interpolate.go rename to backend/eq_interpolate.go index 81dde07..3e98c47 100644 --- a/backend/autoeq_interpolate.go +++ b/backend/eq_interpolate.go @@ -8,15 +8,15 @@ var autoEQFreqs = []float64{31.25, 62.5, 125, 250, 500, 1000, 2000, 4000, 8000, // Supersonic uses 15 bands at these frequencies (in Hz) var supersonicFreqs = []float64{25, 40, 63, 100, 160, 250, 400, 630, 1000, 1600, 2500, 4000, 6300, 10000, 16000} -// InterpolateAutoEQTo15Band converts a 10-band AutoEQ profile to Supersonic's 15-band ISO equalizer. +// InterpolateEQ10To15Band converts a 10-band EQ profile to Supersonic's 15-band ISO equalizer. // Uses logarithmic frequency positioning with linear dB interpolation. // // Parameters: -// - autoEQGains: Array of 10 gain values (dB) from AutoEQ at 31, 62, 125, 250, 500, 1k, 2k, 4k, 8k, 16k Hz +// - eq10Gains: Array of 10 gain values (dB) from 10-band EQ at 31, 62, 125, 250, 500, 1k, 2k, 4k, 8k, 16k Hz // // Returns: // - Array of 15 gain values (dB) for Supersonic at 25, 40, 63, 100, 160, 250, 400, 630, 1k, 1.6k, 2.5k, 4k, 6.3k, 10k, 16k Hz -func InterpolateAutoEQTo15Band(autoEQGains [10]float64) [15]float64 { +func InterpolateEQ10To15Band(eq10Gains [10]float64) [15]float64 { var result [15]float64 for i, targetFreq := range supersonicFreqs { @@ -25,21 +25,21 @@ func InterpolateAutoEQTo15Band(autoEQGains [10]float64) [15]float64 { if lowerIdx == upperIdx { // Exact match - use the AutoEQ gain directly - result[i] = autoEQGains[lowerIdx] + result[i] = eq10Gains[lowerIdx] } else if lowerIdx == -1 { // Target frequency is below the lowest AutoEQ band (25 Hz < 31.25 Hz) // Extrapolate using the first two AutoEQ bands - result[i] = extrapolateBelow(targetFreq, autoEQGains) + result[i] = extrapolateBelow(targetFreq, eq10Gains) } else if upperIdx == -1 { // Target frequency is above the highest AutoEQ band (should not happen with our ranges) // Use the highest AutoEQ gain - result[i] = autoEQGains[len(autoEQGains)-1] + result[i] = eq10Gains[len(eq10Gains)-1] } else { // Interpolate between two AutoEQ bands fLow := autoEQFreqs[lowerIdx] fHigh := autoEQFreqs[upperIdx] - gLow := autoEQGains[lowerIdx] - gHigh := autoEQGains[upperIdx] + gLow := eq10Gains[lowerIdx] + gHigh := eq10Gains[upperIdx] // Calculate logarithmic position between the two bands // t = log(targetFreq/fLow) / log(fHigh/fLow) @@ -107,9 +107,9 @@ func extrapolateBelow(targetFreq float64, autoEQGains [10]float64) float64 { return g1 + slope*math.Log(targetFreq/f1) } -// Interpolate15BandTo10Band converts a 15-band ISO equalizer to 10-band format. +// InterpolateEQ15BandTo10Band converts a 15-band ISO equalizer to 10-band format. // Uses logarithmic frequency positioning with linear dB interpolation. -func Interpolate15BandTo10Band(gains15Band [15]float64) [10]float64 { +func InterpolateEQ15BandTo10Band(gains15Band [15]float64) [10]float64 { var result [10]float64 for i, targetFreq := range autoEQFreqs { diff --git a/backend/autoeq_interpolate_test.go b/backend/eq_interpolate_test.go similarity index 94% rename from backend/autoeq_interpolate_test.go rename to backend/eq_interpolate_test.go index 1eeb7e7..7a73b89 100644 --- a/backend/autoeq_interpolate_test.go +++ b/backend/eq_interpolate_test.go @@ -8,7 +8,7 @@ import ( func TestInterpolateAutoEQTo15Band_FlatProfile(t *testing.T) { // Test with a flat profile (all zeros) flatProfile := [10]float64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - result := InterpolateAutoEQTo15Band(flatProfile) + result := InterpolateEQ10To15Band(flatProfile) for i, gain := range result { if math.Abs(gain) > 0.001 { @@ -24,7 +24,7 @@ func TestInterpolateAutoEQTo15Band_ExactMatches(t *testing.T) { // Exact matches: 250 (idx 5→3), 1k (idx 5→8), 4k (idx 7→11), 16k (idx 9→14) testProfile := [10]float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - result := InterpolateAutoEQTo15Band(testProfile) + result := InterpolateEQ10To15Band(testProfile) tests := []struct { supersonicIdx int @@ -51,7 +51,7 @@ func TestInterpolateAutoEQTo15Band_Interpolation(t *testing.T) { testProfile := [10]float64{0, 0, 0, 0, 0, 10, 0, 0, 0, 0} // Only 1000 Hz (index 5) has gain of 10 dB - result := InterpolateAutoEQTo15Band(testProfile) + result := InterpolateEQ10To15Band(testProfile) // Check that 1000 Hz (index 8) has the exact value if math.Abs(result[8]-10) > 0.001 { @@ -75,7 +75,7 @@ func TestInterpolateAutoEQTo15Band_Extrapolation(t *testing.T) { testProfile := [10]float64{5, 10, 0, 0, 0, 0, 0, 0, 0, 0} // 31.25 Hz = 5 dB, 62.5 Hz = 10 dB - result := InterpolateAutoEQTo15Band(testProfile) + result := InterpolateEQ10To15Band(testProfile) // 25 Hz should be extrapolated below 31.25 Hz // Since the slope is positive (5 to 10), 25 Hz should be < 5 dB @@ -94,7 +94,7 @@ func TestInterpolateAutoEQTo15Band_RealProfile(t *testing.T) { // Approximating a V-shaped response testProfile := [10]float64{6, 5, 3, 1, 0, 0, 1, 3, 5, 6} - result := InterpolateAutoEQTo15Band(testProfile) + result := InterpolateEQ10To15Band(testProfile) // Verify output is reasonable if len(result) != 15 { @@ -115,7 +115,7 @@ func TestInterpolateAutoEQTo15Band_MonotonicPreservation(t *testing.T) { // If AutoEQ gains are monotonically increasing, interpolated values should also increase monotonicProfile := [10]float64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - result := InterpolateAutoEQTo15Band(monotonicProfile) + result := InterpolateEQ10To15Band(monotonicProfile) // Check general increasing trend (allowing for some extrapolation variance at edges) for i := 2; i < len(result)-1; i++ { diff --git a/ui/dialogs/settingsdialog.go b/ui/dialogs/settingsdialog.go index bf99bb9..2d30438 100644 --- a/ui/dialogs/settingsdialog.go +++ b/ui/dialogs/settingsdialog.go @@ -42,14 +42,14 @@ type SettingsDialog struct { OnPageNeedsRefresh func() OnClearCaches func() - config *backend.Config - audioDevices []mpv.AudioDevice - themeFiles map[string]string // filename -> displayName - promptText *widget.RichText - eqPresetManager *backend.EQPresetManager - autoEQManager *backend.AutoEQManager - imageManager util.ImageFetcher - window fyne.Window + config *backend.Config + audioDevices []mpv.AudioDevice + themeFiles map[string]string // filename -> displayName + promptText *widget.RichText + eqPresetManager *backend.EQPresetManager + autoEQManager *backend.AutoEQManager + imageManager util.ImageFetcher + window fyne.Window clientDecidesScrobble bool @@ -534,7 +534,7 @@ func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem // Use interpolation to downsample var bands15 [15]float64 copy(bands15[:], currentBands) - bands10 := backend.Interpolate15BandTo10Band(bands15) + bands10 := backend.InterpolateEQ15BandTo10Band(bands15) newBands = bands10[:] } else { // Already 10-band or invalid size, just copy what we can @@ -548,7 +548,7 @@ func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem // Use interpolation to upsample var bands10 [10]float64 copy(bands10[:], currentBands) - bands15 := backend.InterpolateAutoEQTo15Band(bands10) + bands15 := backend.InterpolateEQ10To15Band(bands10) newBands = bands15[:] } else { // Already 15-band or invalid size, just copy what we can