Commit Graph

61 Commits

Author SHA1 Message Date
Bastien Bouclet
34bf3f2de0 TTS: Fix use of virtual function in TTSMan destructor
TextToSpeechManager::freeVoiceData was called while the virtual function
table pointer was already reset by the parent class destructor.
2019-11-15 21:24:22 +01:00
sluicebox
fc9786231c TTS: Improve Windows audio, remove sphelper-scummvm.h
- Remove sphelper-scummvm.h
- Use default audio quality instead of lowest
- Add HRESULT tests
- Fix new[]/free() mismatches
- Fix voice description memory leak
2019-11-06 11:00:37 -08:00
Jaromir Wysoglad
b9d3c84db4 TTS: Fix language setting. 2019-10-16 19:30:56 +02:00
sluicebox
da77bfd792 TTS: Use lowercase when including Windows headers
Fixes building for mingw-w64 on case sensitive file systems
2019-10-11 15:41:53 -07:00
sluicebox
912bbf364c TTS: Enable in Mingw-w64 builds
TTS libraries can now be used in default Mingw-w64 environments.

- Removes reference to sapiddk.h which isn't used and isn't in Mingw-w64
- Defines guids whose symbols are missing from Mingw-w64
- Restores TTS detection to configure script
2019-10-10 22:55:12 +03:00
Jaromir Wysoglad
26bf329b95 TTS: Fix possible deadlock 2019-09-05 23:52:46 +01:00
Jaromir Wysoglad
ba859f1eed TTS: Minimize the time needed for stop() on Win32
This gets rid of freezes when using TTS on Windows.
2019-09-05 23:52:46 +01:00
Jaromir Wysoglad
55c399c7c0 TTS: Use Common::Encoding for encoding conversion. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4b5b812712 TTS: Better documentation of TTSVoice. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
0d332e065e TTS: Rename LinuxTextToSpeechManager to SpeechDispatcherManager
Add a new define for the SpeechDispatcherManager
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b97333d4b7 TTS: Remove USE_PLATFORM_TTS defines
Use defined(USE_TTS) && defined(PLATFORM) instead
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
d49331132a TTS: Add summary of changes in sphelper-scummvm.h 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c402666635 TTS: Refactoring
Refactoring as suggested by bluegr on github.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c861581adc TTS: Fix missing indentation 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c2c4458253 JANITORIAL: Remove some trailing whitespaces 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b1bffaba86 TTS: Implement our own queuing on windows.
Similarly as on linux, there isn't enough control of the speech
queue to properly implement INTERRUPT_NO_REPEAT. So since this
commit we use our own queuing and use SAPI to speak each speech.
This is done outside the main thread.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
be5c865c50 TTS: Add proper speech queuing, update INT_NO_REP.
Before I used SPD to queue messages and I had a copy of the queue,
so I could requeue everything when resume is called(). But more
control of the queue is needed, so I don't use the SPD's queue
and instead start speeches from my queue one by one from another
thread.

INTERRUPT_NO_REPEAT now behaves as described in the documentation
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
bc10117980 TTS: Restart SPD if resume() fails. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4036b73b6c TTS: Fix INTERRUPT_NO_REPEAT on Windows 2019-09-01 22:47:55 +03:00
Thierry Crozat
13a32fc5e9 TTS: Implement *_NO_REPEAT actions and Fix state synchronization issues on macOS
The NSSpeechSynthesizer is asynchronous and does not immediately start, pause,
or stop the speech. As a result querrying the state of the NSSpeechSynthesizer
does not alwats return the expected result (for example isSpeaking may not
yet been true just after we requested starting to speak). So instead the
TextToSpeechManager on macOS keeps track of the state itself.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
21fb4cef06 TTS: Implement our own queuing for linux
It seems like, that at least some versions of speech-dispatcher
aren't able to successfuly pause and resume. For me, when trying
to pause, it still finishes the speech just being said instead
of pausing it and then it puts it at the end of the speech queue
with some speech-dispatcher internal commands added to it, which
are also hearable.

