Fix licence and restructure, prepare to add AudioWorklet
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
#include "spkModel.h"
|
||||
#include "model.h"
|
||||
#include "recognizer.h"
|
||||
#include <emscripten/bind.h>
|
||||
using namespace emscripten;
|
||||
void throwJS(const char* msg, bool err = false) {
|
||||
EM_ASM({
|
||||
if($1) {
|
||||
throw Error(UTF8ToString)
|
||||
return
|
||||
}
|
||||
throw UTF8ToString($0)
|
||||
},msg, err);
|
||||
}
|
||||
int main() {
|
||||
//vosk_set_log_level(-1);
|
||||
std::thread t{[](){
|
||||
@@ -12,13 +22,13 @@ int main() {
|
||||
EMSCRIPTEN_BINDINGS() {
|
||||
function("setLogLevel", &vosk_set_log_level, allow_raw_pointers());
|
||||
class_<model>("model")
|
||||
.constructor<std::string, std::string, std::string, int>(allow_raw_pointers());
|
||||
.constructor<std::string, std::string, std::string>(allow_raw_pointers());
|
||||
|
||||
class_<spkModel>("spkModel")
|
||||
.constructor<std::string, std::string, std::string, int>(allow_raw_pointers());
|
||||
.constructor<std::string, std::string, std::string>(allow_raw_pointers());
|
||||
|
||||
class_<recognizer>("recognizer")
|
||||
.constructor<model*, int, int>(allow_raw_pointers())
|
||||
.constructor<model*, float, int>(allow_raw_pointers())
|
||||
.function("setWords", &recognizer::setWords, allow_raw_pointers())
|
||||
.function("setPartialWords", &recognizer::setPartialWords, allow_raw_pointers())
|
||||
.function("setGrm", &recognizer::setGrm, allow_raw_pointers())
|
||||
|
||||
Reference in New Issue
Block a user