28 lines
785 B
Go
28 lines
785 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package config
|
|
|
|
// EffectiveVoice resolves a sparse voice over Default. Uppercase retains the
|
|
// established pitch of 7 unless the user explicitly chooses another pitch.
|
|
func EffectiveVoice(settings Settings, kind string) Voice {
|
|
voice := cloneVoice(settings.DefaultVoice)
|
|
var override Voice
|
|
switch kind {
|
|
case "uppercase":
|
|
pitch := 7.0
|
|
if voice.AveragePitch != nil {
|
|
pitch = min(9, max(pitch, *voice.AveragePitch+2))
|
|
}
|
|
voice.AveragePitch = &pitch
|
|
override = settings.UppercaseVoice
|
|
case "hyperlink":
|
|
override = settings.HyperlinkVoice
|
|
case "system":
|
|
override = settings.SystemVoice
|
|
}
|
|
mergeVoice(&voice, cloneVoice(override))
|
|
return voice
|
|
}
|