samtupy / nvgt

The Nonvisual Gaming Toolkit
https://nvgt.gg
Other
43 stars 27 forks source link

Added AVSpeechSynthesizer support for macOS. #38

Closed GruiaChiscop closed 3 weeks ago

GruiaChiscop commented 1 month ago

Added the TTSVoice class, which brings support for AVSpeechSynthesizer. Not registered yet on the script. All methods of this class work, besides speakWait. Unfortunately, I don't know if it can be built outside of Xcode.

samtupy commented 1 month ago

Hi, Thanks much for this! I'm thinking that what would be best is to move TTSVoice.h and .mm into the dep folder NVGT has, we can call them AVTTSVoice.h/.mm, and can get them to build with SCons thus forgoing the need for Xcode and conforming to the rest of the build syystem used by NVGT. Then, nvgt's source code can include AVTTSVoice.h and, similar to how the existing tts_voice object wraps blastspeak on windows, can then wrap your object for MacOS using an expansion of the already existing platform ifdefs in tts.cpp. The reason we want to do that instead of registering 2 classes like this is because this way the same code will run on multiple platforms without the scripter needing to switch tts implementations per platform. Sorry it took me a few days to get to this, I can begin implementing this into the existing tts_voice class in the next couple of days. Thanks again!