Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SAPI4 failing to load some voices (#17726)
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 ITTSCentral objects (with feature flag TTSFEATURE_SINGLEINSTANCE). The synth driver tries to detect whether a parameter is supported or not when loading the voice. However, removeSetting is checking against the name attribute of each setting, which should now be called id. 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 == name is changed to if s.id == name. Before creating a new ITTSCentral object, and when terminate is called, set both _ttsCentral and _ttsAttrs to None to release the previous ITTSCentral object. Ignore the exception thrown from _ttsCentral.UnRegister. Some voices do not handle this well, and the whole ITTSCentral will be released anyway. Some voices keep the pausing state even after resetting, meaning that they will still pause the audio after _ttsCentral.AudioReset and silence the output. A variable _paused is used to track the pausing state, and if it's paused, unpause it before resetting.
- Loading branch information