Fix SAPI4 failing to load some voices#17726
Conversation
See test results for failed build of commit fe03cedc25 |
|
Given there's no related issue filed, can you please provide more information? |
I'd love to file an Issue later today to provide more background about this fix. |
|
There is a very old Chinese speech engine called IBM Chinese TTS Runtime that had been unusable for many years, even causing the Microsoft Speech API version 4 driver to fail to load for users who installed it. This pull request fixes the issue and makes the speech engine work properly again. |
|
Ahh, sorry I didn't say it earlier, PitchCommand doesn't work in the current implementation. |
Link to issue number:
None
Summary of the issue:
The SAPI4 synth driver fails to load some voices, because the voices do not support certain parameters, or because the voices do not expect the client to create multiple instances of
ITTSCentralobjects (with feature flagTTSFEATURE_SINGLEINSTANCE).The synth driver tries to detect whether a parameter is supported or not when loading the voice. However,
removeSettingis checking against thenameattribute of each setting, which should now be calledid. This can cause errors when loading a voice that does not support all the parameters.Description of user facing changes
Some of the SAPI4 voices will no longer fail to load.
Description of development approach
In
removeSetting,if s.name == nameis changed toif s.id == name.Before creating a new
ITTSCentralobject, and whenterminateis called, set both_ttsCentraland_ttsAttrstoNoneto release the previousITTSCentralobject.Ignore the exception thrown from
_ttsCentral.UnRegister. Some voices do not handle this well, and the wholeITTSCentralwill be released anyway.Some voices keep the pausing state even after resetting, meaning that they will still pause the audio after
_ttsCentral.AudioResetand silence the output. A variable_pausedis used to track the pausing state, and if it's paused, unpause it before resetting.Testing strategy:
Manually tested with some voices.
Known issues with pull request:
None yet
Code Review Checklist:
@coderabbitai summary