Q: Qt - [c++] Qt6 TextToSpeech does not use Localization
Unsolved
Game Development
-
Hello everyone!
Ich ported my project to Qt6. In the Windows build, everything works fine, except that the TextToSpeech engine does not speak English anymore (which worked in Qt 5.15.2).
I used the following function. Explanation: I try to switch randomly between different voices. (In Windows i usually have only one voice).What's wrong?
void SpeechClass::say(QString text, bool ) { if (text2Speech == nullptr) { QLocale::setDefault(QLocale(QLocale::English, QLocale::LatinScript, QLocale::UnitedStates)); text2Speech = new QTextToSpeech(this); text2Speech->setVolume(0.88); text2Speech->setLocale(QLocale(QLocale::English, QLocale::LatinScript, QLocale::UnitedStates)); QVector<QLocale> _l = text2Speech->availableLocales(); int num_locales = _l.size(); for (int loc = 0; loc < num_locales; loc++) { if (_l.at(loc).language() == QLocale::English) { text2Speech->setLocale(_l.at(loc)); QVector<QVoice> _v = text2Speech->availableVoices(); int num_voices = _v.size(); int __v = rand() % num_voices; text2Speech->setVoice(_v.at(__v)); break; } } } text2Speech->setLocale(QLocale(QLocale::English, QLocale::LatinScript, QLocale::UnitedStates)); text2Speech->say(text); }
best regards, kevin_d
-
Hi,
Which version of Qt 6 are you using ?
On which version of Windows ?