Don't double-label voices whose name already carries the quality tier
Premium/enhanced voices ship with the tier in their name (e.g. "Ava (Premium)"), so appending "— Premium" produced "Ava (Premium) — Premium" in the voice picker. Move the label logic to SpeechSettings.displayLabel and skip the suffix when the name already contains the tier (still name-only for default voices). Deterministic string helper, unit-tested. Claude-Session: https://claude.ai/code/session_01BQcEWmAPA78338QuEwRkAh
This commit is contained in:
@@ -100,6 +100,16 @@ enum SpeechSettings {
|
||||
@unknown default: "Default"
|
||||
}
|
||||
}
|
||||
|
||||
/// The picker label for a voice: its name, with the quality tier appended only when it
|
||||
/// adds information. Default voices get no suffix (labeling every one "Default" is noise),
|
||||
/// and enhanced/premium voices whose name already carries the tier — e.g. "Ava (Premium)" —
|
||||
/// aren't labeled twice.
|
||||
static func displayLabel(name: String, quality: AVSpeechSynthesisVoiceQuality) -> String {
|
||||
guard quality != .default else { return name }
|
||||
let label = qualityLabel(quality)
|
||||
return name.localizedCaseInsensitiveContains(label) ? name : "\(name) — \(label)"
|
||||
}
|
||||
}
|
||||
|
||||
private extension AVSpeechSynthesisVoiceQuality {
|
||||
|
||||
Reference in New Issue
Block a user