Chris@37
|
1 /*
|
Chris@37
|
2 jVamp
|
Chris@37
|
3
|
Chris@37
|
4 A Java host interface for Vamp audio analysis plugins
|
Chris@37
|
5
|
Chris@37
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@37
|
7 Copyright 2012 Chris Cannam and QMUL.
|
Chris@37
|
8
|
Chris@37
|
9 Permission is hereby granted, free of charge, to any person
|
Chris@37
|
10 obtaining a copy of this software and associated documentation
|
Chris@37
|
11 files (the "Software"), to deal in the Software without
|
Chris@37
|
12 restriction, including without limitation the rights to use, copy,
|
Chris@37
|
13 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@37
|
14 of the Software, and to permit persons to whom the Software is
|
Chris@37
|
15 furnished to do so, subject to the following conditions:
|
Chris@37
|
16
|
Chris@37
|
17 The above copyright notice and this permission notice shall be
|
Chris@37
|
18 included in all copies or substantial portions of the Software.
|
Chris@37
|
19
|
Chris@37
|
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@37
|
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@37
|
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@37
|
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@37
|
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@37
|
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@37
|
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@37
|
27
|
Chris@37
|
28 Except as contained in this notice, the names of the Centre for
|
Chris@37
|
29 Digital Music; Queen Mary, University of London; and Chris Cannam
|
Chris@37
|
30 shall not be used in advertising or otherwise to promote the sale,
|
Chris@37
|
31 use or other dealings in this Software without prior written
|
Chris@37
|
32 authorization.
|
Chris@37
|
33 */
|
Chris@2
|
34
|
Chris@2
|
35 package org.vamp_plugins;
|
Chris@2
|
36
|
Chris@28
|
37 /**
|
Chris@28
|
38 * OutputDescriptor describes the properties of an output of a Vamp
|
Chris@28
|
39 * plugin. Returned by e.g. Plugin.getOutputDescriptors().
|
Chris@28
|
40 */
|
Chris@2
|
41 public class OutputDescriptor {
|
Chris@28
|
42
|
Chris@28
|
43 /**
|
Chris@28
|
44 * The name of the output, in computer-usable form. Will contain
|
Chris@28
|
45 * the characters [a-zA-Z0-9_-] only.
|
Chris@28
|
46 */
|
Chris@2
|
47 public String identifier;
|
Chris@28
|
48
|
Chris@28
|
49 /**
|
Chris@28
|
50 * The human-readable name of the output.
|
Chris@28
|
51 */
|
Chris@2
|
52 public String name;
|
Chris@28
|
53
|
Chris@28
|
54 /**
|
Chris@28
|
55 * A human-readable short text describing the output. May be
|
Chris@28
|
56 * empty if the name has said it all already.
|
Chris@28
|
57 */
|
Chris@2
|
58 public String description;
|
Chris@28
|
59
|
Chris@28
|
60 /**
|
Chris@28
|
61 * The unit of the output, in human-readable form.
|
Chris@28
|
62 */
|
Chris@2
|
63 public String unit;
|
Chris@28
|
64
|
Chris@28
|
65 /**
|
Chris@28
|
66 * True if the output has the same number of values per sample
|
Chris@28
|
67 * for every output sample.
|
Chris@28
|
68 */
|
Chris@2
|
69 public boolean hasFixedBinCount;
|
Chris@28
|
70
|
Chris@28
|
71 /**
|
Chris@28
|
72 * The number of values per result of the output. Undefined
|
Chris@28
|
73 * if hasFixedBinCount is false. If this is zero, the output
|
Chris@28
|
74 * is point data (i.e. only the time of each output is of
|
Chris@28
|
75 * interest, the value list will be empty).
|
Chris@28
|
76 */
|
Chris@2
|
77 public int binCount;
|
Chris@28
|
78
|
Chris@28
|
79 /**
|
Chris@28
|
80 * The (human-readable) names of each of the bins, if
|
Chris@28
|
81 * appropriate. This is always optional.
|
Chris@28
|
82 */
|
Chris@2
|
83 public String[] binNames;
|
Chris@28
|
84
|
Chris@28
|
85 /**
|
Chris@28
|
86 * True if the results in each output bin fall within a fixed
|
Chris@28
|
87 * numeric range (minimum and maximum values). Undefined if
|
Chris@28
|
88 * binCount is zero.
|
Chris@28
|
89 */
|
Chris@2
|
90 public boolean hasKnownExtents;
|
Chris@28
|
91
|
Chris@28
|
92 /**
|
Chris@28
|
93 * Minimum value of the results in the output. Undefined if
|
Chris@28
|
94 * hasKnownExtents is false or binCount is zero.
|
Chris@28
|
95 */
|
Chris@2
|
96 public float minValue;
|
Chris@28
|
97
|
Chris@28
|
98 /**
|
Chris@28
|
99 * Maximum value of the results in the output. Undefined if
|
Chris@28
|
100 * hasKnownExtents is false or binCount is zero.
|
Chris@28
|
101 */
|
Chris@2
|
102 public float maxValue;
|
Chris@28
|
103
|
Chris@28
|
104 /**
|
Chris@28
|
105 * True if the output values are quantized to a particular
|
Chris@28
|
106 * resolution. Undefined if binCount is zero.
|
Chris@28
|
107 */
|
Chris@2
|
108 public boolean isQuantized;
|
Chris@28
|
109
|
Chris@28
|
110 /**
|
Chris@28
|
111 * Quantization resolution of the output values (e.g. 1.0 if
|
Chris@28
|
112 * they are all integers). Undefined if isQuantized is false
|
Chris@28
|
113 * or binCount is zero.
|
Chris@28
|
114 */
|
Chris@2
|
115 public float quantizeStep;
|
Chris@28
|
116
|
Chris@2
|
117 public static enum SampleType {
|
Chris@28
|
118 /// Results from each process() align with that call's block start
|
Chris@28
|
119 OneSamplePerStep,
|
Chris@28
|
120
|
Chris@28
|
121 /// Results are evenly spaced in time (sampleRate specified below)
|
Chris@28
|
122 FixedSampleRate,
|
Chris@28
|
123
|
Chris@28
|
124 /// Results are unevenly spaced and have individual timestamps
|
Chris@28
|
125 VariableSampleRate
|
Chris@2
|
126 };
|
Chris@28
|
127
|
Chris@28
|
128 /**
|
Chris@28
|
129 * Positioning in time of the output results.
|
Chris@28
|
130 */
|
Chris@2
|
131 public SampleType sampleType;
|
Chris@28
|
132
|
Chris@28
|
133 /**
|
Chris@28
|
134 * Sample rate of the output results, as samples per second.
|
Chris@28
|
135 * Undefined if sampleType is OneSamplePerStep.
|
Chris@28
|
136 *
|
Chris@28
|
137 * If sampleType is VariableSampleRate and this value is
|
Chris@28
|
138 * non-zero, then it may be used to calculate a resolution for
|
Chris@28
|
139 * the output (i.e. the "duration" of each sample, in time,
|
Chris@28
|
140 * will be 1/sampleRate seconds). It's recommended to set
|
Chris@28
|
141 * this to zero if that behaviour is not desired.
|
Chris@28
|
142 */
|
Chris@2
|
143 public float sampleRate;
|
Chris@28
|
144
|
Chris@28
|
145 /**
|
Chris@28
|
146 * True if the returned results for this output are known to
|
Chris@28
|
147 * have a duration field.
|
Chris@28
|
148 */
|
Chris@2
|
149 public boolean hasDuration;
|
Chris@2
|
150
|
Chris@2
|
151 OutputDescriptor() {
|
Chris@2
|
152 hasFixedBinCount = false;
|
Chris@2
|
153 hasKnownExtents = false;
|
Chris@2
|
154 isQuantized = false;
|
Chris@2
|
155 sampleType = SampleType.OneSamplePerStep;
|
Chris@2
|
156 hasDuration = false;
|
Chris@2
|
157 }
|
Chris@3
|
158 }
|