Skip to content

Commit 221097a

Browse files
committed
Close decoder after each word to support slow URLStream
1 parent 6064300 commit 221097a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TextToSpeech.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ class TextToSpeech {
4848
LOGI("say: %s",word);
4949
AudioStream *mp3Stream = p_dictionary->get(word);
5050
if (mp3Stream != nullptr) {
51+
p_decoder->begin();
5152
mp3Stream->begin();
5253
copier.begin(*decodedStream, *mp3Stream);
5354
copier.copyAll();
5455
copier.end();
5556
mp3Stream->end();
57+
p_decoder->end();
5658
} else {
5759
LOGE("Word not available in dictionary: %s", word);
5860
}
5961
}
6062

6163
/// a simple API to say multiple of the supported words
6264
void say(audio_tools::Vector<const char *> words) {
63-
p_decoder->begin();
6465
for (auto word : words) {
6566
say(word);
6667
}
67-
p_decoder->end();
6868
}
6969

7070
protected:

0 commit comments

Comments
 (0)