Commit 0b40a80a authored by Chris Kiefer's avatar Chris Kiefer
Browse files

ifft demo

parent 6c9542c6
This diff is collapsed.
......@@ -6,7 +6,6 @@
#include <emscripten.h>
#include <emscripten/bind.h>
//#include "libs/maxiFFT.h"
//extern "C" {
// // class arrayTest{
......@@ -36,7 +35,7 @@ public:
static void clearVectorFloat(vector<float>& vecIn) {
vecIn.clear();
}
// static void pr(){
// EM_ASM_({
// Module.print('I received: ' + $0);
......@@ -51,7 +50,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
register_vector<double>("VectorDouble");
register_vector<char>("VectorChar");
register_vector<float>("VectorFloat");
class_<vectorTools>("vectorTools")
.constructor<>()
.class_function("clearVectorDbl", &vectorTools::clearVectorDbl)
......@@ -59,7 +58,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
// .class_function("print", &vectorTools::pr)
;
// class_<testVectorHolder>("testVectorHolder")
// .constructor<>()
/*
......@@ -70,9 +69,9 @@ EMSCRIPTEN_BINDINGS(my_module) {
// .function("at", &testVectorHolder::at)
// .function("coswave", &maxiOsc::coswave)
// ;
// -----------------------------------------
// class_<maxiTest>("maxiTest")
// .constructor<>()
/*
......@@ -82,7 +81,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
// .smart_ptr_constructor("shared_ptr<maxiOsc>",&std::make_shared<maxiTest>)
// .function("sumArray", &maxiTest::sumArray, allow_raw_pointers())
// ;
// maxi stuff
class_<maxiSettings>("maxiSettings")
.constructor<>()
......@@ -91,8 +90,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.property("channels", &maxiSettings::getNumChannels, &maxiSettings::setNumChannels)
.property("bufferSize", &maxiSettings::getBufferSize, &maxiSettings::setBufferSize)
;
// MAXI OSC
class_<maxiOsc>("maxiOsc")
// .constructor<>()
......@@ -116,21 +114,21 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("rect", &maxiOsc::rect)
.function("phaseReset", &maxiOsc::phaseReset)
;
// MAXI ENVELOPE
class_<maxiEnvelope>("maxiEnvelope")
// .constructor<>()
.smart_ptr_constructor("shared_ptr<maxiEnvelope>",&std::make_shared<maxiEnvelope>)
.function("line", &maxiEnvelope::line)
// .function("line", &maxiEnvelope::line, allow_raw_pointers()) // if using array version
.function("trigger", &maxiEnvelope::trigger)
.property("amplitude", &maxiEnvelope::getAmplitude, &maxiEnvelope::setAmplitude)
.property("valindex", &maxiEnvelope::getValindex, &maxiEnvelope::setValindex)
;
// MAXI DELAYLINE
class_<maxiDelayline>("maxiDelayline")
// .constructor<>()
......@@ -138,8 +136,8 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("dl", select_overload<double(double, int, double)>(&maxiDelayline::dl))
.function("dl", select_overload<double(double, int, double, int)>(&maxiDelayline::dl))
;
// MAXI FILTER
class_<maxiFilter>("maxiFilter")
// .constructor<>()
......@@ -149,12 +147,12 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("bandpass", &maxiFilter::bandpass)
.function("lopass", &maxiFilter::lopass)
.function("hipass", &maxiFilter::hipass)
.property("cutoff", &maxiFilter::getCutoff, &maxiFilter::setCutoff)
.property("resonance", &maxiFilter::getResonance, &maxiFilter::setResonance)
;
// MAXI MIX
class_<maxiMix>("maxiMix")
// .constructor<>()
......@@ -163,27 +161,27 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("quad", &maxiMix::quad, allow_raw_pointers())
.function("ambisonic", &maxiMix::ambisonic, allow_raw_pointers())
;
// class_<TemplateClass<int>>("IntTemplateClass")
// .constructor<int, int, int>()
// .function("getMember", &TemplateClass<int>::getMember)
// ;
class_<maxiLagExp<double>>("maxiLagExp")
// .constructor<>()
// .constructor<double, double>()
.smart_ptr_constructor("shared_ptr<maxiLagExp<double>>",&std::make_shared<maxiLagExp<double>>, allow_raw_pointers()) // not sure how to override constructors with smart_ptr
// .smart_ptr_constructor("shared_ptr<maxiLagExp<double>>",&std::make_shared<maxiLagExp<double>>)
.function("init", &maxiLagExp<double>::init)
.function("addSample", &maxiLagExp<double>::addSample)
.function("value", &maxiLagExp<double>::value)
.property("alpha", &maxiLagExp<double>::getAlpha, &maxiLagExp<double>::setAlpha)
.property("alphaReciprocal", &maxiLagExp<double>::getAlphaReciprocal, &maxiLagExp<double>::setAlphaReciprocal)
.property("val", &maxiLagExp<double>::value, &maxiLagExp<double>::setVal)
;
// MAXI SAMPLE
class_<maxiSample>("maxiSample")
// .constructor<>()
......@@ -193,28 +191,28 @@ EMSCRIPTEN_BINDINGS(my_module) {
// .function("setSample", &maxiSample::setSample)
.function("setSample", select_overload<void(vector<double>&)>(&maxiSample::setSample))
.function("setSample", select_overload<void(vector<double>&, int)>(&maxiSample::setSample))
// .function("getSummary", &maxiSample::getSummary)
.function("isReady", &maxiSample::isReady)
.function("playOnce", select_overload<double()>(&maxiSample::playOnce))
.function("playOnce", select_overload<double(double)>(&maxiSample::playOnce))
.function("play", select_overload<double()>(&maxiSample::play))
.function("play", select_overload<double(double)>(&maxiSample::play))
.function("play", select_overload<double(double, double, double)>(&maxiSample::play))
.function("play4", &maxiSample::play4)
.function("trigger", &maxiSample::trigger)
.function("clear", &maxiSample::clear)
// .function("normalise", &maxiSample::normalise)
// .function("autoTrim", &maxiSample::autoTrim)
// .function("load", &maxiSample::load)
// .function("read", &maxiSample::read, allow_raw_pointers())
;
// MAXI MAP
class_<maxiMap>("maxiMap")
// .constructor<>()
......@@ -224,7 +222,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("explin", &maxiMap::explin)
.function("clamp", &maxiMap::clamp<double>)
;
// MAXI DYN
class_<maxiDyn>("maxiDyn")
// .constructor<>()
......@@ -237,7 +235,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setThreshold", &maxiDyn::setThreshold)
.function("setRatio", &maxiDyn::setRatio)
;
// MAXI ENV
class_<maxiEnv>("maxiEnv")
// .constructor<>()
......@@ -250,11 +248,11 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setRelease", &maxiEnv::setRelease)
.function("setDecay", &maxiEnv::setDecay)
.function("setSustain", &maxiEnv::setSustain)
.property("trigger", &maxiEnv::getTrigger, &maxiEnv::setTrigger)
;
// CONVERT
class_<convert>("convert")
// .constructor<>()
......@@ -262,8 +260,8 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("mtof", &convert::mtof)
// .class_function("mtof", &convert::mtof)
;
// MAXI DISTORTION
class_<maxiDistortion>("maxiDistortion")
// .constructor<>()
......@@ -272,21 +270,21 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("atanDist", &maxiDistortion::atanDist)
.function("fastAtanDist", &maxiDistortion::fastAtanDist)
;
// MAXI FLANGER
class_<maxiFlanger>("maxiFlanger")
// .constructor<>()
.smart_ptr_constructor("shared_ptr<maxiFlanger>",&std::make_shared<maxiFlanger>)
.function("flange", &maxiFlanger::flange)
;
// MAXI CHORUS
class_<maxiChorus>("maxiChorus")
// .constructor<>()
.smart_ptr_constructor("shared_ptr<maxiChorus>",&std::make_shared<maxiChorus>)
.function("chorus", &maxiChorus::chorus)
;
// MAXI ENVELOPE FOLLOWER
// class_<maxiEnvelopeFollowerType<double>>("maxiEnvelopeFollower")
// // .constructor<>()
......@@ -296,14 +294,14 @@ EMSCRIPTEN_BINDINGS(my_module) {
// .function("play", &maxiEnvelopeFollowerType<double>::play)
// .function("reset", &maxiEnvelopeFollowerType<double>::reset)
// ;
// MAXI DC BLOCKER
class_<maxiDCBlocker>("maxiDCBlocker")
// .constructor<>()
.smart_ptr_constructor("shared_ptr<maxiDCBlocker>",&std::make_shared<maxiDCBlocker>)
.function("play", &maxiDCBlocker::play)
;
// MAXI SVF
class_<maxiSVF>("maxiSVF")
// .constructor<>()
......@@ -312,7 +310,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setResonance", &maxiSVF::setResonance)
.function("play", &maxiSVF::play)
;
// MAXI KICK
class_<maxiKick>("maxiKick")
// .constructor<>()
......@@ -322,7 +320,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setRelease", &maxiKick::setRelease)
.function("trigger", &maxiKick::trigger)
;
// MAXI SNARE
class_<maxiSnare>("maxiSnare")
// .constructor<>()
......@@ -332,7 +330,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setRelease", &maxiSnare::setRelease)
.function("trigger", &maxiSnare::trigger)
;
// MAXI HATS
class_<maxiHats>("maxiHats")
// .constructor<>()
......@@ -342,7 +340,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setRelease", &maxiHats::setRelease)
.function("trigger", &maxiHats::trigger)
;
// MAXI MAXI CLOCK
class_<maxiClock>("maxiClock")
// .constructor<>()
......@@ -351,7 +349,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.function("setTempo", &maxiClock::setTempo)
.function("setTicksPerBeat", &maxiClock::setTicksPerBeat)
.function("isTick", &maxiClock::isTick)
.property("currentCount", &maxiClock::getCurrentCount, &maxiClock::setCurrentCount)
.property("currentCount", &maxiClock::getLastCount, &maxiClock::setLastCount)
.property("playHead", &maxiClock::getPlayHead, &maxiClock::setPlayHead)
......@@ -360,7 +358,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
.property("tick", &maxiClock::getTick, &maxiClock::setTick)
.property("ticks", &maxiClock::getTicks, &maxiClock::setTicks)
;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment