annotate capnproto/piper.capnp @ 172:ee9d66f669d2

Merge JSON and Cap'n Proto schema
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 07 Oct 2016 15:42:12 +0100
parents 5cd428fc703c
children
rev   line source
c@167 1
c@167 2 @0xc4b1c6c44c999206;
c@167 3
c@167 4 using Cxx = import "/capnp/c++.capnp";
c@167 5 $Cxx.namespace("piper");
c@167 6
c@167 7 struct Basic {
c@167 8 identifier @0 :Text;
c@167 9 name @1 :Text;
c@167 10 description @2 :Text;
c@167 11 }
c@167 12
c@167 13 struct ParameterDescriptor {
c@167 14 basic @0 :Basic;
c@167 15 unit @1 :Text;
c@167 16 minValue @2 :Float32 = 0.0;
c@167 17 maxValue @3 :Float32 = 0.0;
c@167 18 defaultValue @4 :Float32 = 0.0;
c@167 19 isQuantized @5 :Bool = false;
c@167 20 quantizeStep @6 :Float32 = 0.0;
c@167 21 valueNames @7 :List(Text) = [];
c@167 22 }
c@167 23
c@168 24 enum SampleType {
c@168 25 oneSamplePerStep @0;
c@168 26 fixedSampleRate @1;
c@168 27 variableSampleRate @2;
c@168 28 }
c@168 29
c@167 30 struct ConfiguredOutputDescriptor {
c@167 31 unit @0 :Text;
c@167 32 hasFixedBinCount @1 :Bool = false;
c@167 33 binCount @2 :Int32 = 0;
c@167 34 binNames @3 :List(Text) = [];
c@167 35 hasKnownExtents @4 :Bool = false;
c@167 36 minValue @5 :Float32 = 0.0;
c@167 37 maxValue @6 :Float32 = 0.0;
c@167 38 isQuantized @7 :Bool = false;
c@167 39 quantizeStep @8 :Float32 = 0.0;
c@167 40 sampleType @9 :SampleType;
c@167 41 sampleRate @10 :Float32 = 0.0;
c@167 42 hasDuration @11 :Bool = false;
c@167 43 }
c@167 44
c@167 45 struct OutputDescriptor {
c@167 46 basic @0 :Basic;
c@167 47 configured @1 :ConfiguredOutputDescriptor;
c@167 48 }
c@167 49
c@168 50 enum InputDomain {
c@168 51 timeDomain @0;
c@168 52 frequencyDomain @1;
c@168 53 }
c@168 54
c@167 55 struct ExtractorStaticData {
c@167 56 key @0 :Text;
c@167 57 basic @1 :Basic;
c@167 58 maker @2 :Text;
c@167 59 copyright @3 :Text;
c@167 60 version @4 :Int32;
c@167 61 category @5 :List(Text);
c@167 62 minChannelCount @6 :Int32;
c@167 63 maxChannelCount @7 :Int32;
c@167 64 parameters @8 :List(ParameterDescriptor);
c@167 65 programs @9 :List(Text);
c@167 66 inputDomain @10 :InputDomain;
c@167 67 basicOutputInfo @11 :List(Basic);
c@167 68 }
c@167 69
c@168 70 struct RealTime {
c@168 71 sec @0 :Int32 = 0;
c@168 72 nsec @1 :Int32 = 0;
c@168 73 }
c@168 74
c@167 75 struct ProcessInput {
c@167 76 inputBuffers @0 :List(List(Float32));
c@167 77 timestamp @1 :RealTime;
c@167 78 }
c@167 79
c@167 80 struct Feature {
c@167 81 hasTimestamp @0 :Bool = false;
c@167 82 timestamp @1 :RealTime;
c@167 83 hasDuration @2 :Bool = false;
c@167 84 duration @3 :RealTime;
c@167 85 label @4 :Text;
c@167 86 featureValues @5 :List(Float32) = [];
c@167 87 }
c@167 88
c@167 89 struct FeatureSet {
c@167 90 struct FSPair {
c@167 91 output @0 :Text;
c@167 92 features @1 :List(Feature) = [];
c@167 93 }
c@167 94 featurePairs @0 :List(FSPair);
c@167 95 }
c@167 96
c@167 97 struct Configuration {
c@167 98 struct PVPair {
c@167 99 parameter @0 :Text;
c@167 100 value @1 :Float32;
c@167 101 }
c@167 102 parameterValues @0 :List(PVPair);
c@167 103 currentProgram @1 :Text;
c@167 104 channelCount @2 :Int32;
c@167 105 stepSize @3 :Int32;
c@167 106 blockSize @4 :Int32;
c@167 107 }
c@167 108
c@168 109 enum AdapterFlag {
c@168 110 adaptInputDomain @0;
c@168 111 adaptChannelCount @1;
c@168 112 adaptBufferSize @2;
c@168 113 }
c@168 114
c@168 115 const adaptAllSafe :List(AdapterFlag) =
c@168 116 [ adaptInputDomain, adaptChannelCount ];
c@168 117
c@168 118 const adaptAll :List(AdapterFlag) =
c@168 119 [ adaptInputDomain, adaptChannelCount, adaptBufferSize ];
c@168 120
c@167 121 struct ListRequest {
c@167 122 }
c@167 123
c@167 124 struct ListResponse {
c@167 125 available @0 :List(ExtractorStaticData);
c@167 126 }
c@167 127
c@167 128 struct LoadRequest {
c@167 129 key @0 :Text;
c@167 130 inputSampleRate @1 :Float32;
c@167 131 adapterFlags @2 :List(AdapterFlag);
c@167 132 }
c@167 133
c@167 134 struct LoadResponse {
c@167 135 handle @0 :Int32;
c@167 136 staticData @1 :ExtractorStaticData;
c@167 137 defaultConfiguration @2 :Configuration;
c@167 138 }
c@167 139
c@167 140 struct ConfigurationRequest {
c@167 141 handle @0 :Int32;
c@167 142 configuration @1 :Configuration;
c@167 143 }
c@167 144
c@167 145 struct ConfigurationResponse {
c@167 146 handle @0 :Int32;
c@167 147 outputs @1 :List(OutputDescriptor);
c@167 148 }
c@167 149
c@167 150 struct ProcessRequest {
c@167 151 handle @0 :Int32;
c@167 152 processInput @1 :ProcessInput;
c@167 153 }
c@167 154
c@167 155 struct ProcessResponse {
c@167 156 handle @0 :Int32;
c@167 157 features @1 :FeatureSet;
c@167 158 }
c@167 159
c@167 160 struct FinishRequest {
c@167 161 handle @0 :Int32;
c@167 162 }
c@167 163
c@167 164 struct FinishResponse {
c@167 165 handle @0 :Int32;
c@167 166 features @1 :FeatureSet;
c@167 167 }
c@167 168
c@167 169 struct Error {
c@167 170 code @0 :Int32;
c@167 171 message @1 :Text;
c@167 172 }
c@167 173
c@167 174 struct RpcRequest {
c@167 175 # Request bundle for use when using Cap'n Proto serialisation without
c@168 176 # Cap'n Proto RPC layer. For Cap'n Proto RPC, see piper.rpc.capnp.
c@167 177 request :union {
c@167 178 list @0 :ListRequest;
c@167 179 load @1 :LoadRequest;
c@167 180 configure @2 :ConfigurationRequest;
c@167 181 process @3 :ProcessRequest;
c@167 182 finish @4 :FinishRequest; # getRemainingFeatures and unload
c@167 183 }
c@167 184 }
c@167 185
c@167 186 struct RpcResponse {
c@167 187 # Response bundle for use when using Cap'n Proto serialisation without
c@168 188 # Cap'n Proto RPC layer. For Cap'n Proto RPC, see piper.rpc.capnp.
c@167 189 response :union {
c@167 190 error @0 :Error;
c@167 191 list @1 :ListResponse;
c@167 192 load @2 :LoadResponse;
c@167 193 configure @3 :ConfigurationResponse;
c@167 194 process @4 :ProcessResponse;
c@167 195 finish @5 :FinishResponse;
c@167 196 }
c@167 197 }
c@167 198