/
htts.cpp
47 lines (38 loc) · 1.3 KB
/
htts.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "htts.h"
#include <htts.hpp>
// TODO use booleans where booleans are needed
extern "C" {
void * HTTS_new( void ) {
HTTS *htts = new HTTS;
return static_cast<void*>( htts );
}
void HTTS_delete( void * v ) {
HTTS *htts = static_cast<HTTS*>(v);
delete htts;
}
int HTTS_set( void * v, const char* key, const char* val ) {
HTTS *htts = static_cast<HTTS*>(v);
return static_cast<int>(htts->set(key, val));
}
const char *HTTS_get( void *v, const char *key) {
HTTS *htts = static_cast<HTTS*>(v);
return htts->get(key);
}
int HTTS_create( void * v ) {
HTTS *htts = static_cast<HTTS*>(v);
return static_cast<int>(htts->create());
}
int HTTS_flush( void * v ) {
HTTS *htts = static_cast<HTTS*>(v);
return static_cast<int>(htts->flush());
}
int HTTS_input_multilingual( void * v, const char *text, const char *lang, const char *datapath ) {
HTTS *htts = static_cast<HTTS*>(v);
return htts->input_multilingual(text, lang, datapath, 0);
}
// This allocates `samples`
int HTTS_output_multilingual( void * v, const char *lang, short **samples) {
HTTS *htts = static_cast<HTTS*>(v);
return htts->output_multilingual(lang, samples);
}
}