c@174: c@174: @0xc4b1c6c44c999206; c@174: c@174: using Cxx = import "/capnp/c++.capnp"; c@174: $Cxx.namespace("piper"); c@174: c@174: struct Basic { c@174: identifier @0 :Text; c@174: name @1 :Text; c@174: description @2 :Text; c@174: } c@174: c@174: struct ParameterDescriptor { c@174: basic @0 :Basic; c@174: unit @1 :Text; c@174: minValue @2 :Float32 = 0.0; c@174: maxValue @3 :Float32 = 0.0; c@174: defaultValue @4 :Float32 = 0.0; c@174: isQuantized @5 :Bool = false; c@174: quantizeStep @6 :Float32 = 0.0; c@174: valueNames @7 :List(Text) = []; c@174: } c@174: c@174: enum SampleType { c@174: oneSamplePerStep @0; c@174: fixedSampleRate @1; c@174: variableSampleRate @2; c@174: } c@174: c@174: struct ConfiguredOutputDescriptor { c@174: unit @0 :Text; c@174: hasFixedBinCount @1 :Bool = false; c@174: binCount @2 :Int32 = 0; c@174: binNames @3 :List(Text) = []; c@174: hasKnownExtents @4 :Bool = false; c@174: minValue @5 :Float32 = 0.0; c@174: maxValue @6 :Float32 = 0.0; c@174: isQuantized @7 :Bool = false; c@174: quantizeStep @8 :Float32 = 0.0; c@174: sampleType @9 :SampleType; c@174: sampleRate @10 :Float32 = 0.0; c@174: hasDuration @11 :Bool = false; c@174: } c@174: c@174: struct OutputDescriptor { c@174: basic @0 :Basic; c@174: configured @1 :ConfiguredOutputDescriptor; c@174: } c@174: c@174: enum InputDomain { c@174: timeDomain @0; c@174: frequencyDomain @1; c@174: } c@174: c@174: struct ExtractorStaticData { c@174: key @0 :Text; c@174: basic @1 :Basic; c@174: maker @2 :Text; c@174: copyright @3 :Text; c@174: version @4 :Int32; c@174: category @5 :List(Text); c@174: minChannelCount @6 :Int32; c@174: maxChannelCount @7 :Int32; c@174: parameters @8 :List(ParameterDescriptor); c@174: programs @9 :List(Text); c@174: inputDomain @10 :InputDomain; c@174: basicOutputInfo @11 :List(Basic); c@174: } c@174: c@174: struct RealTime { c@174: sec @0 :Int32 = 0; c@174: nsec @1 :Int32 = 0; c@174: } c@174: c@174: struct ProcessInput { c@174: inputBuffers @0 :List(List(Float32)); c@174: timestamp @1 :RealTime; c@174: } c@174: c@174: struct Feature { c@174: hasTimestamp @0 :Bool = false; c@174: timestamp @1 :RealTime; c@174: hasDuration @2 :Bool = false; c@174: duration @3 :RealTime; c@174: label @4 :Text; c@174: featureValues @5 :List(Float32) = []; c@174: } c@174: c@174: struct FeatureSet { c@174: struct FSPair { c@174: output @0 :Text; c@174: features @1 :List(Feature) = []; c@174: } c@174: featurePairs @0 :List(FSPair); c@174: } c@174: cannam@191: struct Framing { cannam@191: stepSize @0 :Int32; cannam@191: blockSize @1 :Int32; cannam@191: } cannam@191: c@174: struct Configuration { c@174: struct PVPair { c@174: parameter @0 :Text; c@174: value @1 :Float32; c@174: } c@174: parameterValues @0 :List(PVPair); c@174: currentProgram @1 :Text; c@174: channelCount @2 :Int32; cannam@191: framing @3 :Framing; c@174: } c@174: c@174: enum AdapterFlag { c@174: adaptInputDomain @0; c@174: adaptChannelCount @1; c@174: adaptBufferSize @2; c@174: } c@174: c@174: const adaptAllSafe :List(AdapterFlag) = c@174: [ adaptInputDomain, adaptChannelCount ]; c@174: c@174: const adaptAll :List(AdapterFlag) = c@174: [ adaptInputDomain, adaptChannelCount, adaptBufferSize ]; c@174: c@174: struct ListRequest { c@179: from @0 :List(Text); c@174: } c@174: c@174: struct ListResponse { c@174: available @0 :List(ExtractorStaticData); c@174: } c@174: c@174: struct LoadRequest { c@174: key @0 :Text; c@174: inputSampleRate @1 :Float32; c@174: adapterFlags @2 :List(AdapterFlag); c@174: } c@174: c@174: struct LoadResponse { c@174: handle @0 :Int32; c@174: staticData @1 :ExtractorStaticData; c@174: defaultConfiguration @2 :Configuration; c@174: } c@174: c@174: struct ConfigurationRequest { c@174: handle @0 :Int32; c@174: configuration @1 :Configuration; c@174: } c@174: c@174: struct ConfigurationResponse { c@174: handle @0 :Int32; c@174: outputs @1 :List(OutputDescriptor); cannam@191: framing @2 :Framing; c@174: } c@174: c@174: struct ProcessRequest { c@174: handle @0 :Int32; c@174: processInput @1 :ProcessInput; c@174: } c@174: c@174: struct ProcessResponse { c@174: handle @0 :Int32; c@174: features @1 :FeatureSet; c@174: } c@174: c@174: struct FinishRequest { c@174: handle @0 :Int32; c@174: } c@174: c@174: struct FinishResponse { c@174: handle @0 :Int32; c@174: features @1 :FeatureSet; c@174: } c@174: c@174: struct Error { c@174: code @0 :Int32; c@174: message @1 :Text; c@174: } c@174: c@174: struct RpcRequest { c@174: # Request bundle for use when using Cap'n Proto serialisation without c@174: # Cap'n Proto RPC layer. For Cap'n Proto RPC, see piper.rpc.capnp. c@175: id :union { c@175: number @0 :Int32; c@175: tag @1 :Text; c@175: none @2 :Void; c@175: } c@174: request :union { c@175: list @3 :ListRequest; c@175: load @4 :LoadRequest; c@175: configure @5 :ConfigurationRequest; c@175: process @6 :ProcessRequest; c@177: finish @7 :FinishRequest; c@177: # finish gets any remaining calculated features and unloads c@177: # the feature extractor. Note that you can call finish at any c@177: # time -- even if you haven't configured or used the extractor, c@177: # it will unload any resources used and abandon the handle. c@174: } c@174: } c@174: c@174: struct RpcResponse { c@174: # Response bundle for use when using Cap'n Proto serialisation without c@174: # Cap'n Proto RPC layer. For Cap'n Proto RPC, see piper.rpc.capnp. c@175: id :union { c@175: number @0 :Int32; c@175: tag @1 :Text; c@175: none @2 :Void; c@175: } c@174: response :union { c@175: error @3 :Error; c@175: list @4 :ListResponse; c@175: load @5 :LoadResponse; c@175: configure @6 :ConfigurationResponse; c@175: process @7 :ProcessResponse; c@175: finish @8 :FinishResponse; c@174: } c@174: } c@174: