Mercurial > hg > piper-cpp
changeset 71:6c908ee3ad3b
vamp -> piper for IDL specs
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 07 Oct 2016 14:27:11 +0100 |
parents | 302a8e35248c |
children | 16acd7d24b1a |
files | Makefile capnproto/VampnProto.h capnproto/vamp.capnp capnproto/vamp.rpc.capnp |
diffstat | 4 files changed, 10 insertions(+), 222 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Oct 07 12:07:17 2016 +0100 +++ b/Makefile Fri Oct 07 14:27:11 2016 +0100 @@ -8,32 +8,32 @@ all: bin/vampipe-convert bin/vampipe-server -bin/vampipe-convert: o/vampipe-convert.o o/json11.o o/vamp.capnp.o +bin/vampipe-convert: o/vampipe-convert.o o/json11.o o/piper.capnp.o c++ $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -bin/vampipe-server: o/vampipe-server.o o/vamp.capnp.o +bin/vampipe-server: o/vampipe-server.o o/piper.capnp.o c++ $(CXXFLAGS) $^ -o $@ $(LDFLAGS) -capnproto/vamp.capnp.h: capnproto/vamp.capnp +capnproto/piper.capnp.h: capnproto/piper.capnp capnp compile $< -oc++ -o/vamp.capnp.o: capnproto/vamp.capnp.c++ capnproto/vamp.capnp.h +o/piper.capnp.o: capnproto/piper.capnp.c++ capnproto/piper.capnp.h c++ $(CXXFLAGS) $(INCFLAGS) -c $< -o $@ o/json11.o: json/json11/json11.cpp c++ $(CXXFLAGS) -c $< -o $@ -o/vampipe-convert.o: utilities/vampipe-convert.cpp capnproto/vamp.capnp.h capnproto/VampnProto.h json/VampJson.h +o/vampipe-convert.o: utilities/vampipe-convert.cpp capnproto/piper.capnp.h capnproto/VampnProto.h json/VampJson.h c++ $(CXXFLAGS) $(INCFLAGS) -c $< -o $@ -o/vampipe-server.o: utilities/vampipe-server.cpp capnproto/vamp.capnp.h capnproto/VampnProto.h +o/vampipe-server.o: utilities/vampipe-server.cpp capnproto/piper.capnp.h capnproto/VampnProto.h c++ $(CXXFLAGS) $(INCFLAGS) -c $< -o $@ test: all test/test-vampipe-server.sh clean: - rm -f */*.o capnproto/vamp.capnp.h capnproto/vamp.capnp.c++ + rm -f */*.o capnproto/piper.capnp.h capnproto/piper.capnp.c++ distclean: clean rm -f bin/*
--- a/capnproto/VampnProto.h Fri Oct 07 12:07:17 2016 +0100 +++ b/capnproto/VampnProto.h Fri Oct 07 14:27:11 2016 +0100 @@ -32,7 +32,7 @@ authorization. */ -#include "vamp.capnp.h" +#include "piper.capnp.h" #include <capnp/message.h> #include <capnp/serialize-packed.h> @@ -48,6 +48,8 @@ namespace vampipe { +using namespace piper; + /** * Convert the structures laid out in the Vamp SDK classes into Cap'n * Proto structures (and back again).
--- a/capnproto/vamp.capnp Fri Oct 07 12:07:17 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ - -@0xc4b1c6c44c999206; - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("vampipe"); - -enum InputDomain { - timeDomain @0; - frequencyDomain @1; -} - -enum SampleType { - oneSamplePerStep @0; - fixedSampleRate @1; - variableSampleRate @2; -} - -enum AdapterFlag { - adaptInputDomain @0; - adaptChannelCount @1; - adaptBufferSize @2; -} - -const adaptAllSafe :List(AdapterFlag) = - [ adaptInputDomain, adaptChannelCount ]; - -const adaptAll :List(AdapterFlag) = - [ adaptInputDomain, adaptChannelCount, adaptBufferSize ]; - -struct RealTime { - sec @0 :Int32 = 0; - nsec @1 :Int32 = 0; -} - -struct Basic { - identifier @0 :Text; - name @1 :Text; - description @2 :Text; -} - -struct ParameterDescriptor { - basic @0 :Basic; - unit @1 :Text; - minValue @2 :Float32 = 0.0; - maxValue @3 :Float32 = 0.0; - defaultValue @4 :Float32 = 0.0; - isQuantized @5 :Bool = false; - quantizeStep @6 :Float32 = 0.0; - valueNames @7 :List(Text) = []; -} - -struct ConfiguredOutputDescriptor { - unit @0 :Text; - hasFixedBinCount @1 :Bool = false; - binCount @2 :Int32 = 0; - binNames @3 :List(Text) = []; - hasKnownExtents @4 :Bool = false; - minValue @5 :Float32 = 0.0; - maxValue @6 :Float32 = 0.0; - isQuantized @7 :Bool = false; - quantizeStep @8 :Float32 = 0.0; - sampleType @9 :SampleType; - sampleRate @10 :Float32 = 0.0; - hasDuration @11 :Bool = false; -} - -struct OutputDescriptor { - basic @0 :Basic; - configured @1 :ConfiguredOutputDescriptor; -} - -struct ExtractorStaticData { - key @0 :Text; - basic @1 :Basic; - maker @2 :Text; - copyright @3 :Text; - version @4 :Int32; - category @5 :List(Text); - minChannelCount @6 :Int32; - maxChannelCount @7 :Int32; - parameters @8 :List(ParameterDescriptor); - programs @9 :List(Text); - inputDomain @10 :InputDomain; - basicOutputInfo @11 :List(Basic); -} - -struct ProcessInput { - inputBuffers @0 :List(List(Float32)); - timestamp @1 :RealTime; -} - -struct Feature { - hasTimestamp @0 :Bool = false; - timestamp @1 :RealTime; - hasDuration @2 :Bool = false; - duration @3 :RealTime; - label @4 :Text; - featureValues @5 :List(Float32) = []; -} - -struct FeatureSet { - struct FSPair { - output @0 :Text; - features @1 :List(Feature) = []; - } - featurePairs @0 :List(FSPair); -} - -struct Configuration { - struct PVPair { - parameter @0 :Text; - value @1 :Float32; - } - parameterValues @0 :List(PVPair); - currentProgram @1 :Text; - channelCount @2 :Int32; - stepSize @3 :Int32; - blockSize @4 :Int32; -} - -struct ListRequest { -} - -struct ListResponse { - available @0 :List(ExtractorStaticData); -} - -struct LoadRequest { - key @0 :Text; - inputSampleRate @1 :Float32; - adapterFlags @2 :List(AdapterFlag); -} - -struct LoadResponse { - handle @0 :Int32; - staticData @1 :ExtractorStaticData; - defaultConfiguration @2 :Configuration; -} - -struct ConfigurationRequest { - handle @0 :Int32; - configuration @1 :Configuration; -} - -struct ConfigurationResponse { - handle @0 :Int32; - outputs @1 :List(OutputDescriptor); -} - -struct ProcessRequest { - handle @0 :Int32; - processInput @1 :ProcessInput; -} - -struct ProcessResponse { - handle @0 :Int32; - features @1 :FeatureSet; -} - -struct FinishRequest { - handle @0 :Int32; -} - -struct FinishResponse { - handle @0 :Int32; - features @1 :FeatureSet; -} - -struct Error { - code @0 :Int32; - message @1 :Text; -} - -struct RpcRequest { - # Request bundle for use when using Cap'n Proto serialisation without - # Cap'n Proto RPC layer. - request :union { - list @0 :ListRequest; - load @1 :LoadRequest; - configure @2 :ConfigurationRequest; - process @3 :ProcessRequest; - finish @4 :FinishRequest; # getRemainingFeatures and unload - } -} - -struct RpcResponse { - # Response bundle for use when using Cap'n Proto serialisation without - # Cap'n Proto RPC layer. - response :union { - error @0 :Error; - list @1 :ListResponse; - load @2 :LoadResponse; - configure @3 :ConfigurationResponse; - process @4 :ProcessResponse; - finish @5 :FinishResponse; - } -} -
--- a/capnproto/vamp.rpc.capnp Fri Oct 07 12:07:17 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -@0xbe97303b9e5b3429; - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("vampipe::rpc"); - -using Vamp = import "vamp.capnp"; - -interface Piper { - # RPC interface for use when using Cap'n Proto RPC layer. - list @0 (req :Vamp.ListRequest) -> (resp :Vamp.ListResponse); - load @1 (req :Vamp.LoadRequest) -> (resp :Vamp.LoadResponse); - configure @2 (req :Vamp.ConfigurationRequest) -> (resp :Vamp.ConfigurationResponse); - process @3 (req :Vamp.ProcessRequest) -> (resp :Vamp.ProcessResponse); - finish @4 (req :Vamp.FinishRequest) -> (resp :Vamp.FinishResponse); -} -