annotate plugin/api/svp.h @ 58:0a34d529f8e0

* Add C API for feature extraction plugins * First cut of an adapter class to make C++ feature extraction plugins available using the C API. This will probably mutate quite a bit and likely move to its own SDK tree.
author Chris Cannam
date Fri, 24 Mar 2006 17:36:10 +0000
parents
children 3086ff194ea0
rev   line source
Chris@58 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@58 2
Chris@58 3 /*
Chris@58 4 Sonic Visualiser Plugin API
Chris@58 5 A plugin interface for audio feature extraction plugins.
Chris@58 6 Centre for Digital Music, Queen Mary, University of London.
Chris@58 7 Copyright 2006 Chris Cannam.
Chris@58 8
Chris@58 9 This library is free software; you can redistribute it and/or
Chris@58 10 modify it under the terms of the GNU Lesser General Public License
Chris@58 11 as published by the Free Software Foundation; either version 2.1
Chris@58 12 of the License, or (at your option) any later version. See the
Chris@58 13 file COPYING included with this distribution for more information.
Chris@58 14 */
Chris@58 15
Chris@58 16 #ifndef SVP_HEADER_INCLUDED
Chris@58 17 #define SVP_HEADER_INCLUDED
Chris@58 18
Chris@58 19 #ifdef __cplusplus
Chris@58 20 extern "C" {
Chris@58 21 #endif
Chris@58 22
Chris@58 23 typedef struct _SVPParameterDescriptor
Chris@58 24 {
Chris@58 25 const char *name;
Chris@58 26 const char *description;
Chris@58 27 const char *unit;
Chris@58 28 float minValue;
Chris@58 29 float maxValue;
Chris@58 30 float defaultValue;
Chris@58 31 int isQuantized;
Chris@58 32 float quantizeStep;
Chris@58 33
Chris@58 34 } SVPParameterDescriptor;
Chris@58 35
Chris@58 36 typedef enum
Chris@58 37 {
Chris@58 38 svpOneSamplePerStep,
Chris@58 39 svpFixedSampleRate,
Chris@58 40 svpVariableSampleRate
Chris@58 41
Chris@58 42 } SVPSampleType;
Chris@58 43
Chris@58 44 typedef struct _SVPOutputDescriptor
Chris@58 45 {
Chris@58 46 const char *name;
Chris@58 47 const char *description;
Chris@58 48 const char *unit;
Chris@58 49 int hasFixedValueCount;
Chris@58 50 unsigned int valueCount;
Chris@58 51 const char **valueNames;
Chris@58 52 int hasKnownExtents;
Chris@58 53 float minValue;
Chris@58 54 float maxValue;
Chris@58 55 int isQuantized;
Chris@58 56 float quantizeStep;
Chris@58 57 SVPSampleType sampleType;
Chris@58 58 float sampleRate;
Chris@58 59
Chris@58 60 } SVPOutputDescriptor;
Chris@58 61
Chris@58 62 typedef struct _SVPFeature
Chris@58 63 {
Chris@58 64 int hasTimestamp;
Chris@58 65 int sec;
Chris@58 66 int nsec;
Chris@58 67 unsigned int valueCount;
Chris@58 68 float *values;
Chris@58 69 char *label;
Chris@58 70
Chris@58 71 } SVPFeature;
Chris@58 72
Chris@58 73 typedef struct _SVPFeatureList
Chris@58 74 {
Chris@58 75 unsigned int featureCount;
Chris@58 76 SVPFeature *features;
Chris@58 77
Chris@58 78 } SVPFeatureList;
Chris@58 79
Chris@58 80 typedef void *SVPPluginHandle;
Chris@58 81
Chris@58 82 typedef struct _SVPPluginDescriptor
Chris@58 83 {
Chris@58 84 const char *name;
Chris@58 85 const char *description;
Chris@58 86 const char *maker;
Chris@58 87 int pluginVersion;
Chris@58 88 const char *copyright;
Chris@58 89 unsigned int parameterCount;
Chris@58 90 const SVPParameterDescriptor **parameters;
Chris@58 91 unsigned int programCount;
Chris@58 92 const char **programs;
Chris@58 93
Chris@58 94 SVPPluginHandle (*instantiate)(const struct _SVPPluginDescriptor *,
Chris@58 95 float inputSampleRate);
Chris@58 96
Chris@58 97 void (*cleanup)(SVPPluginHandle);
Chris@58 98
Chris@58 99 int (*initialise)(SVPPluginHandle,
Chris@58 100 unsigned int inputChannels,
Chris@58 101 unsigned int stepSize,
Chris@58 102 unsigned int blockSize);
Chris@58 103
Chris@58 104 void (*reset)(SVPPluginHandle);
Chris@58 105
Chris@58 106 float (*getParameter)(SVPPluginHandle, int);
Chris@58 107 void (*setParameter)(SVPPluginHandle, int, float);
Chris@58 108
Chris@58 109 unsigned int (*getCurrentProgram)(SVPPluginHandle);
Chris@58 110 void (*selectProgram)(SVPPluginHandle, unsigned int);
Chris@58 111
Chris@58 112 unsigned int (*getPreferredStepSize)(SVPPluginHandle);
Chris@58 113 unsigned int (*getPreferredBlockSize)(SVPPluginHandle);
Chris@58 114 unsigned int (*getMinChannelCount)(SVPPluginHandle);
Chris@58 115 unsigned int (*getMaxChannelCount)(SVPPluginHandle);
Chris@58 116 unsigned int (*getOutputCount)(SVPPluginHandle);
Chris@58 117
Chris@58 118 SVPOutputDescriptor *(*getOutputDescriptor)(SVPPluginHandle,
Chris@58 119 unsigned int);
Chris@58 120 void (*releaseOutputDescriptor)(SVPOutputDescriptor *);
Chris@58 121
Chris@58 122 SVPFeatureList **(*process)(SVPPluginHandle,
Chris@58 123 float **inputBuffers,
Chris@58 124 int sec,
Chris@58 125 int nsec);
Chris@58 126 SVPFeatureList **(*getRemainingFeatures)(SVPPluginHandle);
Chris@58 127 void (*releaseFeatureSet)(SVPFeatureList **);
Chris@58 128
Chris@58 129 } SVPPluginDescriptor;
Chris@58 130
Chris@58 131 const SVPPluginDescriptor *svpGetPluginDescriptor(unsigned int index);
Chris@58 132
Chris@58 133 typedef const SVPPluginDescriptor *(SVPGetPluginDescriptorFunction)(unsigned int);
Chris@58 134
Chris@58 135 #ifdef __cplusplus
Chris@58 136 }
Chris@58 137 #endif
Chris@58 138
Chris@58 139 #endif