Mercurial > hg > vamp-plugin-sdk
comparison examples/PercussionOnsetDetector.cpp @ 49:aa64a46320d4
* Rename "name" and "description" to "identifier" and "name"; add new
"description" that actually contains a description
author | cannam |
---|---|
date | Mon, 26 Feb 2007 18:08:48 +0000 |
parents | be8fdfe25693 |
children | c8b48bc6db3d |
comparison
equal
deleted
inserted
replaced
48:f46bf5e0fa42 | 49:aa64a46320d4 |
---|---|
60 { | 60 { |
61 delete[] m_priorMagnitudes; | 61 delete[] m_priorMagnitudes; |
62 } | 62 } |
63 | 63 |
64 string | 64 string |
65 PercussionOnsetDetector::getIdentifier() const | |
66 { | |
67 return "percussiononsets"; | |
68 } | |
69 | |
70 string | |
65 PercussionOnsetDetector::getName() const | 71 PercussionOnsetDetector::getName() const |
66 { | 72 { |
67 return "percussiononsets"; | 73 return "Simple Percussion Onset Detector"; |
68 } | 74 } |
69 | 75 |
70 string | 76 string |
71 PercussionOnsetDetector::getDescription() const | 77 PercussionOnsetDetector::getDescription() const |
72 { | 78 { |
73 return "Simple Percussion Onset Detector"; | 79 return "Detect percussive note onsets by identifying broadband energy rises"; |
74 } | 80 } |
75 | 81 |
76 string | 82 string |
77 PercussionOnsetDetector::getMaker() const | 83 PercussionOnsetDetector::getMaker() const |
78 { | 84 { |
139 PercussionOnsetDetector::getParameterDescriptors() const | 145 PercussionOnsetDetector::getParameterDescriptors() const |
140 { | 146 { |
141 ParameterList list; | 147 ParameterList list; |
142 | 148 |
143 ParameterDescriptor d; | 149 ParameterDescriptor d; |
144 d.name = "threshold"; | 150 d.identifier = "threshold"; |
145 d.description = "Broadband energy rise threshold"; | 151 d.name = "Energy rise threshold"; |
152 d.description = "Energy rise within a frequency bin necessary to count toward broadband total"; | |
146 d.unit = "dB"; | 153 d.unit = "dB"; |
147 d.minValue = 0; | 154 d.minValue = 0; |
148 d.maxValue = 20; | 155 d.maxValue = 20; |
149 d.defaultValue = 3; | 156 d.defaultValue = 3; |
150 d.isQuantized = false; | 157 d.isQuantized = false; |
151 list.push_back(d); | 158 list.push_back(d); |
152 | 159 |
153 d.name = "sensitivity"; | 160 d.identifier = "sensitivity"; |
154 d.description = "Peak detection sensitivity"; | 161 d.name = "Sensitivity"; |
162 d.description = "Sensitivity of peak detector applied to broadband detection function"; | |
155 d.unit = "%"; | 163 d.unit = "%"; |
156 d.minValue = 0; | 164 d.minValue = 0; |
157 d.maxValue = 100; | 165 d.maxValue = 100; |
158 d.defaultValue = 40; | 166 d.defaultValue = 40; |
159 d.isQuantized = false; | 167 d.isQuantized = false; |
161 | 169 |
162 return list; | 170 return list; |
163 } | 171 } |
164 | 172 |
165 float | 173 float |
166 PercussionOnsetDetector::getParameter(std::string name) const | 174 PercussionOnsetDetector::getParameter(std::string id) const |
167 { | 175 { |
168 if (name == "threshold") return m_threshold; | 176 if (id == "threshold") return m_threshold; |
169 if (name == "sensitivity") return m_sensitivity; | 177 if (id == "sensitivity") return m_sensitivity; |
170 return 0.f; | 178 return 0.f; |
171 } | 179 } |
172 | 180 |
173 void | 181 void |
174 PercussionOnsetDetector::setParameter(std::string name, float value) | 182 PercussionOnsetDetector::setParameter(std::string id, float value) |
175 { | 183 { |
176 if (name == "threshold") { | 184 if (id == "threshold") { |
177 if (value < 0) value = 0; | 185 if (value < 0) value = 0; |
178 if (value > 20) value = 20; | 186 if (value > 20) value = 20; |
179 m_threshold = value; | 187 m_threshold = value; |
180 } else if (name == "sensitivity") { | 188 } else if (id == "sensitivity") { |
181 if (value < 0) value = 0; | 189 if (value < 0) value = 0; |
182 if (value > 100) value = 100; | 190 if (value > 100) value = 100; |
183 m_sensitivity = value; | 191 m_sensitivity = value; |
184 } | 192 } |
185 } | 193 } |
188 PercussionOnsetDetector::getOutputDescriptors() const | 196 PercussionOnsetDetector::getOutputDescriptors() const |
189 { | 197 { |
190 OutputList list; | 198 OutputList list; |
191 | 199 |
192 OutputDescriptor d; | 200 OutputDescriptor d; |
193 d.name = "onsets"; | 201 d.identifier = "onsets"; |
202 d.name = "Onsets"; | |
203 d.description = "Percussive note onset locations"; | |
194 d.unit = ""; | 204 d.unit = ""; |
195 d.description = "Onsets"; | |
196 d.hasFixedBinCount = true; | 205 d.hasFixedBinCount = true; |
197 d.binCount = 0; | 206 d.binCount = 0; |
198 d.hasKnownExtents = false; | 207 d.hasKnownExtents = false; |
199 d.isQuantized = false; | 208 d.isQuantized = false; |
200 d.sampleType = OutputDescriptor::VariableSampleRate; | 209 d.sampleType = OutputDescriptor::VariableSampleRate; |
201 d.sampleRate = m_inputSampleRate; | 210 d.sampleRate = m_inputSampleRate; |
202 list.push_back(d); | 211 list.push_back(d); |
203 | 212 |
204 d.name = "detectionfunction"; | 213 d.identifier = "detectionfunction"; |
205 d.description = "Onset Detection Function"; | 214 d.name = "Detection Function"; |
215 d.description = "Broadband energy rise detection function"; | |
206 d.binCount = 1; | 216 d.binCount = 1; |
207 d.isQuantized = true; | 217 d.isQuantized = true; |
208 d.quantizeStep = 1.0; | 218 d.quantizeStep = 1.0; |
209 d.sampleType = OutputDescriptor::OneSamplePerStep; | 219 d.sampleType = OutputDescriptor::OneSamplePerStep; |
210 list.push_back(d); | 220 list.push_back(d); |