fix: active device highlight incorrect when using default device
- mixer.Init: convert database 'default' to '' for SDL default device - AudioOptions.Init: fallback to first SDL device when current device is default and config stores 'default' Fixes known issue from changelog.txt
This commit is contained in:
@@ -169,12 +169,24 @@ func (p *AudioOptions) Init(ctx *PageCtx) error {
|
||||
|
||||
// Set active device index based on mixer's current device
|
||||
currentName := mixer.CurrentDevice()
|
||||
config, err = db.GetConfig(p.Context.DbPtr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
p.activeDeviceIndex = -1 // default to not found
|
||||
for i, dev := range p.AudioDevices {
|
||||
if dev.Label == currentName {
|
||||
p.activeDeviceIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
// If not found and current device is default (""), check saved config
|
||||
if p.activeDeviceIndex == -1 && currentName == "" && config.SelectedAudioDevice == "default" {
|
||||
// Default device is selected - first device in SDL list is typically the default
|
||||
if len(p.AudioDevices) > 0 {
|
||||
p.activeDeviceIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the audio_files table is populated.
|
||||
if err = p.seedAudioFiles(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user