Mercurial > hg > vamp-plugin-sdk
comparison vamp/vamp.h @ 0:6479539d1b32
* Importing first cut of Sonic Visualiser's Vamp plugin format SDK
author | cannam |
---|---|
date | Fri, 31 Mar 2006 14:21:51 +0000 |
parents | |
children | 8f10d35a4090 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6479539d1b32 |
---|---|
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 X CONSORTIUM 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 /* | |
41 * C language API for Vamp plugins. | |
42 * | |
43 * This is the formal plugin API for Vamp. Plugin authors may prefer | |
44 * to use the C++ classes defined in the sdk directory, instead of | |
45 * using this API directly. There is an adapter class provided that | |
46 * makes C++ plugins available using this C API with relatively little | |
47 * work. See the example plugins in the examples directory. | |
48 */ | |
49 | |
50 #ifdef __cplusplus | |
51 extern "C" { | |
52 #endif | |
53 | |
54 typedef struct _VampParameterDescriptor | |
55 { | |
56 const char *name; | |
57 const char *description; | |
58 const char *unit; | |
59 float minValue; | |
60 float maxValue; | |
61 float defaultValue; | |
62 int isQuantized; | |
63 float quantizeStep; | |
64 | |
65 } VampParameterDescriptor; | |
66 | |
67 typedef enum | |
68 { | |
69 vampOneSamplePerStep, | |
70 vampFixedSampleRate, | |
71 vampVariableSampleRate | |
72 | |
73 } VampSampleType; | |
74 | |
75 typedef struct _VampOutputDescriptor | |
76 { | |
77 const char *name; | |
78 const char *description; | |
79 const char *unit; | |
80 int hasFixedValueCount; | |
81 unsigned int valueCount; | |
82 const char **valueNames; | |
83 int hasKnownExtents; | |
84 float minValue; | |
85 float maxValue; | |
86 int isQuantized; | |
87 float quantizeStep; | |
88 VampSampleType sampleType; | |
89 float sampleRate; | |
90 | |
91 } VampOutputDescriptor; | |
92 | |
93 typedef struct _VampFeature | |
94 { | |
95 int hasTimestamp; | |
96 int sec; | |
97 int nsec; | |
98 unsigned int valueCount; | |
99 float *values; | |
100 char *label; | |
101 | |
102 } VampFeature; | |
103 | |
104 typedef struct _VampFeatureList | |
105 { | |
106 unsigned int featureCount; | |
107 VampFeature *features; | |
108 | |
109 } VampFeatureList; | |
110 | |
111 typedef enum | |
112 { | |
113 vampTimeDomain, | |
114 vampFrequencyDomain | |
115 | |
116 } VampInputDomain; | |
117 | |
118 typedef void *VampPluginHandle; | |
119 | |
120 typedef struct _VampPluginDescriptor | |
121 { | |
122 const char *name; | |
123 const char *description; | |
124 const char *maker; | |
125 int pluginVersion; | |
126 const char *copyright; | |
127 unsigned int parameterCount; | |
128 const VampParameterDescriptor **parameters; | |
129 unsigned int programCount; | |
130 const char **programs; | |
131 VampInputDomain inputDomain; | |
132 | |
133 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *, | |
134 float inputSampleRate); | |
135 | |
136 void (*cleanup)(VampPluginHandle); | |
137 | |
138 int (*initialise)(VampPluginHandle, | |
139 unsigned int inputChannels, | |
140 unsigned int stepSize, | |
141 unsigned int blockSize); | |
142 | |
143 void (*reset)(VampPluginHandle); | |
144 | |
145 float (*getParameter)(VampPluginHandle, int); | |
146 void (*setParameter)(VampPluginHandle, int, float); | |
147 | |
148 unsigned int (*getCurrentProgram)(VampPluginHandle); | |
149 void (*selectProgram)(VampPluginHandle, unsigned int); | |
150 | |
151 unsigned int (*getPreferredStepSize)(VampPluginHandle); | |
152 unsigned int (*getPreferredBlockSize)(VampPluginHandle); | |
153 unsigned int (*getMinChannelCount)(VampPluginHandle); | |
154 unsigned int (*getMaxChannelCount)(VampPluginHandle); | |
155 | |
156 unsigned int (*getOutputCount)(VampPluginHandle); | |
157 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle, | |
158 unsigned int); | |
159 void (*releaseOutputDescriptor)(VampOutputDescriptor *); | |
160 | |
161 VampFeatureList **(*process)(VampPluginHandle, | |
162 float **inputBuffers, | |
163 int sec, | |
164 int nsec); | |
165 VampFeatureList **(*getRemainingFeatures)(VampPluginHandle); | |
166 void (*releaseFeatureSet)(VampFeatureList **); | |
167 | |
168 } VampPluginDescriptor; | |
169 | |
170 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int index); | |
171 | |
172 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)(unsigned int); | |
173 | |
174 #ifdef __cplusplus | |
175 } | |
176 #endif | |
177 | |
178 #endif |