Mercurial > hg > piper-cpp
changeset 118:ff3fd8d1b2dc
Boilerplate comments
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 27 Oct 2016 12:01:37 +0100 |
parents | 5dffc5147176 |
children | 5876f3e9c677 |
files | Makefile vamp-client/AutoPlugin.h vamp-client/CapnpRRClient.h vamp-client/Loader.h vamp-client/PluginClient.h vamp-client/PluginStub.h vamp-client/ProcessQtTransport.h vamp-client/SynchronousTransport.h vamp-client/client.cpp vamp-server/convert.cpp vamp-server/server.cpp |
diffstat | 11 files changed, 426 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Thu Oct 27 11:40:57 2016 +0100 +++ b/Makefile Thu Oct 27 12:01:37 2016 +0100 @@ -5,7 +5,8 @@ CXXFLAGS := -Wall -Wextra -Werror -g3 -std=c++11 INCFLAGS := -I$(VAMPSDK_DIR) -I. -I/usr/local/include -LDFLAGS := -L$(VAMPSDK_DIR) -L/usr/local/lib -lvamp-hostsdk -lcapnp -lkj +#LDFLAGS := -L$(VAMPSDK_DIR) -L/usr/local/lib -lvamp-hostsdk -lcapnp -lkj +LDFLAGS := $(VAMPSDK_DIR)/libvamp-hostsdk.a -lcapnp -lkj LDFLAGS += -ldl @@ -42,7 +43,7 @@ test/test-server.sh clean: - rm -f */*.o vamp-capnp/piper.capnp.h vamp-capnp/piper.capnp.c++ + rm -f */*.o distclean: clean rm -f bin/*
--- a/vamp-client/AutoPlugin.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/AutoPlugin.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,4 +1,37 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_AUTO_PLUGIN_H #define PIPER_AUTO_PLUGIN_H @@ -15,47 +48,47 @@ { public: AutoPlugin(std::string serverName, - std::string pluginKey, - float inputSampleRate, - int adapterFlags) : - Vamp::Plugin(inputSampleRate), - m_transport(serverName), - m_client(&m_transport) + std::string pluginKey, + float inputSampleRate, + int adapterFlags) : + Vamp::Plugin(inputSampleRate), + m_transport(serverName), + m_client(&m_transport) { - LoadRequest req; - req.pluginKey = pluginKey; - req.inputSampleRate = inputSampleRate; - req.adapterFlags = adapterFlags; - LoadResponse resp = m_client.loadPlugin(req); - m_plugin = resp.plugin; + LoadRequest req; + req.pluginKey = pluginKey; + req.inputSampleRate = inputSampleRate; + req.adapterFlags = adapterFlags; + LoadResponse resp = m_client.loadPlugin(req); + m_plugin = resp.plugin; } virtual ~AutoPlugin() { - delete m_plugin; + delete m_plugin; } bool isOK() const { - return (m_plugin != nullptr); + return (m_plugin != nullptr); } virtual std::string getIdentifier() const { - return getPlugin()->getIdentifier(); + return getPlugin()->getIdentifier(); } virtual std::string getName() const { - return getPlugin()->getName(); + return getPlugin()->getName(); } virtual std::string getDescription() const { - return getPlugin()->getDescription(); + return getPlugin()->getDescription(); } virtual std::string getMaker() const { - return getPlugin()->getMaker(); + return getPlugin()->getMaker(); } virtual std::string getCopyright() const { - return getPlugin()->getCopyright(); + return getPlugin()->getCopyright(); } virtual int getPluginVersion() const { @@ -63,15 +96,15 @@ } virtual ParameterList getParameterDescriptors() const { - return getPlugin()->getParameterDescriptors(); + return getPlugin()->getParameterDescriptors(); } virtual float getParameter(std::string name) const { - return getPlugin()->getParameter(name); + return getPlugin()->getParameter(name); } virtual void setParameter(std::string name, float value) { - getPlugin()->setParameter(name, value); + getPlugin()->setParameter(name, value); } virtual ProgramList getPrograms() const { @@ -83,50 +116,50 @@ } virtual void selectProgram(std::string program) { - getPlugin()->selectProgram(program); + getPlugin()->selectProgram(program); } virtual bool initialise(size_t inputChannels, size_t stepSize, size_t blockSize) { - return getPlugin()->initialise(inputChannels, stepSize, blockSize); + return getPlugin()->initialise(inputChannels, stepSize, blockSize); } virtual void reset() { - getPlugin()->reset(); + getPlugin()->reset(); } virtual InputDomain getInputDomain() const { - return getPlugin()->getInputDomain(); + return getPlugin()->getInputDomain(); } virtual size_t getPreferredBlockSize() const { - return getPlugin()->getPreferredBlockSize(); + return getPlugin()->getPreferredBlockSize(); } virtual size_t getPreferredStepSize() const { - return getPlugin()->getPreferredStepSize(); + return getPlugin()->getPreferredStepSize(); } virtual size_t getMinChannelCount() const { - return getPlugin()->getMinChannelCount(); + return getPlugin()->getMinChannelCount(); } virtual size_t getMaxChannelCount() const { - return getPlugin()->getMaxChannelCount(); + return getPlugin()->getMaxChannelCount(); } virtual OutputList getOutputDescriptors() const { - return getPlugin()->getOutputDescriptors(); + return getPlugin()->getOutputDescriptors(); } virtual FeatureSet process(const float *const *inputBuffers, - Vamp::RealTime timestamp) { - return getPlugin()->process(inputBuffers, timestamp); + Vamp::RealTime timestamp) { + return getPlugin()->process(inputBuffers, timestamp); } virtual FeatureSet getRemainingFeatures() { - return getPlugin()->getRemainingFeatures(); + return getPlugin()->getRemainingFeatures(); } private: @@ -134,11 +167,11 @@ CapnpRRClient m_client; Vamp::Plugin *m_plugin; Vamp::Plugin *getPlugin() const { - if (!m_plugin) { - throw std::logic_error - ("Plugin load failed (should have called AutoPlugin::isOK)"); - } - return m_plugin; + if (!m_plugin) { + throw std::logic_error + ("Plugin load failed (should have called AutoPlugin::isOK)"); + } + return m_plugin; } };
--- a/vamp-client/CapnpRRClient.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/CapnpRRClient.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,4 +1,37 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_CAPNP_CLIENT_H #define PIPER_CAPNP_CLIENT_H @@ -25,7 +58,7 @@ * constructed with a thread-safe SynchronousTransport implementation. */ class CapnpRRClient : public PluginClient, - public Loader + public Loader { // unsigned to avoid undefined behaviour on possible wrap typedef uint32_t ReqId; @@ -73,12 +106,12 @@ } capnp::MallocMessageBuilder message; - piper::RpcRequest::Builder builder = message.initRoot<piper::RpcRequest>(); + piper::RpcRequest::Builder builder = message.initRoot<piper::RpcRequest>(); VampnProto::buildRpcRequest_List(builder); ReqId id = getId(); builder.getId().setNumber(id); - auto karr = call(message); + auto karr = call(message); capnp::FlatArrayMessageReader responseMessage(karr); piper::RpcResponse::Reader reader = responseMessage.getRoot<piper::RpcResponse>(); @@ -139,7 +172,7 @@ ReqId id = getId(); builder.getId().setNumber(id); - auto karr = call(message); + auto karr = call(message); capnp::FlatArrayMessageReader responseMessage(karr); piper::RpcResponse::Reader reader = responseMessage.getRoot<piper::RpcResponse>(); @@ -174,10 +207,10 @@ capnp::MallocMessageBuilder message; piper::RpcRequest::Builder builder = message.initRoot<piper::RpcRequest>(); VampnProto::buildRpcRequest_Process(builder, request, m_mapper); - ReqId id = getId(); + ReqId id = getId(); builder.getId().setNumber(id); - auto karr = call(message); + auto karr = call(message); capnp::FlatArrayMessageReader responseMessage(karr); piper::RpcResponse::Reader reader = responseMessage.getRoot<piper::RpcResponse>(); @@ -211,7 +244,7 @@ ReqId id = getId(); builder.getId().setNumber(id); - auto karr = call(message); + auto karr = call(message); capnp::FlatArrayMessageReader responseMessage(karr); piper::RpcResponse::Reader reader = responseMessage.getRoot<piper::RpcResponse>(); @@ -227,8 +260,8 @@ m_mapper.removePlugin(m_mapper.pluginToHandle(plugin)); - // Don't delete the plugin. It's the plugin that is supposed - // to be calling us here + // Don't delete the plugin. It's the plugin that is supposed + // to be calling us here return pr.features; } @@ -271,13 +304,13 @@ static kj::Array<capnp::word> toKJArray(const std::vector<char> &buffer) { - // We could do this whole thing with fewer copies, but let's - // see whether it matters first + // We could do this whole thing with fewer copies, but let's + // see whether it matters first size_t wordSize = sizeof(capnp::word); - size_t words = buffer.size() / wordSize; - kj::Array<capnp::word> karr(kj::heapArray<capnp::word>(words)); - memcpy(karr.begin(), buffer.data(), words * wordSize); - return karr; + size_t words = buffer.size() / wordSize; + kj::Array<capnp::word> karr(kj::heapArray<capnp::word>(words)); + memcpy(karr.begin(), buffer.data(), words * wordSize); + return karr; } void @@ -286,16 +319,16 @@ ReqId id) { if (r.getResponse().which() != type) { - std::cerr << "checkResponseType: wrong response type (received " - << int(r.getResponse().which()) << ", expected " - << int(type) << ")" - << std::endl; + std::cerr << "checkResponseType: wrong response type (received " + << int(r.getResponse().which()) << ", expected " + << int(type) << ")" + << std::endl; throw std::runtime_error("Wrong response type"); } if (ReqId(r.getId().getNumber()) != id) { - std::cerr << "checkResponseType: wrong response id (received " - << r.getId().getNumber() << ", expected " << id << ")" - << std::endl; + std::cerr << "checkResponseType: wrong response id (received " + << r.getId().getNumber() << ", expected " << id << ")" + << std::endl; throw std::runtime_error("Wrong response id"); } } @@ -305,7 +338,7 @@ auto arr = capnp::messageToFlatArray(message); auto responseBuffer = m_transport->call(arr.asChars().begin(), arr.asChars().size()); - return toKJArray(responseBuffer); + return toKJArray(responseBuffer); } PluginHandleMapper::Handle @@ -325,7 +358,7 @@ ReqId id = getId(); builder.getId().setNumber(id); - auto karr = call(message); + auto karr = call(message); //!!! ... --> will also need some way to kill this process //!!! (from another thread)
--- a/vamp-client/Loader.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/Loader.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,3 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_LOADER_H #define PIPER_LOADER_H
--- a/vamp-client/PluginClient.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/PluginClient.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,3 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_PLUGIN_CLIENT_H #define PIPER_PLUGIN_CLIENT_H
--- a/vamp-client/PluginStub.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/PluginStub.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,3 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_PLUGIN_STUB_H #define PIPER_PLUGIN_STUB_H @@ -40,7 +74,7 @@ virtual ~PluginStub() { if (m_state != Finished) { - (void)m_client->finish(this); + (void)m_client->finish(this); } } @@ -178,7 +212,7 @@ } virtual FeatureSet process(const float *const *inputBuffers, - Vamp::RealTime timestamp) { + Vamp::RealTime timestamp) { if (m_state == Loaded) { throw std::logic_error("Plugin has not been initialised");
--- a/vamp-client/ProcessQtTransport.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/ProcessQtTransport.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,4 +1,37 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_PROCESS_QT_TRANSPORT_H #define PIPER_PROCESS_QT_TRANSPORT_H @@ -64,7 +97,7 @@ ~ProcessQtTransport() { if (m_process) { if (m_process->state() != QProcess::NotRunning) { - m_process->closeWriteChannel(); + m_process->closeWriteChannel(); m_process->waitForFinished(200); m_process->close(); m_process->waitForFinished(); @@ -88,8 +121,8 @@ std::vector<char> call(const char *ptr, size_t size) override { - QMutexLocker locker(&m_mutex); - + QMutexLocker locker(&m_mutex); + if (!m_completenessChecker) { throw std::logic_error("No completeness checker set on transport"); } @@ -104,9 +137,9 @@ qint64 byteCount = m_process->bytesAvailable(); - if (!byteCount) { - std::cerr << "waiting for data from server..." << std::endl; - m_process->waitForReadyRead(1000); + if (!byteCount) { + std::cerr << "waiting for data from server..." << std::endl; + m_process->waitForReadyRead(1000); if (m_process->state() == QProcess::NotRunning) { QProcess::ProcessError err = m_process->error(); if (err == QProcess::Crashed) {
--- a/vamp-client/SynchronousTransport.h Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/SynchronousTransport.h Thu Oct 27 12:01:37 2016 +0100 @@ -1,3 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #ifndef PIPER_SYNCHRONOUS_TRANSPORT_H #define PIPER_SYNCHRONOUS_TRANSPORT_H
--- a/vamp-client/client.cpp Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-client/client.cpp Thu Oct 27 12:01:37 2016 +0100 @@ -1,3 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #include "ProcessQtTransport.h" #include "CapnpRRClient.h" @@ -49,11 +83,11 @@ std::vector<float> buf = { 1.0, -1.0, 1.0, -1.0 }; float *bd = buf.data(); Vamp::Plugin::FeatureSet features = plugin->process - (&bd, Vamp::RealTime::zeroTime); + (&bd, Vamp::RealTime::zeroTime); cerr << "results for output 0:" << endl; auto fl(features[0]); for (const auto &f: fl) { - cerr << f.values[0] << endl; + cerr << f.values[0] << endl; } (void)plugin->getRemainingFeatures(); @@ -63,23 +97,23 @@ // Let's try a crazy AutoPlugin piper_vamp::client::AutoPlugin ap("../bin/piper-vamp-server", - "vamp-example-plugins:zerocrossing", 16, 0); + "vamp-example-plugins:zerocrossing", 16, 0); if (!ap.isOK()) { - cerr << "AutoPlugin creation failed" << endl; + cerr << "AutoPlugin creation failed" << endl; } else { - if (!ap.initialise(1, 4, 4)) { - cerr << "initialisation failed" << endl; - } else { - std::vector<float> buf = { 1.0, -1.0, 1.0, -1.0 }; - float *bd = buf.data(); - Vamp::Plugin::FeatureSet features = ap.process - (&bd, Vamp::RealTime::zeroTime); - cerr << "results for output 0:" << endl; - auto fl(features[0]); - for (const auto &f: fl) { - cerr << f.values[0] << endl; - } - } + if (!ap.initialise(1, 4, 4)) { + cerr << "initialisation failed" << endl; + } else { + std::vector<float> buf = { 1.0, -1.0, 1.0, -1.0 }; + float *bd = buf.data(); + Vamp::Plugin::FeatureSet features = ap.process + (&bd, Vamp::RealTime::zeroTime); + cerr << "results for output 0:" << endl; + auto fl(features[0]); + for (const auto &f: fl) { + cerr << f.values[0] << endl; + } + } } }
--- a/vamp-server/convert.cpp Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-server/convert.cpp Thu Oct 27 12:01:37 2016 +0100 @@ -1,4 +1,37 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #include "vamp-json/VampJson.h" #include "vamp-capnp/VampnProto.h"
--- a/vamp-server/server.cpp Thu Oct 27 11:40:57 2016 +0100 +++ b/vamp-server/server.cpp Thu Oct 27 12:01:37 2016 +0100 @@ -1,4 +1,37 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Piper C++ + + An API for audio analysis and feature extraction plugins. + + Centre for Digital Music, Queen Mary, University of London. + Copyright 2006-2016 Chris Cannam and QMUL. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ #include "vamp-json/VampJson.h" #include "vamp-capnp/VampnProto.h"