update pod
This commit is contained in:
@@ -54,9 +54,45 @@ class DDSpeechSynthesizerItem: NSObject, AVSpeechSynthesizerDelegate {
|
||||
self.eachLoopCompletionBlock = eachLoopCompletionBlock
|
||||
self.endCompletionBlock = endCompletionBlock
|
||||
|
||||
var broadcast = text
|
||||
|
||||
for index in 0..<broadcast.count {
|
||||
let char = broadcast[broadcast.index(broadcast.startIndex, offsetBy: index)]
|
||||
if char == "0" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "零")
|
||||
}
|
||||
if char == "1" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "一")
|
||||
}
|
||||
if char == "2" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "二")
|
||||
}
|
||||
if char == "3" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "三")
|
||||
}
|
||||
if char == "4" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "四")
|
||||
}
|
||||
if char == "5" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "五")
|
||||
}
|
||||
if char == "6" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "六")
|
||||
}
|
||||
if char == "7" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "七")
|
||||
}
|
||||
if char == "8" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "八")
|
||||
}
|
||||
if char == "9" {
|
||||
broadcast.replaceSubrange(broadcast.index(broadcast.startIndex, offsetBy: index)...broadcast.index(broadcast.startIndex, offsetBy: index), with: "九")
|
||||
}
|
||||
}
|
||||
|
||||
synthesizer = AVSpeechSynthesizer()
|
||||
synthesizer?.delegate = self
|
||||
utterance = AVSpeechUtterance(string: text)
|
||||
utterance = AVSpeechUtterance(string: broadcast)
|
||||
utterance?.voice = AVSpeechSynthesisVoice(language: "zh-Hans")
|
||||
utterance?.rate = AVSpeechUtteranceDefaultSpeechRate
|
||||
if let utterance {
|
||||
|
||||
Reference in New Issue
Block a user