GLK: Add method that takes c-string text in Speech class

This commit is contained in:
Thierry Crozat 2020-06-29 01:59:06 +01:00
parent cbf6b6b6e6
commit 01f3ce620a
2 changed files with 19 additions and 1 deletions

View File

@ -169,7 +169,7 @@ void Speech::gli_tts_purge(void) {
} }
void Speech::gli_tts_speak(const uint32 *buf, size_t len) { void Speech::gli_tts_speak(const uint32 *buf, size_t len) {
debugC(1, kDebugSpeech, "gli_tts_speak"); debugC(1, kDebugSpeech, "gli_tts_speak(const uint32 *, size_t)");
if (_speechManager) { if (_speechManager) {
for (int i = 0 ; i < len ; ++i, ++buf) { for (int i = 0 ; i < len ; ++i, ++buf) {
// Should we automatically flush on new lines without waiting for the call to gli_tts_flush? // Should we automatically flush on new lines without waiting for the call to gli_tts_flush?
@ -185,6 +185,23 @@ void Speech::gli_tts_speak(const uint32 *buf, size_t len) {
} }
} }
void Speech::gli_tts_speak(const char *buf, size_t len) {
debugC(1, kDebugSpeech, "gli_tts_speak(const char *, size_t)");
if (_speechManager) {
for (int i = 0 ; i < len ; ++i, ++buf) {
// Should we automatically flush on new lines without waiting for the call to gli_tts_flush?
// Should we also flush on '.', '?', and '!'?
//if (*buf == '\n') {
// debugC(1, kDebugSpeech, "Flushing SpeechManager buffer on new line");
// gli_tts_flush();
//} else {
_speechBuffer += (uint32)*buf;
//}
}
//debugC(1, kDebugSpeech, "SpeechManager buffer: %s", _speechBuffer.encode().c_str());
}
}
void Speech::gli_free_tts(void) { void Speech::gli_free_tts(void) {
debugC(kDebugSpeech, "gli_free_tts"); debugC(kDebugSpeech, "gli_free_tts");
if (_speechManager) { if (_speechManager) {

View File

@ -75,6 +75,7 @@ protected:
void gli_tts_purge(void); void gli_tts_purge(void);
void gli_tts_speak(const uint32 *buf, size_t len); void gli_tts_speak(const uint32 *buf, size_t len);
void gli_tts_speak(const char *buf, size_t len);
void gli_free_tts(void); void gli_free_tts(void);
}; };