changeset 222:e0e3d9efa774

Stub out RDF type lookup
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 09 Jun 2017 13:56:34 +0100
parents 9aca3267809c
children a29ce4af17bc
files Makefile vamp-server/simple-server.cpp vamp-server/test.sh vamp-support/LoaderRequests.h vamp-support/RdfTypes.h
diffstat 5 files changed, 71 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jun 09 13:06:11 2017 +0100
+++ b/Makefile	Fri Jun 09 13:56:34 2017 +0100
@@ -2,8 +2,8 @@
 VAMPSDK_DIR	:= ../vamp-plugin-sdk
 PIPER_DIR	:= ../piper
 
-INCFLAGS	:= -Iext -I$(VAMPSDK_DIR) -I. -I/usr/local/include
-CXXFLAGS	:= -Wall -Wextra -Werror -g3 -std=c++11 $(INCFLAGS)
+INCFLAGS	:= -Iext -Iext/sord -Iext/serd -I$(VAMPSDK_DIR) -I. -I/usr/local/include
+CXXFLAGS	:= -Wall -Wextra -Werror -Wno-error=unused-parameter -g3 -std=c++11 $(INCFLAGS)
 
 #LDFLAGS		:= -L$(VAMPSDK_DIR) -L/usr/local/lib -lvamp-hostsdk -lcapnp -lkj 
 LDFLAGS		:= $(VAMPSDK_DIR)/libvamp-hostsdk.a -lcapnp -lkj 
--- a/vamp-server/simple-server.cpp	Fri Jun 09 13:06:11 2017 +0100
+++ b/vamp-server/simple-server.cpp	Fri Jun 09 13:56:34 2017 +0100
@@ -38,6 +38,7 @@
 #include "vamp-support/RequestOrResponse.h"
 #include "vamp-support/CountingPluginHandleMapper.h"
 #include "vamp-support/LoaderRequests.h"
+#include "vamp-support/RdfTypes.h"
 
 #include <iostream>
 #include <sstream>
--- a/vamp-server/test.sh	Fri Jun 09 13:06:11 2017 +0100
+++ b/vamp-server/test.sh	Fri Jun 09 13:56:34 2017 +0100
@@ -80,7 +80,7 @@
 # Expected output, apart from the plugin list which seems a bit
 # fragile to check here
 cat > "$expected" <<EOF
-{"id": 6, "jsonrpc": "2.0", "method": "load", "result": {"defaultConfiguration": {"channelCount": 1, "framing": {"blockSize": 1024, "stepSize": 1024}, "parameterValues": {"sensitivity": 40, "threshold": 3}}, "handle": 1, "staticData": {"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "inputDomain": "TimeDomain", "key": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "rights": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005.  Freely redistributable (BSD license)", "version": 2}}}
+{"id": 6, "jsonrpc": "2.0", "method": "load", "result": {"defaultConfiguration": {"channelCount": 1, "framing": {"blockSize": 1024, "stepSize": 1024}, "parameterValues": {"sensitivity": 40, "threshold": 3}}, "handle": 1, "staticData": {"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "inputDomain": "TimeDomain", "key": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "rights": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005.  Freely redistributable (BSD license)", "staticOutputInfo": {}, "version": 2}}}
 {"error": {"code": 0, "message": "error in process request: plugin has not been configured"}, "jsonrpc": "2.0", "method": "process"}
 {"id": "weevil", "jsonrpc": "2.0", "method": "configure", "result": {"framing": {"blockSize": 8, "stepSize": 8}, "handle": 1, "outputList": [{"basic": {"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, "configured": {"binCount": 0, "binNames": [], "hasDuration": false, "sampleRate": 44100, "sampleType": "VariableSampleRate", "unit": ""}, "static": {}}, {"basic": {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}, "configured": {"binCount": 1, "binNames": [""], "hasDuration": false, "quantizeStep": 1, "sampleRate": 86.1328125, "sampleType": "FixedSampleRate", "unit": ""}, "static": {}}]}}
 {"error": {"code": 0, "message": "error in configure request: unknown plugin handle supplied to configure"}, "id": 9, "jsonrpc": "2.0", "method": "configure"}
--- a/vamp-support/LoaderRequests.h	Fri Jun 09 13:06:11 2017 +0100
+++ b/vamp-support/LoaderRequests.h	Fri Jun 09 13:56:34 2017 +0100
@@ -39,6 +39,7 @@
 
 #include "PluginStaticData.h"
 #include "PluginConfiguration.h"
+#include "RdfTypes.h"
 
 #include <vamp-hostsdk/PluginLoader.h>
 
@@ -73,8 +74,10 @@
 	    Vamp::Plugin *p = loader->loadPlugin(key, 44100, 0);
 	    if (!p) continue;
 	    auto category = loader->getPluginCategory(key);
-	    response.available.push_back
-		(PluginStaticData::fromPlugin(key, category, p));
+            PluginStaticData psd =
+                PluginStaticData::fromPlugin(key, category, p);
+            psd.staticOutputInfo = RdfTypes().loadStaticOutputInfo(key);
+	    response.available.push_back(psd);
 	    delete p;
 	}
 
@@ -99,6 +102,9 @@
 	    (req.pluginKey,
 	     loader->getPluginCategory(req.pluginKey),
 	     plugin);
+        
+        response.staticData.staticOutputInfo =
+            RdfTypes().loadStaticOutputInfo(req.pluginKey);
 
 	int defaultChannels = 0;
 	if (plugin->getMinChannelCount() == plugin->getMaxChannelCount()) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vamp-support/RdfTypes.h	Fri Jun 09 13:56:34 2017 +0100
@@ -0,0 +1,59 @@
+/* -*- 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-2017 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_RDF_TYPES_H
+#define PIPER_RDF_TYPES_H
+
+#include "StaticOutputDescriptor.h"
+
+#include <vamp-hostsdk/PluginLoader.h>
+
+#include <sord/sord.h>
+
+namespace piper_vamp {
+
+// NB not thread-safe
+class RdfTypes
+{
+public:
+    StaticOutputInfo loadStaticOutputInfo(Vamp::HostExt::PluginLoader::PluginKey) {
+        return {};
+    }
+};
+
+}
+
+#endif