flutter_tts
flutter_tts copied to clipboard
Fixed `setVoice` on Windows
setVoice on Windows is broken, it doesn't use the name of the voice and always gets the last voice that has the same language set.
After investigation, I found two issues with the code in flutter_tts_plugin.cpp:
- Line 441: Comparison incorrectly compares name with voiceLanguage instead of voiceName.
- Line 610: When mapping the Dart call to a C++ call, there's a typo setting the value of the
localeproperty (it says"locle"). - setVoice always returned 1 back to Dart. Now it returns 0 if no voice matching the parameters is found.
This PR fixes these issues. After testing, setVoices can reliably be used to choose a specific voice from the list returned by getVoices.