Gargoyle Text-To-Speech doesn't work

I don’t know why (maybe it wasn’t built with TTS turned on), or maybe TTS only works on Mac and Linux (which will be a first, I must admit), but text-to-speech (which I didn’t even know was a feature) doesn’t work in Gargoyle. I would rebuild it myself but I’m not familiar with any of the requirements. I can’t say I’ve ever used Cmake or dealt with multiple toolchains in MinGW.

3 Likes

The official Windows releases do come with TTS enabled. However, I don’t have an actual Windows system to test with, so the best I’m able to do is write code that follows Microsoft’s documentation for TTS and hope for the best. The current code is based on earlier TTS code that, presumably, worked… but I have no way of guaranteeing that.

If anybody else is able to test TTS on Windows, that’d be helpful: it’d be nice to know if this is a local configuration thing or Gargoyle just flat out not working at all.

And if there are any Windows experts around, I’d very much appreciate a glance at Gargoyle’s ttswin.cpp, to see if there’s anything obviously wrong. It’s a very small file.

2 Likes

I can confirm that TTS doesn’t work on Mac OS either—or at least I was never able to figure out how to get it up and running when I tried it a couple years ago.

I compiled Gargoyle myself on FreeBSD, including all the options. Just now I changed “speak” in the configuration file from 0 to 1, and when I opened a game, it started reading all the text out loud. I don’t see why it wouldn’t work the same way in other operating systems.

Looking at the code it looks basically okay. If it were me, I wouldn’t have the CoInitialize() and CoUninitialize() calls in the TTS code. Ideally, you’d call CoInitialize() once, early on in process start-up, and call CoUninitialize() either as the last thing when shutting down, or even not at all: there’s no harm in removing that call, it will all get cleaned up when the process exits.

You might also want to change the test for the result of CoInitialize(). One reason for calling it once early on in process start-up is that if you end up calling it again without a CoUninitialize() in between, the return value you get will be S_FALSE, not S_OK, meaning “This call is not needed so I’ve done nothing, but everything’s okay”. The canonical way to express that would be to use the “SUCCEEDED” macro to check for success, i.e.

  if (SUCCEEDED(CoInitialize(nullptr))) {

You can sometimes get odd effects with rubbish anti-virus software injecting threads into processes which have side effects, such as leaving COM initialized by a call to CoInitialize().

1 Like

This seems to work on macOS as well. You’ll have to edit the garglk.ini file manually, save it and restart Gargoyle for the new setting to take effect.

EDIT: I just noticed that you don’t actually have to restart Gargoyle. You can just open a new game, and it will use the new settings. Editing the ini file won’t affect any running games, though.

“Control-comma” (command-comma on Mac) works to edit the config file.

1 Like

I probably should’ve indicated this in my first post, but I edited the garglk.ini file and set the speak variable to 1. Still doesn’t work on Windows.

Thanks for looking over the code, I appreciate it. I’ll update Gargoyle with these changes in mind.

@blindHunter Unfortunately these changes won’t affect whether the TTS works or not. I’ll try to get a Windows VM with sound working locally so I can test. Until then, I’m not sure why it wouldn’t be working in Windows.

1 Like