comparison vamp-sdk/PluginHostAdapter.cpp @ 168:006a775133b1

* Re-do the way the v2 structure (with durations) is returned. I bungled backward compatibility -- I failed to spot the contiguous array returned from process()... duh. Also bump library versions.
author cannam
date Thu, 24 Jul 2008 16:50:11 +0000
parents 31eda4b11f2b
children d4fbd4e6fdbf
comparison
equal deleted inserted replaced
167:31eda4b11f2b 168:006a775133b1
394 VampFeatureList &list = features[i]; 394 VampFeatureList &list = features[i];
395 395
396 if (list.featureCount > 0) { 396 if (list.featureCount > 0) {
397 397
398 Feature feature; 398 Feature feature;
399 feature.values.reserve(list.features[0].valueCount); 399 feature.values.reserve(list.features[0].v1.valueCount);
400 400
401 for (unsigned int j = 0; j < list.featureCount; ++j) { 401 for (unsigned int j = 0; j < list.featureCount; ++j) {
402 402
403 feature.hasTimestamp = list.features[j].hasTimestamp; 403 feature.hasTimestamp = list.features[j].v1.hasTimestamp;
404 feature.timestamp = RealTime(list.features[j].sec, 404 feature.timestamp = RealTime(list.features[j].v1.sec,
405 list.features[j].nsec); 405 list.features[j].v1.nsec);
406 feature.hasDuration = false;
406 407
407 if (m_descriptor->vampApiVersion >= 2) { 408 if (m_descriptor->vampApiVersion >= 2) {
408 feature.hasDuration = list.featuresV2[j].hasDuration; 409 unsigned int j2 = j + list.featureCount;
409 feature.duration = RealTime(list.featuresV2[j].durationSec, 410 feature.hasDuration = list.features[j2].v2.hasDuration;
410 list.featuresV2[j].durationNsec); 411 feature.duration = RealTime(list.features[j2].v2.durationSec,
411 } else { 412 list.features[j2].v2.durationNsec);
412 feature.hasDuration = false;
413 } 413 }
414 414
415 for (unsigned int k = 0; k < list.features[j].valueCount; ++k) { 415 for (unsigned int k = 0; k < list.features[j].v1.valueCount; ++k) {
416 feature.values.push_back(list.features[j].values[k]); 416 feature.values.push_back(list.features[j].v1.values[k]);
417 } 417 }
418 418
419 if (list.features[j].label) { 419 if (list.features[j].v1.label) {
420 feature.label = list.features[j].label; 420 feature.label = list.features[j].v1.label;
421 } 421 }
422 422
423 fs[i].push_back(feature); 423 fs[i].push_back(feature);
424 424
425 if (list.features[j].valueCount > 0) { 425 if (list.features[j].v1.valueCount > 0) {
426 feature.values.clear(); 426 feature.values.clear();
427 } 427 }
428 428
429 if (list.features[j].label) { 429 if (list.features[j].v1.label) {
430 feature.label = ""; 430 feature.label = "";
431 } 431 }
432 } 432 }
433 } 433 }
434 } 434 }