flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

Fixed `setVoice` on Windows

Open Dancovich opened this issue 1 year ago • 0 comments

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 locale property (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.

Dancovich avatar Aug 24 '24 16:08 Dancovich