Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions Chapter 1/HelloAVF/HelloAVF/SpeechController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,23 @@ import AVFoundation

class SpeechController {

let synthesizer: AVSpeechSynthesizer
private let voices: [AVSpeechSynthesisVoice]
private let speechStrings: [String]
let synthesizer = AVSpeechSynthesizer()

init() {
synthesizer = AVSpeechSynthesizer()
private let voices = [
AVSpeechSynthesisVoice(language: "en-US")!,
AVSpeechSynthesisVoice(language: "en-GB")!
]

voices = [
AVSpeechSynthesisVoice(language: "en-US")!,
AVSpeechSynthesisVoice(language: "en-GB")!
]

speechStrings = [
"Hello AV Foundation. How are you?",
"I'm well! Thanks for asking.",
"Are you excited about the book?",
"Very! I have always felt so misunderstood.",
"What's your favorite feature?",
"Oh, they're all my babies. I couldn't possibly choose.",
"It was great to speak with you!",
"The pleasure was all mine! Have fun!"
]
}
private let speechStrings = [
"Hello AV Foundation. How are you?",
"I'm well! Thanks for asking.",
"Are you excited about the book?",
"Very! I have always felt so misunderstood.",
"What's your favorite feature?",
"Oh, they're all my babies. I couldn't possibly choose.",
"It was great to speak with you!",
"The pleasure was all mine! Have fun!"
]

func beginConversation() {
for i in 0..<speechStrings.count {
Expand Down