Files

33 lines
1.0 KiB
Go

// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package preferences
import (
"slices"
"strings"
"git.stormux.org/storm/cthulhu/internal/speech"
)
// default_voices filters eSpeak's language/variant combinations for controls
// without an explicit language selection. Saved voices remain available through
// the caller's selected-family entry, and the full language catalog is retained.
func (session *uiSession) default_voices(module string) []speech.Voice {
voices := session.catalog[module]
if strings.Contains(strings.ToLower(module), "espeak") {
return speech.LocaleVoices(voices)
}
if module == "" {
// Speech Dispatcher also lists the default synthesizer under an empty
// module name. Match its catalog to identify eSpeak without guessing.
for name, candidates := range session.catalog {
if strings.Contains(strings.ToLower(name), "espeak") && slices.Equal(voices, candidates) {
return speech.LocaleVoices(voices)
}
}
}
return voices
}