ohos: Create the JS engine for the selected voice
Core Speech Kit takes the timbre only in createEngine(), so the engine
was created up front for a hardcoded language and timbre, and setVoice()
could not affect it.
Create the engine on the first say() instead, for the voice that is
selected at that point, and replace it when the voice changes. Doing it
lazily rather than in setVoice() keeps an ongoing utterance alive, since
replacing the engine would cut it off.
Shut the current engine down before creating the new one. Releasing the
old proxy after the new one has been created leaves the new engine
attached to a service that the old engine's shutdown() then tears down,
and speak() fails with error 1002300007, "service not initialized".
Core Speech Kit does not document that the service is shared between
engines; this was measured on a device.
createTextToSpeechEngineOhos() no longer reports a failure through its
errorString argument, matching the other engine plugins; a failure to
create the engine now surfaces through errorReason() and errorString()
of the engine itself.
Task-number: QTBUG-149561
Pick-to: 6.12
Change-Id: I04472bb9778f1ee49295b9dbdea8cab49f830d13
Reviewed-by: Liang Qi <liang.qi@qt.io>