comparison layer/FlexiNoteLayer.cpp @ 1429:8a7c82282fbc single-point

Update TimeValueLayer etc
author Chris Cannam
date Tue, 19 Mar 2019 13:06:35 +0000
parents f792a5001d80
children 11a150e65ee1
comparison
equal deleted inserted replaced
1428:c9fa16e41664 1429:8a7c82282fbc
1449 SparseTimeValueModel *model = getAssociatedPitchModel(v); 1449 SparseTimeValueModel *model = getAssociatedPitchModel(v);
1450 if (!model) return false; 1450 if (!model) return false;
1451 1451
1452 std::cerr << model->getTypeName() << std::endl; 1452 std::cerr << model->getTypeName() << std::endl;
1453 1453
1454 SparseModel<TimeValuePoint>::PointList dataPoints = 1454 EventVector dataPoints =
1455 model->getPoints(note.getFrame(), note.getFrame() + note.getDuration()); 1455 model->getEventsWithin(note.getFrame(), note.getDuration());
1456 1456
1457 std::cerr << "frame " << note.getFrame() << ": " << dataPoints.size() << " candidate points" << std::endl; 1457 std::cerr << "frame " << note.getFrame() << ": " << dataPoints.size() << " candidate points" << std::endl;
1458 1458
1459 if (dataPoints.empty()) return false; 1459 if (dataPoints.empty()) return false;
1460 1460
1461 std::vector<double> pitchValues; 1461 std::vector<double> pitchValues;
1462 1462
1463 for (SparseModel<TimeValuePoint>::PointList::const_iterator i = 1463 for (EventVector::const_iterator i =
1464 dataPoints.begin(); i != dataPoints.end(); ++i) { 1464 dataPoints.begin(); i != dataPoints.end(); ++i) {
1465 if (i->frame >= note.getFrame() && 1465 pitchValues.push_back(i->getValue());
1466 i->frame < note.getFrame() + note.getDuration()) {
1467 pitchValues.push_back(i->value);
1468 }
1469 } 1466 }
1470 1467
1471 if (pitchValues.empty()) return false; 1468 if (pitchValues.empty()) return false;
1472 1469
1473 sort(pitchValues.begin(), pitchValues.end()); 1470 sort(pitchValues.begin(), pitchValues.end());