Files
Shivansps 20b55eb58c TTS Speech rework (#7357)
* add imgui speech options

* adapt existing windows sapi speech implementation

* adapt existing mac speech integration

* add speech linux stubs

* add speech support in linux

* Add array checks

* Use dlopen for speech-dispatcher

* corrrect lib name

* missing includes and static cast

* do not change mac file type

* fix clang tidy warnings 1

* set tts rate

* set localization ids

* fix clang tidy warnings 2

* correct symbol name

* Remove voice cache and fix win enumerate_voices overriding voice selection

* fix mac rate

Done by notimaginative

* requested changes

* re-add voice cache for linux

* Open connection for linux get flags

* fix missing }

* change voice option combobox to std::pair

* delete duplicated voice id sanitizer on windows set voice

* Use pairs for speech_enumerate_voices() and adapt linux speech

* use reference

* actually free vector memory

* Clear voice cache when ingame options closes

* Use extern to call fsspeech_options_cleanup()

* update localization ids

* Fixing some linux and window speech oversights

* Apply volume and rate after a voice change, correct voice, volume and rate apply order
2026-05-14 08:07:11 -04:00

51 lines
1.3 KiB
C++

/*
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
*
* You may not sell or otherwise commercially exploit the source or things you
* created based on the source.
*
*/
#ifndef _SPEECH_H_
#define _SPEECH_H_
#include "globalincs/pstypes.h"
#if FS2_SPEECH
bool speech_init();
void speech_deinit();
bool speech_play(const SCP_string& text);
bool speech_pause();
bool speech_resume();
bool speech_stop();
bool speech_set_volume(unsigned short volume);
bool speech_set_voice(int voice);
bool speech_set_rate(float rate);
bool speech_is_speaking();
SCP_vector<std::pair<int, SCP_string>> speech_enumerate_voices();
#else
inline bool speech_init() { return false; }
inline void speech_deinit() {}
inline bool speech_play(const SCP_string& /*text*/) { return false; }
inline bool speech_pause() { return false; }
inline bool speech_resume() { return false; }
inline bool speech_stop() { return false; }
inline bool speech_set_volume(unsigned short /*volume*/) { return false; }
inline bool speech_set_voice(int /*voice*/) { return false; }
inline bool speech_set_rate(float /*rate*/) { return false; }
inline bool speech_is_speaking() { return false; }
inline SCP_vector<std::pair<int, SCP_string>> speech_enumerate_voices() {
return SCP_vector<std::pair<int, SCP_string>>();
}
#endif
#endif