Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
vamp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: © 2021 Alexandros Theodotou <alex@zrythm.org>
3 *
4 * SPDX-License-Identifier: LicenseRef-ZrythmLicense
5 *
6 * This file incorporates work covered by the following copyright and
7 * permission notices:
8 *
9 * Centre for Digital Music, Queen Mary, University of London.
10
11 Copyright 2006 Chris Cannam.
12
13 Permission is hereby granted, free of charge, to any person
14
15 obtaining a copy of this software and associated documentation
16
17 files (the "Software"), to deal in the Software without
18
19 restriction, including without limitation the rights to use, copy,
20
21 modify, merge, publish, distribute, sublicense, and/or sell copies
22
23 of the Software, and to permit persons to whom the Software is
24
25 furnished to do so, subject to the following conditions:
26
27
28 The above copyright notice and this permission notice shall be
29
30 included in all copies or substantial portions of the Software.
31
32
33 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34
35 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36
37 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
39 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
40
41 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
42
43 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
44
45 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
47
48 Except as contained in this notice, the names of the Centre for
49
50 Digital Music; Queen Mary, University of London; and Chris Cannam
51
52 shall not be used in advertising or otherwise to promote the sale,
53
54 use or other dealings in this Software without prior written
55
56 authorization.
57
58 */
59
72#ifndef __UTILS_VAMP_H__
73#define __UTILS_VAMP_H__
74
75#include <glib.h>
76
77#include <vamp-hostsdk/host-c.h>
78#include <vamp/vamp.h>
79
80#ifdef __cplusplus
81extern "C" {
82#endif
83
90typedef void ZVampPlugin;
91
92typedef enum ZVampPluginType
93{
94 Z_VAMP_PLUGIN_BEAT_TRACKER,
95 Z_VAMP_PLUGIN_FIXED_TEMPO_ESTIMATOR,
96} ZVampPluginType;
97
98typedef struct ZVampFeature
99{
111
121
129
138 size_t duration;
139
146 float * values;
147
148 size_t num_values;
149
153 char * label;
155
157{
166
171 char * name;
172
181
185 char * unit;
186
194
201
206 float minValue;
207
212 float maxValue;
213
218
231
238
239typedef struct ZVampOutputList
240{
241 GPtrArray * outputs;
243
244typedef struct ZVampFeatureList
245{
247 GPtrArray * list;
249
250typedef struct ZVampFeatureSet
251{
257 GPtrArray * set;
258
260 GArray * outputs;
262
266void
268
269const VampPluginDescriptor *
270vamp_get_simple_fixed_tempo_estimator_descriptor (void);
271
272ZVampPlugin *
273vamp_get_plugin (ZVampPluginType type, float samplerate);
274
275void
276vamp_plugin_initialize (
277 ZVampPlugin * plugin,
278 size_t channels,
279 size_t step_size,
280 size_t block_size);
281
285vamp_plugin_process (
286 ZVampPlugin * plugin,
287 const float * const * input_buffers,
288 long timestamp,
289 unsigned int samplerate);
290
292vamp_plugin_get_remaining_features (
293 ZVampPlugin * plugin,
294 unsigned int samplerate);
295
296size_t
297vamp_plugin_get_preferred_step_size (ZVampPlugin * plugin);
298
299size_t
300vamp_plugin_get_preferred_block_size (ZVampPlugin * plugin);
301
303vamp_plugin_get_output_descriptors (ZVampPlugin * plugin);
304
306vamp_output_descriptor_new (
307 const char * identifier,
308 const char * name,
309 const char * description,
310 const char * unit,
311 bool hasFixedBinCount,
312 bool hasKnownExtents,
313 float minValue,
314 float maxValue,
315 int sampleType,
316 float sampleRate,
317 bool hasDuration);
318
320vamp_feature_new (
321 bool has_timestamp,
322 long timestamp,
323 bool hasDuration,
324 size_t duration,
325 float * values,
326 size_t num_values,
327 const char * label);
328
329const ZVampFeatureList *
330vamp_feature_set_get_list_for_output (ZVampFeatureSet * self, int output_idx);
331
332void
333vamp_feature_list_print (const ZVampFeatureList * self);
334
335void
336vamp_feature_set_print (const ZVampFeatureSet * self);
337
338void
339vamp_feature_print (ZVampFeature * self);
340
341void
342vamp_plugin_output_print (ZVampOutputDescriptor * self);
343
344void
345vamp_plugin_output_list_print (ZVampOutputList * self);
346
347void
348vamp_feature_free (void * self);
349
350void
351vamp_feature_list_free (void * list);
352
353void
354vamp_output_descriptor_free (void * descr);
355
356void
357vamp_feature_set_free (ZVampFeatureSet * self);
358
359void
360vamp_plugin_output_list_free (ZVampOutputList * self);
361
366#ifdef __cplusplus
367}
368#endif
369
370#endif // __UTILS_VAMP_H__
void vamp_print_all(void)
Prints detected vamp plugins.
GPtrArray * list
Array of allocated ZVampFeature pointers.
Definition vamp.h:247
GArray * outputs
Array of output indices.
Definition vamp.h:260
GPtrArray * set
Contains pointers to ZVampFeatureList.
Definition vamp.h:257
char * label
Label for the sample of this feature.
Definition vamp.h:153
float * values
Results for a single sample of this feature.
Definition vamp.h:146
bool has_duration
True if an output feature has a specified duration.
Definition vamp.h:128
size_t duration
Duration of the output feature.
Definition vamp.h:138
bool has_timestamp
True if an output feature has its own timestamp.
Definition vamp.h:110
long timestamp
Timestamp of the output feature.
Definition vamp.h:120
char * identifier
The name of the output, in computer-usable form.
Definition vamp.h:165
bool hasKnownExtents
True if the results in each output bin fall within a fixed numeric range (minimum and maximum values)...
Definition vamp.h:200
float maxValue
Maximum value of the results in the output.
Definition vamp.h:212
float sampleRate
Sample rate of the output results, as samples per second.
Definition vamp.h:230
char * description
A human-readable short text describing the output.
Definition vamp.h:180
char * name
The human-readable name of the output.
Definition vamp.h:171
int sampleType
Positioning in time of the output results.
Definition vamp.h:217
bool hasFixedBinCount
True if the output has the same number of values per sample for every output sample.
Definition vamp.h:193
char * unit
The unit of the output, in human-readable form.
Definition vamp.h:185
float minValue
Minimum value of the results in the output.
Definition vamp.h:206
bool hasDuration
True if the returned results for this output are known to have a duration field.
Definition vamp.h:236