Mercurial > hg > piper-cpp
changeset 105:491a4bc10a01
Merge
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 17 Oct 2016 16:41:00 +0100 |
parents | cd438188e3f9 (current diff) 387d38c96c16 (diff) |
children | a0edd7c97d2d |
files | vamp-json/VampJson.h vamp-server/server.cpp |
diffstat | 3 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Oct 17 16:39:36 2016 +0100 +++ b/Makefile Mon Oct 17 16:41:00 2016 +0100 @@ -2,7 +2,7 @@ VAMPSDK_DIR := ../vamp-plugin-sdk PIPER_DIR := ../piper -CXXFLAGS := -Wall -Werror -g3 -std=c++11 +CXXFLAGS := -Wall -Wextra -Werror -g3 -std=c++11 INCFLAGS := -I$(VAMPSDK_DIR) -I. -I/usr/local/include LDFLAGS := $(VAMPSDK_DIR)/libvamp-hostsdk.a -L/usr/local/lib -lcapnp -lkj -ldl
--- a/vamp-json/VampJson.h Mon Oct 17 16:39:36 2016 +0100 +++ b/vamp-json/VampJson.h Mon Oct 17 16:41:00 2016 +0100 @@ -548,8 +548,8 @@ for (const std::string &c: d.category) cat.push_back(c); jo["category"] = cat; - jo["minChannelCount"] = d.minChannelCount; - jo["maxChannelCount"] = d.maxChannelCount; + jo["minChannelCount"] = int(d.minChannelCount); + jo["maxChannelCount"] = int(d.maxChannelCount); json11::Json::array params; Vamp::PluginBase::ParameterList vparams = d.parameters;
--- a/vamp-server/server.cpp Mon Oct 17 16:39:36 2016 +0100 +++ b/vamp-server/server.cpp Mon Oct 17 16:41:00 2016 +0100 @@ -13,6 +13,8 @@ #include <map> #include <set> +#include <unistd.h> // getpid for logging + using namespace std; using namespace piper_vamp; using namespace Vamp; @@ -22,6 +24,8 @@ // - Use Vamp C API (vamp.h) directly rather than converting to C++ //!!! Doing the above for process() and finish() alone would be a good start +static int pid = getpid(); + void usage() { string myname = "piper-vamp-server"; @@ -180,7 +184,7 @@ response.loadResponse = LoaderRequests().loadPlugin(request.loadRequest); if (response.loadResponse.plugin != nullptr) { mapper.addPlugin(response.loadResponse.plugin); - cerr << "loaded plugin, handle = " << mapper.pluginToHandle(response.loadResponse.plugin) << endl; + cerr << "piper-vamp-server " << pid << ": loaded plugin, handle = " << mapper.pluginToHandle(response.loadResponse.plugin) << endl; response.success = true; } break; @@ -262,7 +266,7 @@ return response; } -int main(int argc, char **argv) +int main(int argc, char **) { if (argc != 1) { usage(); @@ -276,36 +280,36 @@ request = readRequestCapnp(); - cerr << "piper-vamp-server: request received, of type " + cerr << "piper-vamp-server " << pid << ": request received, of type " << int(request.type) << endl; // NotValid without an exception indicates EOF: if (request.type == RRType::NotValid) { - cerr << "piper-vamp-server: eof reached, exiting" << endl; + cerr << "piper-vamp-server " << pid << ": eof reached, exiting" << endl; break; } RequestOrResponse response = handleRequest(request); response.id = request.id; - cerr << "piper-vamp-server: request handled, writing response" + cerr << "piper-vamp-server " << pid << ": request handled, writing response" << endl; writeResponseCapnp(response); - cerr << "piper-vamp-server: response written" << endl; + cerr << "piper-vamp-server " << pid << ": response written" << endl; if (request.type == RRType::Finish) { auto h = mapper.pluginToHandle(request.finishRequest.plugin); - cerr << "deleting the plugin with handle " << h << endl; + cerr << "piper-vamp-server " << pid << ": deleting the plugin with handle " << h << endl; mapper.removePlugin(h); delete request.finishRequest.plugin; } } catch (std::exception &e) { - cerr << "piper-vamp-server: error: " << e.what() << endl; + cerr << "piper-vamp-server " << pid << ": error: " << e.what() << endl; writeExceptionCapnp(e, request.type);