Consolidate shared UI, hardware transport, and translation tooling

This commit is contained in:
Storm Dragon committed 2026-11-16 20:07:56 -05:00
1 parent ed6951f4cd
commit 2c612de63b
61 files changed
+2417 -1573

No files matched your search

+12 -5
View File
@@ -50,7 +50,7 @@ func Drivers() []Driver {
{ID: "tripletalk", Label: "TripleTalk", Hardware: true, Serial: true}}
}
func driver_for(id string) (Driver, bool) {
func driverFor(id string) (Driver, bool) {
for _, driver := range Drivers() {
if driver.ID == id {
return driver, true
@@ -63,7 +63,7 @@ func driver_for(id string) (Driver, bool) {
func (p Profile) Normalize() Profile {
p.Name = strings.TrimSpace(p.Name)
if p.Name == "" {
driver, _ := driver_for(p.Driver)
driver, _ := driverFor(p.Driver)
if !driver.Hardware {
p.Name = strings.TrimSpace(strings.Join([]string{p.Module, p.Voice}, " "))
}
@@ -83,7 +83,7 @@ func (p Profile) Validate() error {
return fmt.Errorf("Voice profile names must be single-line text")
}
}
driver, ok := driver_for(p.Driver)
driver, ok := driverFor(p.Driver)
if !ok {
return fmt.Errorf("Choose a supported synthesizer")
}
@@ -155,17 +155,24 @@ func (c Collection) Remove(index int) Collection {
return next
}
func Same_voice(a, b Profile) bool {
func SameVoice(a, b Profile) bool {
a.Name = ""
b.Name = ""
a.Variant = ""
b.Variant = ""
// Device and baud rate only matter to serial drivers; an editor can keep
// hidden values for them, such as a DECtalk USB profile's serial fields.
for _, p := range []*Profile{&a, &b} {
if driver, _ := driverFor(p.Driver); !driver.Serial {
p.Device, p.BaudRate = "", 0
}
}
return a == b
}
func (c Collection) Matching(p Profile) string {
for _, candidate := range c.Profiles {
if Same_voice(candidate, p) {
if SameVoice(candidate, p) {
return candidate.Name
}
}