fix: properly handle CN_043 voice in EN and KR
This commit is contained in:
@@ -95,7 +95,7 @@ export default class Voice {
|
||||
this.#default.language.voice = this.#voice.languages[0]
|
||||
this.#config.language = this.#default.language.voice
|
||||
this.#voice.locations = this.#getVoiceLocations()
|
||||
this.#voice.list = Object.keys(this.#getVoices())
|
||||
this.#voice.list = this.#charwordTable.availability[this.#config.language]
|
||||
}
|
||||
|
||||
success() {
|
||||
@@ -206,7 +206,7 @@ export default class Voice {
|
||||
const content = subtitle.text
|
||||
const cvInfo =
|
||||
this.#charwordTable.voiceLangs[this.subtitleLanguage][
|
||||
this.#config.language
|
||||
this.#config.language
|
||||
]
|
||||
document.getElementById('voice-title').innerText = title
|
||||
document.getElementById('voice-subtitle').innerText = content
|
||||
@@ -251,15 +251,7 @@ export default class Voice {
|
||||
|
||||
#nextVoice() {
|
||||
const getVoiceId = () => {
|
||||
let list = this.#voice.list
|
||||
if (
|
||||
this.#config.language === 'EN' ||
|
||||
this.#config.language === 'KR'
|
||||
) {
|
||||
// filter out CN_043 as this voice is not available in en and kr
|
||||
list = list.filter((item) => item !== 'CN_043')
|
||||
}
|
||||
const id = list[Math.floor(Math.random() * list.length)]
|
||||
const id = this.#voice.list[Math.floor(Math.random() * this.#voice.list.length)]
|
||||
return id === this.#voice.id.last ? getVoiceId() : id
|
||||
}
|
||||
this.#playVoice(getVoiceId())
|
||||
@@ -360,8 +352,10 @@ export default class Voice {
|
||||
set language(lang) {
|
||||
if (this.#voice.languages.includes(lang)) {
|
||||
this.#config.language = lang
|
||||
this.#voice.list = this.#charwordTable.availability[lang]
|
||||
} else {
|
||||
this.#config.language = this.#default.language.voice
|
||||
this.#voice.list = this.#charwordTable.availability[this.#config.language]
|
||||
}
|
||||
const availableSubtitleLang = this.#getSubtitleLanguages()
|
||||
if (!availableSubtitleLang.includes(this.#config.subtitle.language)) {
|
||||
|
||||
Reference in New Issue
Block a user