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