vamp.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Vamp
00005 
00006     An API for audio analysis and feature extraction plugins.
00007 
00008     Centre for Digital Music, Queen Mary, University of London.
00009     Copyright 2006 Chris Cannam.
00010   
00011     Permission is hereby granted, free of charge, to any person
00012     obtaining a copy of this software and associated documentation
00013     files (the "Software"), to deal in the Software without
00014     restriction, including without limitation the rights to use, copy,
00015     modify, merge, publish, distribute, sublicense, and/or sell copies
00016     of the Software, and to permit persons to whom the Software is
00017     furnished to do so, subject to the following conditions:
00018 
00019     The above copyright notice and this permission notice shall be
00020     included in all copies or substantial portions of the Software.
00021 
00022     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00025     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
00026     ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00027     CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00028     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00029 
00030     Except as contained in this notice, the names of the Centre for
00031     Digital Music; Queen Mary, University of London; and Chris Cannam
00032     shall not be used in advertising or otherwise to promote the sale,
00033     use or other dealings in this Software without prior written
00034     authorization.
00035 */
00036 
00037 #ifndef VAMP_HEADER_INCLUDED
00038 #define VAMP_HEADER_INCLUDED
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00053 #define VAMP_API_VERSION 1
00054 
00071 typedef struct _VampParameterDescriptor
00072 {
00074     const char *identifier;
00075 
00077     const char *name;
00078 
00080     const char *description;
00081 
00083     const char *unit;
00084 
00086     float minValue;
00087 
00089     float maxValue;
00090 
00092     float defaultValue;
00093 
00095     int isQuantized;
00096 
00098     float quantizeStep;
00099 
00101     const char **valueNames;
00102 
00103 } VampParameterDescriptor;
00104 
00105 typedef enum
00106 {
00108     vampOneSamplePerStep,
00109 
00111     vampFixedSampleRate,
00112 
00114     vampVariableSampleRate
00115 
00116 } VampSampleType;
00117 
00118 typedef struct _VampOutputDescriptor
00119 {
00121     const char *identifier;
00122 
00124     const char *name;
00125 
00127     const char *description;
00128 
00130     const char *unit;
00131 
00133     int hasFixedBinCount;
00134 
00136     unsigned int binCount;
00137 
00139     const char **binNames;
00140 
00142     int hasKnownExtents;
00143     
00145     float minValue;
00146 
00148     float maxValue;
00149 
00151     int isQuantized;
00152 
00154     float quantizeStep;
00155 
00157     VampSampleType sampleType;
00158 
00161     float sampleRate;
00162 
00163 } VampOutputDescriptor;
00164 
00165 typedef struct _VampFeature
00166 {
00168     int hasTimestamp;
00169 
00171     int sec;
00172 
00174     int nsec;
00175 
00177     unsigned int valueCount;
00178 
00180     float *values;
00181 
00183     char *label;
00184 
00185 } VampFeature;
00186 
00187 typedef struct _VampFeatureList
00188 {
00190     unsigned int featureCount;
00191 
00193     VampFeature *features;
00194 
00195 } VampFeatureList;
00196 
00197 typedef enum
00198 {
00199     vampTimeDomain,
00200     vampFrequencyDomain
00201 
00202 } VampInputDomain;
00203 
00204 typedef void *VampPluginHandle;
00205 
00206 typedef struct _VampPluginDescriptor
00207 {
00209     unsigned int vampApiVersion;
00210 
00212     const char *identifier;
00213 
00215     const char *name;
00216 
00218     const char *description;
00219 
00221     const char *maker;
00222 
00224     int pluginVersion;
00225 
00227     const char *copyright;
00228 
00230     unsigned int parameterCount;
00231 
00233     const VampParameterDescriptor **parameters;
00234 
00236     unsigned int programCount;
00237 
00239     const char **programs;
00240 
00242     VampInputDomain inputDomain;
00243 
00245     VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *,
00246                                    float inputSampleRate);
00247 
00249     void (*cleanup)(VampPluginHandle);
00250 
00252     int (*initialise)(VampPluginHandle,
00253                       unsigned int inputChannels,
00254                       unsigned int stepSize, 
00255                       unsigned int blockSize);
00256 
00258     void (*reset)(VampPluginHandle);
00259 
00261     float (*getParameter)(VampPluginHandle, int);
00262 
00264     void  (*setParameter)(VampPluginHandle, int, float);
00265 
00267     unsigned int (*getCurrentProgram)(VampPluginHandle);
00268 
00270     void  (*selectProgram)(VampPluginHandle, unsigned int);
00271     
00273     unsigned int (*getPreferredStepSize)(VampPluginHandle);
00274 
00276     unsigned int (*getPreferredBlockSize)(VampPluginHandle);
00277 
00279     unsigned int (*getMinChannelCount)(VampPluginHandle);
00280 
00282     unsigned int (*getMaxChannelCount)(VampPluginHandle);
00283 
00285     unsigned int (*getOutputCount)(VampPluginHandle);
00286 
00291     VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle,
00292                                                 unsigned int);
00293 
00295     void (*releaseOutputDescriptor)(VampOutputDescriptor *);
00296 
00302     VampFeatureList *(*process)(VampPluginHandle,
00303                                 const float *const *inputBuffers,
00304                                 int sec,
00305                                 int nsec);
00306 
00308     VampFeatureList *(*getRemainingFeatures)(VampPluginHandle);
00309 
00311     void (*releaseFeatureSet)(VampFeatureList *);
00312 
00313 } VampPluginDescriptor;
00314 
00328 const VampPluginDescriptor *vampGetPluginDescriptor
00329     (unsigned int hostApiVersion, unsigned int index);
00330 
00332 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction)
00333     (unsigned int, unsigned int);
00334 
00335 #ifdef __cplusplus
00336 }
00337 #endif
00338 
00339 #endif

Generated on Thu Jun 19 13:07:48 2008 for VampPluginSDK by  doxygen 1.5.5