Open DavidKinder opened 5 years ago
You can make the TTS more 'dynamic" and "confortable" by stopping any current TTS text being rendered when you send a new one to be spoken (when you type a new request). This way you can avoid listening to the same WHOLE text you already heard before when REENTERING a "room", as a new "command" will "discard the queued sentences being spoken". This is easily done by changing the source code in "FrotzSound.cpp" in two points:
typedef enum SPEAKFLAGS {
SPF_ASYNC = (1L<<0),
SPF_PURGEBEFORESPEAK = (1L << 1)
} SPEAKFLAGS;
and
// Speak some text
void TextToSpeech::Speak(LPCWSTR speech)
{
if (m_voice != NULL)
m_voice->Speak(speech,SPF_ASYNC | SPF_PURGEBEFORESPEAK,NULL);
}
and just to deal correctly with the loading of a "new adventure", just change FrotzApp.cpp like this:
// Load a new game
void FrotzApp::OnFileNew()
{
if (PromptForGame(false))
{
// code added
FrotzSound::ShutDown();
m_spokenIndex = 0;
//
StoreWindowSize();
m_wantRestart = true;
theWnd->InputType(FrotzWnd::Input::CheckRestart);
}
}
Suggestions from Nikita Tseykovets:
Add a key press to skip the current sentence, and another key to repeat the last sentence. This needs rules to define what constitutes a sentence, but that should be possible.
Add hotkeys to turn sound on and off, and to control the sound volume, without affecting speech.