comparison vamp-sdk/Plugin.h @ 167:31eda4b11f2b

* First bit of Vamp v2 work -- add an optional duration to features in a backward compatible way. Warning: this code is unstable and experimental and may change significantly in the coming weeks.
author cannam
date Thu, 17 Jul 2008 08:52:26 +0000
parents c1dce0b033cb
children 1982246a3902
comparison
equal deleted inserted replaced
166:120f88880347 167:31eda4b11f2b
302 * the output (i.e. the "duration" of each sample, in time, 302 * the output (i.e. the "duration" of each sample, in time,
303 * will be 1/sampleRate seconds). It's recommended to set 303 * will be 1/sampleRate seconds). It's recommended to set
304 * this to zero if that behaviour is not desired. 304 * this to zero if that behaviour is not desired.
305 */ 305 */
306 float sampleRate; 306 float sampleRate;
307
308 OutputDescriptor() : // defaults for mandatory non-class-type members
309 hasFixedBinCount(false), hasKnownExtents(false), isQuantized(false),
310 sampleType(OneSamplePerStep) { }
307 }; 311 };
308 312
309 typedef std::vector<OutputDescriptor> OutputList; 313 typedef std::vector<OutputDescriptor> OutputList;
310 314
311 /** 315 /**
317 321
318 struct Feature 322 struct Feature
319 { 323 {
320 /** 324 /**
321 * True if an output feature has its own timestamp. This is 325 * True if an output feature has its own timestamp. This is
322 * mandatory if the output has VariableSampleRate, and is 326 * mandatory if the output has VariableSampleRate, optional if
323 * likely to be disregarded otherwise. 327 * the output has FixedSampleRate, and unused if the output
328 * has OneSamplePerStep.
324 */ 329 */
325 bool hasTimestamp; 330 bool hasTimestamp;
326 331
327 /** 332 /**
328 * Timestamp of the output feature. This is mandatory if the 333 * Timestamp of the output feature. This is mandatory if the
329 * output has VariableSampleRate, and is likely to be 334 * output has VariableSampleRate or if the output has
330 * disregarded otherwise. Undefined if hasTimestamp is false. 335 * FixedSampleRate and hasTimestamp is true, and unused
336 * otherwise.
331 */ 337 */
332 RealTime timestamp; 338 RealTime timestamp;
339
340 /**
341 * True if an output feature has a specified duration. This
342 * is optional if the output has VariableSampleRate or
343 * FixedSampleRate, and and unused if the output has
344 * OneSamplePerStep.
345 */
346 bool hasDuration;
347
348 /**
349 * Duration of the output feature. This is mandatory if the
350 * output has VariableSampleRate or FixedSampleRate and
351 * hasDuration is true, and unused otherwise.
352 */
353 RealTime duration;
333 354
334 /** 355 /**
335 * Results for a single sample of this feature. If the output 356 * Results for a single sample of this feature. If the output
336 * hasFixedBinCount, there must be the same number of values 357 * hasFixedBinCount, there must be the same number of values
337 * as the output's binCount count. 358 * as the output's binCount count.
340 361
341 /** 362 /**
342 * Label for the sample of this feature. 363 * Label for the sample of this feature.
343 */ 364 */
344 std::string label; 365 std::string label;
366
367 Feature() : // defaults for mandatory non-class-type members
368 hasTimestamp(false), hasDuration(false) { }
345 }; 369 };
346 370
347 typedef std::vector<Feature> FeatureList; 371 typedef std::vector<Feature> FeatureList;
372
348 typedef std::map<int, FeatureList> FeatureSet; // key is output no 373 typedef std::map<int, FeatureList> FeatureSet; // key is output no
349 374
350 /** 375 /**
351 * Process a single block of input data. 376 * Process a single block of input data.
352 * 377 *