#pragma once #include #include #include #include #include "emscripten/atomic.h" #include "emscripten/console.h" namespace fs = std::filesystem; enum Event { // Shared status, // Recognizer partialResult, result, }; enum UntarStatus { Successful, IncorrectFormat, IncorrectFiletype, FailedOpen, FailedWrite, FailedClose }; struct AudioData { float* data; int len; AudioData(int start, int len) : data{reinterpret_cast(start)}, len{len} {} }; #ifndef MAX_WORKERS #define MAX_WORKERS 1 #endif struct WorkerPool { bool qLock{true}; // True is locked, false is unlocked bool done{}; std::queue> taskQ; WorkerPool(); ~WorkerPool(); void exec(std::function fn); }; extern "C" void fireEv(int idx, int typeIdx, const char* content = nullptr); int untar(unsigned char* tar, int tarSize, const char* storepath); extern WorkerPool globalPool;