add equalizer UI in settings dialog

This commit is contained in:
Drew Weymouth
2023-06-24 10:47:45 -07:00
parent ab22f871d2
commit 59be258e89
8 changed files with 335 additions and 14 deletions
+9 -1
View File
@@ -448,7 +448,8 @@ func (c *Controller) ShowSettingsDialog(themeUpdateCallbk func(), themeFiles map
devs = []player.AudioDevice{{Name: "auto", Description: "Autoselect device"}}
}
dlg := dialogs.NewSettingsDialog(c.App.Config, devs, themeFiles, c.MainWindow)
bands := c.App.Player.Equalizer().BandFrequencies()
dlg := dialogs.NewSettingsDialog(c.App.Config, devs, themeFiles, bands, c.MainWindow)
dlg.OnReplayGainSettingsChanged = func() {
c.App.PlaybackManager.SetReplayGainOptions(c.App.Config.ReplayGain)
}
@@ -459,6 +460,13 @@ func (c *Controller) ShowSettingsDialog(themeUpdateCallbk func(), themeFiles map
c.App.Player.SetAudioDevice(c.App.Config.LocalPlayback.AudioDeviceName)
}
dlg.OnThemeSettingChanged = themeUpdateCallbk
dlg.OnEqualizerSettingsChanged = func() {
// currently we only have one equalizer type
eq := c.App.Player.Equalizer().(*player.ISO15BandEqualizer)
eq.Disabled = !c.App.Config.LocalPlayback.EqualizerEnabled
copy(eq.BandGains[:], c.App.Config.LocalPlayback.GraphicEqualizerBands)
c.App.Player.SetEqualizer(eq)
}
pop := widget.NewModalPopUp(dlg, c.MainWindow.Canvas())
dlg.OnDismiss = func() {
pop.Hide()