Skip to content

Commit 41b062b

Browse files
committed
URL Based Dictionary
1 parent 5c02ac6 commit 41b062b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/AudioDictionaryURL.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragma once
2+
3+
#include "SimpleTTSBase.h"
4+
5+
namespace simple_tts {
6+
7+
#include "en/all.h"
8+
9+
/**
10+
* @brief A dictionary which is based on audio files that can be accessed via
11+
* URLs
12+
* @author Phil Schatzmann
13+
* @copyright GPLv3
14+
*/
15+
class AudioDictionaryURL : public AudioDictionaryBase {
16+
public:
17+
AudioDictionaryURL(URLStream &urlStream, const char *url) {
18+
p_url = &urlStream;
19+
url_cstr = url;
20+
}
21+
22+
AudioStream *get(const char *word) {
23+
url_str = url_cstr;
24+
url_str.add("/");
25+
url_str.add(word);
26+
LOGI("Using url: %s", url_str.c_str());
27+
p_url->begin(url_str.c_str());
28+
return p_url;
29+
}
30+
31+
protected:
32+
const char *url_cstr;
33+
StrExt url_str;
34+
URLStream *p_url;
35+
};
36+
37+
} // namespace simple_tts

0 commit comments

Comments
 (0)