arduino-simple-tts

Loading...
Searching...
No Matches
AudioDictionaryURL.h
1#pragma once
2
3#include "AudioHttp/URLStream.h"
4#include "SimpleTTSBase.h"
5
6namespace simple_tts {
7
14 class AudioDictionaryURL : public AudioDictionaryBase {
15public:
16 AudioDictionaryURL(URLStream &urlStream, const char *url, const char *ext) {
17 p_url = &urlStream;
18 url_cstr = url;
19 ext_cstr = ext;
20 }
21
22 AudioStream *get(const char *word) {
23 url_str = url_cstr;
24 if (!url_str.endsWith("/")){
25 url_str.add("/");
26 }
27 url_str.add(word);
28 url_str.add(".");
29 url_str.add(ext_cstr);
30 url_str.toLowerCase();
31 LOGI("Using url: %s", url_str.c_str());
32 p_url->begin(url_str.c_str());
33 return p_url;
34 }
35
36protected:
37 const char *url_cstr;
38 const char *ext_cstr;
39 StrExt url_str;
40 URLStream *p_url;
41};
42
43} // namespace simple_tts
simple_tts::AudioDictionaryBase
Dictionary which provides a Stream of Audio for the indicated word.
Definition: SimpleTTSBase.h:49
simple_tts::AudioDictionaryURL
A dictionary which is based on audio files that can be accessed via URLs.
Definition: AudioDictionaryURL.h:14