# HG changeset patch # User Chris Cannam # Date 1473185776 -3600 # Node ID 7e8a88af255b2b4cdf77f65307c80f49b37cd968 # Parent a57fa6df8e73d31d0eee171931001032ae9dd491# Parent 820704540560bf0cf8cde9b4536dc48c3877d210 Merge diff -r 820704540560 -r 7e8a88af255b Makefile.example.emscripten --- a/Makefile.example.emscripten Tue Sep 06 14:30:40 2016 +0100 +++ b/Makefile.example.emscripten Tue Sep 06 19:16:16 2016 +0100 @@ -47,9 +47,13 @@ EXAMPLE_LDFLAGS := $(EMFLAGS) CXX := em++ + #OPTFLAGS := -g3 OPTFLAGS := -O3 + CXXFLAGS := -std=c++11 -fPIC -Wall -Wextra $(OPTFLAGS) +#CXXFLAGS := -std=c++11 -fPIC -Wall -Wextra -DSINGLE_PRECISION_FFT $(OPTFLAGS) + INCPATH := -I$(SDK_DIR) -I.. -I../json all: $(EXAMPLE) diff -r 820704540560 -r 7e8a88af255b quick-test.cpp --- a/quick-test.cpp Tue Sep 06 14:30:40 2016 +0100 +++ b/quick-test.cpp Tue Sep 06 19:16:16 2016 +0100 @@ -4,7 +4,7 @@ using namespace std; -int main(int argc, char **argv) +int main(int, char **) { string example = "./example.so"; @@ -35,9 +35,25 @@ cout << listResponse << endl; freeFn(listResponse); - string loadRequest = "{\"type\":\"load\",\"content\": {\"pluginKey\":\"vamp-example-plugins:zerocrossing\",\"inputSampleRate\":44100,\"adapterFlags\":[\"AdaptAllSafe\"]}}"; + string loadRequest = "{\"type\":\"load\",\"content\": {\"pluginKey\":\"vamp-example-plugins:powerspectrum\",\"inputSampleRate\":44100,\"adapterFlags\":[\"AdaptAllSafe\"]}}"; const char *loadResponse = reqFn(loadRequest.c_str()); cout << loadResponse << endl; freeFn(loadResponse); + + string configRequest = "{\"type\":\"configure\",\"content\":{\"pluginHandle\":1,\"configuration\":{\"blockSize\":8,\"channelCount\":1,\"stepSize\":8}}}"; + const char *configResponse = reqFn(configRequest.c_str()); + cout << configResponse << endl; + freeFn(configResponse); + + string processRequest = "{\"type\":\"process\",\"content\":{\"pluginHandle\":1,\"processInput\":{\"timestamp\":{\"s\":0,\"n\":0},\"inputBuffers\":[{\"values\":[0,1,0,-1,0,1,0,-1]}]}}}"; + const char *processResponse = reqFn(processRequest.c_str()); + cout << processResponse << endl; + freeFn(processResponse); + + string finishRequest = "{\"type\":\"finish\",\"content\":{\"pluginHandle\":1}}"; + const char *finishResponse = reqFn(finishRequest.c_str()); + cout << finishResponse << endl; + freeFn(finishResponse); + } diff -r 820704540560 -r 7e8a88af255b quick-test.js --- a/quick-test.js Tue Sep 06 14:30:40 2016 +0100 +++ b/quick-test.js Tue Sep 06 19:16:16 2016 +0100 @@ -52,7 +52,7 @@ var result = request('{"type": "list"}'); comment("Loading zero crossings plugin..."); - result = request('{"type":"load","content": {"pluginKey":"vamp-example-plugins:zerocrossing","inputSampleRate":16,"adapterFlags":["AdaptAllSafe"]}}'); + result = request('{"type":"load","content": {"pluginKey":"vamp-example-plugins:powerspectrum","inputSampleRate":16,"adapterFlags":["AdaptAllSafe"]}}'); comment("I'm now assuming that the load succeeded and the returned pluginHandle was 1. I haven't bothered to parse the JSON. If those assumptions are wrong, this obviously isn't going to work. Configuring the plugin..."); result = request('{"type":"configure","content":{"pluginHandle":1,"configuration":{"blockSize": 8, "channelCount": 1, "stepSize": 8}}}');