Skip to content

Commit d23b45d

Browse files
committed
TextToSpeech wo SimpleTTSBase
1 parent 0d30d0d commit d23b45d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ TimeToText ttt; // Text source
9191
I2SStream i2s; // audio output via I2S
9292
MP3DecoderHelix mp3; // mp3 decoder
9393
AudioDictionary dictionary(ExampleAudioDictionaryValues);
94-
TextToSpeech tts(tts, i2s, mp3, dictionary);
94+
TextToSpeech tts(i2s, mp3, dictionary);
9595
9696
void setup(){
9797
Serial.begin(115200);

src/TextToSpeech.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class TextToSpeech;
2222
*/
2323
class TextToSpeech {
2424
public:
25+
/// TextToSpeech which support a SimpleTTSBase
2526
TextToSpeech(SimpleTTSBase &tts, AudioStream &sink, AudioDecoder &decoder,
2627
AudioDictionaryBase &dict) {
2728
tts.registerCallback(callback, this);
@@ -31,6 +32,15 @@ class TextToSpeech {
3132
decodedStream = new audio_tools::EncodedAudioStream(&sink, &decoder);
3233
}
3334

35+
/// Default Constructor
36+
TextToSpeech(AudioStream &sink, AudioDecoder &decoder,
37+
AudioDictionaryBase &dict) {
38+
p_dictionary = &dict;
39+
p_decoder = &decoder;
40+
decodedStream = new audio_tools::EncodedAudioStream(&sink, &decoder);
41+
}
42+
43+
3444
~TextToSpeech() { delete decodedStream; }
3545

3646
/// a simple API to say one of the supported words

0 commit comments

Comments
 (0)