comparison MatchVampPlugin.cpp @ 32:37c0b59fd514

Expose smooth parameter through plugin
author Chris Cannam
date Fri, 31 Oct 2014 16:36:19 +0000
parents 1ff9ae1dcb50
children
comparison
equal deleted inserted replaced
31:1ff9ae1dcb50 32:37c0b59fd514
53 m_stepTime(defaultStepTime), 53 m_stepTime(defaultStepTime),
54 m_blockSize(2048), 54 m_blockSize(2048),
55 m_serialise(false), 55 m_serialise(false),
56 m_begin(true), 56 m_begin(true),
57 m_locked(false), 57 m_locked(false),
58 m_smooth(true),
58 m_params(inputSampleRate, defaultStepTime, m_blockSize), 59 m_params(inputSampleRate, defaultStepTime, m_blockSize),
59 m_defaultParams(inputSampleRate, defaultStepTime, m_blockSize) 60 m_defaultParams(inputSampleRate, defaultStepTime, m_blockSize)
60 { 61 {
61 if (inputSampleRate < sampleRateMin) { 62 if (inputSampleRate < sampleRateMin) {
62 std::cerr << "MatchVampPlugin::MatchVampPlugin: input sample rate " 63 std::cerr << "MatchVampPlugin::MatchVampPlugin: input sample rate "
218 desc.maxValue = 60; 219 desc.maxValue = 60;
219 desc.defaultValue = m_defaultParams.blockTime; 220 desc.defaultValue = m_defaultParams.blockTime;
220 desc.isQuantized = true; 221 desc.isQuantized = true;
221 desc.quantizeStep = 1; 222 desc.quantizeStep = 1;
222 desc.unit = "s"; 223 desc.unit = "s";
224 list.push_back(desc);
225
226 desc.identifier = "smooth";
227 desc.name = "Smooth Path";
228 desc.description = "Smooth the path by replacing steps with diagonals";
229 desc.minValue = 0;
230 desc.maxValue = 1;
231 desc.defaultValue = 1;
232 desc.isQuantized = true;
233 desc.quantizeStep = 1;
234 desc.unit = "";
223 list.push_back(desc); 235 list.push_back(desc);
224 236
225 return list; 237 return list;
226 } 238 }
227 239
240 return m_params.useChromaFrequencyMap ? 1.0 : 0.0; 252 return m_params.useChromaFrequencyMap ? 1.0 : 0.0;
241 } else if (name == "gradientlimit") { 253 } else if (name == "gradientlimit") {
242 return m_params.maxRunCount; 254 return m_params.maxRunCount;
243 } else if (name == "zonewidth") { 255 } else if (name == "zonewidth") {
244 return m_params.blockTime; 256 return m_params.blockTime;
257 } else if (name == "smooth") {
258 return m_smooth ? 1.0 : 0.0;
245 } 259 }
246 260
247 return 0.0; 261 return 0.0;
248 } 262 }
249 263
262 m_params.useChromaFrequencyMap = (value > 0.5); 276 m_params.useChromaFrequencyMap = (value > 0.5);
263 } else if (name == "gradientlimit") { 277 } else if (name == "gradientlimit") {
264 m_params.maxRunCount = int(value + 0.1); 278 m_params.maxRunCount = int(value + 0.1);
265 } else if (name == "zonewidth") { 279 } else if (name == "zonewidth") {
266 m_params.blockTime = value; 280 m_params.blockTime = value;
281 } else if (name == "smooth") {
282 m_smooth = (value > 0.5);
267 } 283 }
268 } 284 }
269 285
270 size_t 286 size_t
271 MatchVampPlugin::getPreferredStepSize() const 287 MatchVampPlugin::getPreferredStepSize() const
485 MatchVampPlugin::getRemainingFeatures() 501 MatchVampPlugin::getRemainingFeatures()
486 { 502 {
487 Finder *finder = feeder->getFinder(); 503 Finder *finder = feeder->getFinder();
488 std::vector<int> pathx; 504 std::vector<int> pathx;
489 std::vector<int> pathy; 505 std::vector<int> pathy;
490 int len = finder->retrievePath(true, pathx, pathy); 506 int len = finder->retrievePath(m_smooth, pathx, pathy);
491 507
492 FeatureSet returnFeatures; 508 FeatureSet returnFeatures;
493 509
494 int prevx = 0; 510 int prevx = 0;
495 int prevy = 0; 511 int prevy = 0;