VampPluginSDK 2.10
vamp.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3/*
4 Vamp
5
6 An API for audio analysis and feature extraction plugins.
7
8 Centre for Digital Music, Queen Mary, University of London.
9 Copyright 2006 Chris Cannam.
10
11 Permission is hereby granted, free of charge, to any person
12 obtaining a copy of this software and associated documentation
13 files (the "Software"), to deal in the Software without
14 restriction, including without limitation the rights to use, copy,
15 modify, merge, publish, distribute, sublicense, and/or sell copies
16 of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be
20 included in all copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 Except as contained in this notice, the names of the Centre for
31 Digital Music; Queen Mary, University of London; and Chris Cannam
32 shall not be used in advertising or otherwise to promote the sale,
33 use or other dealings in this Software without prior written
34 authorization.
35*/
36
37#ifndef VAMP_HEADER_INCLUDED
38#define VAMP_HEADER_INCLUDED
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
53#define VAMP_API_VERSION 2
54
72{
74 const char *identifier;
75
77 const char *name;
78
80 const char *description;
81
83 const char *unit;
84
86 float minValue;
87
89 float maxValue;
90
93
96
99
101 const char **valueNames;
102
104
105typedef enum
106{
109
112
115
117
119{
121 const char *identifier;
122
124 const char *name;
125
127 const char *description;
128
130 const char *unit;
131
134
136 unsigned int binCount;
137
139 const char **binNames;
140
143
145 float minValue;
146
148 float maxValue;
149
152
155
158
162
171
173
174typedef struct _VampFeature
175{
178
180 int sec;
181
183 int nsec;
184
186 unsigned int valueCount;
187
189 float *values;
190
192 char *label;
193
195
196typedef struct _VampFeatureV2
197{
200
203
206
208
209typedef union _VampFeatureUnion
210{
211 // sizeof(featureV1) >= sizeof(featureV2) for backward compatibility
214
216
217typedef struct _VampFeatureList
218{
220 unsigned int featureCount;
221
236
238
239typedef enum
240{
243
245
246typedef void *VampPluginHandle;
247
249{
251 unsigned int vampApiVersion;
252
254 const char *identifier;
255
257 const char *name;
258
260 const char *description;
261
263 const char *maker;
264
267
269 const char *copyright;
270
272 unsigned int parameterCount;
273
276
278 unsigned int programCount;
279
281 const char **programs;
282
285
288 float inputSampleRate);
289
292
295 unsigned int inputChannels,
296 unsigned int stepSize,
297 unsigned int blockSize);
298
301
304
306 void (*setParameter)(VampPluginHandle, int, float);
307
310
312 void (*selectProgram)(VampPluginHandle, unsigned int);
313
316
319
322
325
328
333 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
334 unsigned int);
335
338
345 const float *const *inputBuffers,
346 int sec,
347 int nsec);
348
350 VampFeatureList *(*getRemainingFeatures)(VampPluginHandle);
351
354
356
357
377 (unsigned int hostApiVersion, unsigned int index);
378
379
381typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)
382 (unsigned int, unsigned int);
383
384#ifdef __cplusplus
385}
386#endif
387
388#endif
unsigned int featureCount
Number of features in this feature list.
Definition: vamp.h:220
VampFeatureUnion * features
Features in this feature list.
Definition: vamp.h:235
int hasDuration
1 if the feature has a duration.
Definition: vamp.h:199
int durationSec
Seconds component of duratiion.
Definition: vamp.h:202
int durationNsec
Nanoseconds component of duration.
Definition: vamp.h:205
int sec
Seconds component of timestamp.
Definition: vamp.h:180
char * label
Label for this returned sample.
Definition: vamp.h:192
int nsec
Nanoseconds component of timestamp.
Definition: vamp.h:183
unsigned int valueCount
Number of values.
Definition: vamp.h:186
int hasTimestamp
1 if the feature has a timestamp (i.e.
Definition: vamp.h:177
float * values
Values for this returned sample.
Definition: vamp.h:189
const char ** binNames
Names of returned value bins, if hasFixedBinCount.
Definition: vamp.h:139
float sampleRate
Sample rate of returned results, if sampleType is vampFixedSampleRate.
Definition: vamp.h:161
const char * identifier
Computer-usable name of the output.
Definition: vamp.h:121
float maxValue
Maximum value for a returned result in any bin, if hasKnownExtents.
Definition: vamp.h:148
VampSampleType sampleType
Time positioning method for returned results (see VampSampleType).
Definition: vamp.h:157
unsigned int binCount
Number of values per result, if hasFixedBinCount.
Definition: vamp.h:136
float quantizeStep
Quantization resolution for returned results, if isQuantized.
Definition: vamp.h:154
float minValue
Minimum value for a returned result in any bin, if hasKnownExtents.
Definition: vamp.h:145
int isQuantized
1 if returned results are quantized to a particular resolution.
Definition: vamp.h:151
const char * description
Human-readable short text about the output.
Definition: vamp.h:127
const char * unit
Human-readable name of the unit of the output.
Definition: vamp.h:130
int hasFixedBinCount
1 if output has equal number of values for each returned result.
Definition: vamp.h:133
const char * name
Human-readable name of the output.
Definition: vamp.h:124
int hasKnownExtents
1 if each returned value falls within the same fixed min/max range.
Definition: vamp.h:142
int hasDuration
1 if the returned results for this output are known to have a duration field.
Definition: vamp.h:170
C language API for Vamp plugins.
Definition: vamp.h:72
const char ** valueNames
Human-readable names of the values, if isQuantized.
Definition: vamp.h:101
const char * identifier
Computer-usable name of the parameter.
Definition: vamp.h:74
float defaultValue
Default value.
Definition: vamp.h:92
int isQuantized
1 if parameter values are quantized to a particular resolution.
Definition: vamp.h:95
float quantizeStep
Quantization resolution, if isQuantized.
Definition: vamp.h:98
float maxValue
Maximum value.
Definition: vamp.h:89
const char * unit
Human-readable unit of the parameter.
Definition: vamp.h:83
const char * description
Human-readable short text about the parameter.
Definition: vamp.h:80
float minValue
Minimum value.
Definition: vamp.h:86
const char * name
Human-readable name of the parameter.
Definition: vamp.h:77
int pluginVersion
Version number of the plugin.
Definition: vamp.h:266
void(* reset)(VampPluginHandle)
Reset an instance, ready to use again on new input data.
Definition: vamp.h:300
float(* getParameter)(VampPluginHandle, int)
Get a parameter value.
Definition: vamp.h:303
unsigned int programCount
Number of programs.
Definition: vamp.h:278
unsigned int(* getCurrentProgram)(VampPluginHandle)
Get the current program (if programCount > 0).
Definition: vamp.h:309
unsigned int(* getPreferredBlockSize)(VampPluginHandle)
Get the plugin's preferred processing window size in samples.
Definition: vamp.h:318
const char * identifier
Computer-usable name of the plugin.
Definition: vamp.h:254
const char * maker
Human-readable name of plugin's author or vendor.
Definition: vamp.h:263
const VampParameterDescriptor ** parameters
Fixed descriptors for parameter inputs.
Definition: vamp.h:275
void(* selectProgram)(VampPluginHandle, unsigned int)
Set the current program.
Definition: vamp.h:312
void(* releaseOutputDescriptor)(VampOutputDescriptor *)
Destroy a descriptor for a feature output.
Definition: vamp.h:337
void(* cleanup)(VampPluginHandle)
Destroy an instance of this plugin.
Definition: vamp.h:291
unsigned int(* getOutputCount)(VampPluginHandle)
Get the number of feature outputs (distinct sets of results).
Definition: vamp.h:327
int(* initialise)(VampPluginHandle, unsigned int inputChannels, unsigned int stepSize, unsigned int blockSize)
Initialise an instance following parameter configuration.
Definition: vamp.h:294
unsigned int(* getMinChannelCount)(VampPluginHandle)
Get the minimum number of input channels this plugin can handle.
Definition: vamp.h:321
const char * name
Human-readable name of the plugin.
Definition: vamp.h:257
const char * description
Human-readable short text about the plugin.
Definition: vamp.h:260
VampPluginHandle(* instantiate)(const struct _VampPluginDescriptor *, float inputSampleRate)
Create and return a new instance of this plugin.
Definition: vamp.h:287
void(* releaseFeatureSet)(VampFeatureList *)
Release a feature set returned from process or getRemainingFeatures.
Definition: vamp.h:353
unsigned int vampApiVersion
API version with which this descriptor is compatible.
Definition: vamp.h:251
void(* setParameter)(VampPluginHandle, int, float)
Set a parameter value.
Definition: vamp.h:306
const char ** programs
Fixed names for programs.
Definition: vamp.h:281
unsigned int parameterCount
Number of parameter inputs.
Definition: vamp.h:272
const char * copyright
Human-readable summary of copyright or licensing for plugin.
Definition: vamp.h:269
unsigned int(* getPreferredStepSize)(VampPluginHandle)
Get the plugin's preferred processing window increment in samples.
Definition: vamp.h:315
unsigned int(* getMaxChannelCount)(VampPluginHandle)
Get the maximum number of input channels this plugin can handle.
Definition: vamp.h:324
VampInputDomain inputDomain
Preferred input domain for audio input (time or frequency).
Definition: vamp.h:284
VampFeature v1
Definition: vamp.h:212
VampFeatureV2 v2
Definition: vamp.h:213
const VampPluginDescriptor * vampGetPluginDescriptor(unsigned int hostApiVersion, unsigned int index)
Get the descriptor for a given plugin index in this library.
Definition: plugins.cpp:54
struct _VampFeature VampFeature
struct _VampParameterDescriptor VampParameterDescriptor
C language API for Vamp plugins.
struct _VampFeatureList VampFeatureList
VampSampleType
Definition: vamp.h:106
@ vampFixedSampleRate
Returned results are evenly spaced at samplerate specified below.
Definition: vamp.h:111
@ vampOneSamplePerStep
Each process call returns results aligned with call's block start.
Definition: vamp.h:108
@ vampVariableSampleRate
Returned results have their own individual timestamps.
Definition: vamp.h:114
struct _VampOutputDescriptor VampOutputDescriptor
struct _VampPluginDescriptor VampPluginDescriptor
VampInputDomain
Definition: vamp.h:240
@ vampTimeDomain
Definition: vamp.h:241
@ vampFrequencyDomain
Definition: vamp.h:242
struct _VampFeatureV2 VampFeatureV2
void * VampPluginHandle
Definition: vamp.h:246
union _VampFeatureUnion VampFeatureUnion