Mercurial > hg > piper-vamp-js
comparison quick-test.cpp @ 76:56709f8355cb
Use power spectrum rather than zero crossings, to exercise the input domain adapter, and make a process request in quick-test.cpp
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Tue, 06 Sep 2016 16:08:38 +0100 |
parents | 8db927152497 |
children | 8fdafb8f1c45 |
comparison
equal
deleted
inserted
replaced
75:4c799e23eaef | 76:56709f8355cb |
---|---|
2 #include <iostream> | 2 #include <iostream> |
3 #include <dlfcn.h> | 3 #include <dlfcn.h> |
4 | 4 |
5 using namespace std; | 5 using namespace std; |
6 | 6 |
7 int main(int argc, char **argv) | 7 int main(int, char **) |
8 { | 8 { |
9 string example = "./example.so"; | 9 string example = "./example.so"; |
10 | 10 |
11 void *lib = dlopen(example.c_str(), RTLD_LAZY | RTLD_LOCAL); | 11 void *lib = dlopen(example.c_str(), RTLD_LAZY | RTLD_LOCAL); |
12 if (!lib) { | 12 if (!lib) { |
33 string listRequest = "{\"type\": \"list\"}"; | 33 string listRequest = "{\"type\": \"list\"}"; |
34 const char *listResponse = reqFn(listRequest.c_str()); | 34 const char *listResponse = reqFn(listRequest.c_str()); |
35 cout << listResponse << endl; | 35 cout << listResponse << endl; |
36 freeFn(listResponse); | 36 freeFn(listResponse); |
37 | 37 |
38 string loadRequest = "{\"type\":\"load\",\"content\": {\"pluginKey\":\"vamp-example-plugins:zerocrossing\",\"inputSampleRate\":44100,\"adapterFlags\":[\"AdaptAllSafe\"]}}"; | 38 string loadRequest = "{\"type\":\"load\",\"content\": {\"pluginKey\":\"vamp-example-plugins:powerspectrum\",\"inputSampleRate\":44100,\"adapterFlags\":[\"AdaptAllSafe\"]}}"; |
39 const char *loadResponse = reqFn(loadRequest.c_str()); | 39 const char *loadResponse = reqFn(loadRequest.c_str()); |
40 cout << loadResponse << endl; | 40 cout << loadResponse << endl; |
41 freeFn(loadResponse); | 41 freeFn(loadResponse); |
42 | |
43 string configRequest = "{\"type\":\"configure\",\"content\":{\"pluginHandle\":1,\"configuration\":{\"blockSize\":8,\"channelCount\":1,\"stepSize\":8}}}"; | |
44 const char *configResponse = reqFn(configRequest.c_str()); | |
45 cout << configResponse << endl; | |
46 freeFn(configResponse); | |
47 | |
48 string processRequest = "{\"type\":\"process\",\"content\":{\"pluginHandle\":1,\"processInput\":{\"timestamp\":{\"s\":0,\"n\":0},\"inputBuffers\":[{\"values\":[0,1,0,-1,0,1,0,-1]}]}}}"; | |
49 const char *processResponse = reqFn(processRequest.c_str()); | |
50 cout << processResponse << endl; | |
51 freeFn(processResponse); | |
52 | |
53 string finishRequest = "{\"type\":\"finish\",\"content\":{\"pluginHandle\":1}}"; | |
54 const char *finishResponse = reqFn(finishRequest.c_str()); | |
55 cout << finishResponse << endl; | |
56 freeFn(finishResponse); | |
57 | |
42 } | 58 } |
43 | 59 |