There is no way to find out where the speech ended when calling
pause, so it is just stopped and when resume is called it is
read from it's start again.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4bae32ffe7 TTS: Add *_NO_REPEAT actions 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
feaba6fff6 TTS: Reimplement isSpeaking on Windows. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
1234f8e42f TTS: Fix pause() and resume() on linux 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
7ec4f03a08 TTS: Make state switching faster on Linux 2019-09-01 22:47:55 +03:00
Thierry Crozat
9ca2602e82 TTS: Implement speech queueing on macOS 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
6703f88f7f TTS: Implement speech queueing on Linux and Win 2019-09-01 22:47:55 +03:00
Thierry Crozat
bac880816b TTS: Stop or pause speaking on word boundaries in macOS implementation 2019-09-01 22:47:55 +03:00
Thierry Crozat
0434419b31 TTS: Implement TextToSpeechManager for macOS 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
e965df1e88 TTS: Add TTS support when compiling with msvc. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
c7dbf192ef TTS: Remove unneeded code
Remove debuging outputs
Remove commented iconv implementation of text conversion to UTF-8
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
58065ceacd TTS: Refactoring
* Delete multiple empty rows
 * Make getVolume non-virtual and leave just the implementation
    in base class
 * Resolve warning about signed / unsigned comparison in
    gui-manager
 * Clear availableVoices when updating voices on linux
 * By default set language to transMan language on windows
    (if the transMan is available)
 * Remove freeVoices method from Windows ttsMan, it isn't needed
    anymore
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
0631070833 TTS: Fix state switching on windows
Voice is changed when changing language on windows, so when poping
state, the voice, that should get set has to be saved before
changing the language.

The speech shouldn't continue when changing state, so it is stopped
in pushState and popState.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
e4363ba229 TTS: Minor Windows TTS refactoring
Main changes are:
 * Save age information about each voice
 * Remove Sample TTS Voice from available voices, because it
 	basicaly cannot speak.
 * Stop speech after silently playing the test speech (the last
 	voice could be heard speaking after the volume got
	restored to its original value)
 * Remove voice data freeing from freeVoices, because it gets
 	freed automaticaly
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
134d955006 TTS: Add iconv implementation of strToUtf8
This might be useful in the future, because SDL cannot convert
from some important encodings (for example CP850)
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
3027acc12e TTS: Minor refactorisations
- Add comment to tts initialization on Windows
 - Correctly free the voicesInfo in linux ttsMan
 - Remove popState method from linux-text-to-speech.h and
	windows-text-to-speech.h
 - Add tts to help in configure
 - Refactor language setting in gui-manager.cpp
	It counted with english being the default language in
	ttsMan constructors, which isn't true anymore.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
b5d5576f90 TTS: Add check to getVoice, fix typo.
Check if _availableVoices isn't empty.
Replace availaible with available
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
788b15652d TTS: Change String == "" to String.empty() 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
7c78912931 TTS: Move popState to the base class 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
d31ffb676a TTS: Implement conversion to unicode in say on win 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
5c1f562452 TTS: Implement conversion to UTF-8 in say on linux 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
4d95720731 TTS: Fix voice setting on startup
The ScummVM was crashing because of an assert, when there was less
voices availaible, than what was set in the ConfMan.

Now the voice just falls back to 0th voice, if there are not
enough voices.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
5d9f03e71d TTS: Add reference counting to TTSVoice
Also refactor TTSVoice destruction to use this reference counting.
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
8e4a24f55e TTS: Unify setters between linux and win backends. 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
ce64528129 TTS: Make sure that TTS lang matches transMan lang 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
33f8aadfeb TTS: Add age to TTSVoice 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
318c6d7ec6 TTS: Finish implementing the Windows TTS manager 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
d2d34a4eca TTS: Start implementing windows TTS 2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
8357e8e6bf TTS: Prepare for windows TTS
Add windows configuration in configure
Add basic skeleton to backends
Check if ttsMan is initialized in GUI
2019-09-01 22:47:55 +03:00
Jaromir Wysoglad
5ee30a1b73 TTS: Convert strings to UTF-8
Conversion happens only for languages, that might needed (not
for english)
2019-09-01 22:47:55 +03:00