feat: voice and model pickers with sync-on-join (Phase 4)
- Voices.swift: 13 Azure voices, default en-US-Ava - SettingsStore: persist voiceID/modelID, fallback to default voice - VoiceSession: sync set_voice/set_model on agent_ready, selectVoice/selectModel, track models + model_changed - SettingsView: voice and model picker sheets - ControlChannel: publish via publish(data:) reliable data channel instead of sendText DataStream (agent listens on legacy data_received; DataStream text was dropped)
This commit is contained in:
1 parent
5483e6ed48
commit
ca2d26f171
8 files changed
+256
-14
No files matched your search
@@ -29,7 +29,8 @@ final class SettingsStore: ObservableObject {
|
||||
init() {
|
||||
let d = UserDefaults.standard
|
||||
serverURL = d.string(forKey: Keys.serverURL) ?? "https://192.168.86.2:9178"
|
||||
voiceID = d.string(forKey: Keys.voiceID) ?? ""
|
||||
let storedVoice = d.string(forKey: Keys.voiceID)
|
||||
voiceID = Voices.all.contains { $0.id == storedVoice } ? (storedVoice ?? "") : Voices.defaultID
|
||||
modelID = d.string(forKey: Keys.modelID)
|
||||
textMode = d.bool(forKey: Keys.textMode)
|
||||
volume = d.object(forKey: Keys.volume) as? Double ?? 0.8
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import Foundation
|
||||
|
||||
struct VoiceOption: Equatable {
|
||||
let id: String
|
||||
let name: String
|
||||
let tag: String?
|
||||
|
||||
var displayName: String {
|
||||
tag.map { "\(name) (\($0))" } ?? name
|
||||
}
|
||||
}
|
||||
|
||||
enum Voices {
|
||||
static let all: [VoiceOption] = [
|
||||
VoiceOption(id: "en-US-Ava:DragonHDOmniLatestNeural", name: "Ava", tag: "Dragon HD Omni"),
|
||||
VoiceOption(id: "en-US-JennyNeural", name: "Jenny", tag: nil),
|
||||
VoiceOption(id: "en-US-GuyNeural", name: "Guy", tag: nil),
|
||||
VoiceOption(id: "en-US-AndrewNeural", name: "Andrew", tag: nil),
|
||||
VoiceOption(id: "en-US-AriaNeural", name: "Aria", tag: nil),
|
||||
VoiceOption(id: "en-US-EmmaNeural", name: "Emma", tag: nil),
|
||||
VoiceOption(id: "en-US-EricNeural", name: "Eric", tag: nil),
|
||||
VoiceOption(id: "en-US-BrianNeural", name: "Brian", tag: nil),
|
||||
VoiceOption(id: "en-US-AshleyNeural", name: "Ashley", tag: nil),
|
||||
VoiceOption(id: "en-US-RichardNeural", name: "Richard", tag: nil),
|
||||
VoiceOption(id: "en-US-TinaNeural", name: "Tina", tag: nil),
|
||||
VoiceOption(id: "en-US-SteffanNeural", name: "Steffan", tag: nil),
|
||||
]
|
||||
|
||||
static var defaultID: String { all[0].id }
|
||||
|
||||
static func display(for id: String) -> String? {
|
||||
all.first { $0.id == id }?.displayName
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user