Skip to content

Commit

Permalink
add debug to _initEssentia and ready functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarcosfer committed Mar 7, 2024
1 parent 32f4848 commit f8a4275
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 8 deletions.
17 changes: 16 additions & 1 deletion src/cpp/includes/essentiajs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@ std::vector<float> float32ArrayToVector(const val &arr) {
return vec;
}

void _initEssentia() {
void _initEssentia(bool debugger) {
if (debugger) {
// if true sets essentia debugger active
// EAll is a special value in essentia that contains all modules
setDebugLevel(EAll);
unsetDebugLevel(EMemory | EConnectors);
// activate warnings
essentia::warningLevelActive = true;
// activate info
essentia::infoLevelActive = true;
// activate error level
essentia::errorLevelActive = true;
} else {
essentia::infoLevelActive = false;
essentia::warningLevelActive = false;
}
essentia::init();
}

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/includes/essentiajs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace essentia;
using namespace essentia::standard;
using namespace emscripten;

void _initEssentia();
void _initEssentia(bool debugger=false);

// method for generating frames from a given audio signal
class FrameGenerator {
Expand Down
2 changes: 1 addition & 1 deletion src/python/header.cog
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace essentia;
using namespace essentia::standard;
using namespace emscripten;

void _initEssentia();
void _initEssentia(bool debugger=false);

// method for generating frames from a given audio signal
class FrameGenerator {
Expand Down
4 changes: 2 additions & 2 deletions src/python/js_wrapper.cog
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ let wasmBackend: any;
* @function
* @param {EssentiaEmscriptenModule} EssentiaWASM Essentia WebAssembly backend (emcripten global module object) which is loaded from 'essentia-wasm.*.js file'
*/
function ready(EssentiaWASM: EssentiaEmscriptenModule) {
function ready(EssentiaWASM: any, isDebug: boolean = false) {
wasmBackend = EssentiaWASM;
wasmBackend.init();
wasmBackend.init(isDebug);
}


Expand Down
17 changes: 16 additions & 1 deletion src/python/library.cog
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@ std::vector<float> float32ArrayToVector(const val &arr) {
return vec;
}

void _initEssentia() {
void _initEssentia(bool debugger) {
if (debugger) {
// if true sets essentia debugger active
// EAll is a special value in essentia that contains all modules
setDebugLevel(EAll);
unsetDebugLevel(EMemory | EConnectors);
// activate warnings
essentia::warningLevelActive = true;
// activate info
essentia::infoLevelActive = true;
// activate error level
essentia::errorLevelActive = true;
} else {
essentia::infoLevelActive = false;
essentia::warningLevelActive = false;
}
essentia::init();
}

Expand Down
4 changes: 2 additions & 2 deletions src/typescript/core_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ let wasmBackend: any;
* @function
* @param {EssentiaEmscriptenModule} EssentiaWASM Essentia WebAssembly backend (emcripten global module object) which is loaded from 'essentia-wasm.*.js file'
*/
function ready(EssentiaWASM: EssentiaEmscriptenModule) {
function ready(EssentiaWASM: any, isDebug: boolean = false) {
wasmBackend = EssentiaWASM;
wasmBackend.init();
wasmBackend.init(isDebug);
}


Expand Down

0 comments on commit f8a4275

Please sign in to comment.