Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOP implementation #138

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
25489e3
add class-based essentia algo header template
jmarcosfer Feb 12, 2024
03c2713
add class-based essentia algo definition template (.cpp)
jmarcosfer Feb 12, 2024
5066710
add class-based essentia algo bindings template and code_generator code
jmarcosfer Feb 13, 2024
8a66bf6
fix cog files, successful compilation
jmarcosfer Feb 15, 2024
31bf822
use py3 f-strings on parse_to_typescript
jmarcosfer Feb 19, 2024
3b08453
class-based TS api build successful
jmarcosfer Feb 26, 2024
888d647
replace all string formatting in code_generator with f-strings
jmarcosfer Feb 27, 2024
82eed9c
check algorithms affected by wrong VectorFloat param conversion and a…
jmarcosfer Feb 28, 2024
00114f9
add first manual unit-test for FrequencyBands
jmarcosfer Mar 4, 2024
ab100f4
add semi-fix for vectorfloat params conversion, add delete method to …
jmarcosfer Mar 6, 2024
b38d9a2
remove return from delete method, add delete to FrameGenerator
jmarcosfer Mar 6, 2024
89b1326
update jsdocs for class-based algos
jmarcosfer Mar 6, 2024
c64d9cf
add OOP MonoMixer and LoudnessEBUR128, jsdocs for new ready function
jmarcosfer Mar 6, 2024
faebf6d
fix type check on compute test and remove unnecessary logs
jmarcosfer Mar 7, 2024
f336b92
add default FrameGenerator param values
jmarcosfer Mar 7, 2024
32f4848
move algo create from configure to constructor, create from Algorithm…
jmarcosfer Mar 7, 2024
f8a4275
add debug to _initEssentia and ready functions
jmarcosfer Mar 7, 2024
a65c8c5
add OOP LoudnessEBUR128
jmarcosfer Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"scripts": {
"gen-code": "make -f Makefile codegen",
"build-wasm": "make -f Makefile build",
"build-js-api": "rollup --config",
"build-js-api": "ESSENTIAJS_ADDON=0 rollup --config",
"build-api-docs": "./build-docs.sh",
"test": "mocha"
"test": "mocha test/test_oop.js"
},
"directories": {
"doc": "docs",
Expand Down
1,633 changes: 1,423 additions & 210 deletions src/cpp/bindings_essentiajs.cpp

Large diffs are not rendered by default.

8,619 changes: 5,438 additions & 3,181 deletions src/cpp/includes/essentiajs.cpp

Large diffs are not rendered by default.

2,462 changes: 2,246 additions & 216 deletions src/cpp/includes/essentiajs.h

Large diffs are not rendered by default.

46 changes: 25 additions & 21 deletions src/python/bindings.cog
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,35 @@
*/

// NOTE: This source code is auto-generated.

#include <emscripten/bind.h>
#include "./includes/essentiajs.h"

// expose essentiajs class to js using embind wrappers
EMSCRIPTEN_BINDINGS(CLASS_EssentiaJS) {
EMSCRIPTEN_BINDINGS(CLASS_EssentiaJS) {
function("init", &_initEssentia);
constant("algorithmNames", ALGORITHM_NAMES);
class_<FrameGenerator>("FrameGenerator")
.constructor<int, int>()
.function("configure", &FrameGenerator::configure)
.function("compute", &FrameGenerator::compute)
.function("reset", &FrameGenerator::reset)
;
class_<LoudnessEBUR128>("LoudnessEBUR128")
.constructor<float, float, bool>()
.function("configure", &LoudnessEBUR128::configure)
.function("compute", &LoudnessEBUR128::compute)
.function("reset", &LoudnessEBUR128::reset)
;
// NOTE: The following code snippets are machine generated. Do not edit.
class_<EssentiaJS>("EssentiaJS")
.constructor<bool>()
.property("version", &EssentiaJS::essentiaVersion)
.property("algorithmNames", &EssentiaJS::algorithmNames)
.function("shutdown", &EssentiaJS::shutdown)
.function("FrameGenerator", &EssentiaJS::FrameGenerator)
.function("MonoMixer", &EssentiaJS::MonoMixer)
.function("LoudnessEBUR128", &EssentiaJS::LoudnessEBUR128)
/*[[[cog
import logging
import cog
from code_generator import TO_INCLUDE_ALGOS
logging.basicConfig(level='INFO')
logging.info("Generating emscripten bindings for the essentia...")
for algo_name in TO_INCLUDE_ALGOS:
cog.outl('.function("%s", &EssentiaJS::%s)' % (algo_name, algo_name))
cog.out(";")
]]]*/
//[[[end]]]
/*[[[cog
import cog
from code_generator import generate_bindings

bindings = generate_bindings()
for ln in bindings:
cog.outl(ln)
]]]*/
//[[[end]]]
// utility function to convert a Float32 JS typed array into std::vector<float>
function("arrayToVector", &float32ArrayToVector);
// expose stl datatypes to js
Expand Down
Loading