annotate capnp/piper.capnp @ 191:4fed2f3f2cd0

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