@@ -29,7 +29,6 @@ class TTS: NSObject {
2929 var isPreviousJa = false
3030 var isPreviousZh = false
3131 var isPreviousJaExisted = false
32- var isMultipleJaExisted = false
3332
3433 var lastUtterance : AVSpeechUtterance ?
3534 var isPaused = false
@@ -78,7 +77,7 @@ class TTS: NSObject {
7877 }
7978 var synth : AVSpeechSynthesizer !
8079 if voice. language. contains ( " en " ) , // workaround for iOS14 tts bug
81- ( self . isMultipleJaExisted || ( self . isPreviousJaExisted && self . isPreviousZh) ) {
80+ ( self . isPreviousJa || ( self . isPreviousJaExisted && self . isPreviousZh) ) {
8281 synth = AVSpeechSynthesizer ( )
8382 self . synths [ voice. identifier] = synth
8483 } else {
@@ -96,29 +95,31 @@ class TTS: NSObject {
9695 self . isPreviousJa = voice. language. contains ( " ja " )
9796 self . isPreviousZh = voice. language. contains ( " zh " )
9897 self . isPreviousJaExisted = ( self . isPreviousJaExisted || self . isPreviousJa) && !voice. language. contains ( " en " )
99- self . isMultipleJaExisted = ( self . isPreviousJaExisted && self . isPreviousJa) && !voice. language. contains ( " en " )
10098 }
10199 return promise
102100 }
103101
104102 private func getNormalizedVolume( voice: AVSpeechSynthesisVoice ) -> Float {
105103 if voice. identifier == " com.apple.ttsbundle.Mei-Jia-compact " {
106- return 0.80
104+ return 0.77
107105 }
108106 if voice. identifier == " com.apple.ttsbundle.Mei-Jia-premium " {
109- return 0.88
107+ return 0.86
110108 }
111109 if voice. identifier == " com.apple.ttsbundle.Sin-Ji-compact " {
112- return 0.85
110+ return 0.83
113111 }
114112 if voice. identifier == " com.apple.ttsbundle.Sin-Ji-premium " {
115- return 0.79
113+ return 0.76
116114 }
117115 if voice. language. contains ( " en " ) && voice. quality == . enhanced {
118- return 0.88
116+ return 0.86
117+ }
118+ if voice. language. contains ( " en " ) && voice. quality == . default {
119+ return 0.96
119120 }
120121 if voice. language. contains ( " ja " ) && voice. quality == . enhanced {
121- return 0.88
122+ return 0.86
122123 }
123124 return 1.0
124125 }
@@ -138,7 +139,6 @@ class TTS: NSObject {
138139 self . isPreviousJa = voice. language. contains ( " ja " )
139140 self . isPreviousZh = voice. language. contains ( " zh " )
140141 self . isPreviousJaExisted = ( self . isPreviousJaExisted || self . isPreviousJa) && !voice. language. contains ( " en " )
141- self . isMultipleJaExisted = ( self . isPreviousJaExisted && self . isPreviousJa) && !voice. language. contains ( " en " )
142142 }
143143 }
144144
0 commit comments