comparison layer/FlexiNoteLayer.cpp @ 748:84e4cf889659 tonioni

Make pitch-track editing operations update the notes as well, automatically
author Chris Cannam
date Thu, 27 Mar 2014 18:02:12 +0000
parents bc049f1f080e
children 03423269a9d0
comparison
equal deleted inserted replaced
747:bc049f1f080e 748:84e4cf889659
1299 1299
1300 cerr << "FlexiNoteLayer::getAssociatedPitchModel()" << endl; 1300 cerr << "FlexiNoteLayer::getAssociatedPitchModel()" << endl;
1301 1301
1302 for (int i = 0; i < v->getLayerCount(); ++i) { 1302 for (int i = 0; i < v->getLayerCount(); ++i) {
1303 Layer *layer = v->getLayer(i); 1303 Layer *layer = v->getLayer(i);
1304 if (layer && !layer->isLayerDormant(v)) { 1304 if (layer && !layer->isLayerDormant(v) &&
1305 layer->getLayerPresentationName() != "candidate") {
1305 cerr << "FlexiNoteLayer::getAssociatedPitchModel: looks like our layer is " << layer << endl; 1306 cerr << "FlexiNoteLayer::getAssociatedPitchModel: looks like our layer is " << layer << endl;
1306 SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *> 1307 SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *>
1307 (layer->getModel()); 1308 (layer->getModel());
1308 cerr << "FlexiNoteLayer::getAssociatedPitchModel: and its model is " << model << endl; 1309 cerr << "FlexiNoteLayer::getAssociatedPitchModel: and its model is " << model << endl;
1309 if (model && model->getScaleUnits() == "Hz") { 1310 if (model && model->getScaleUnits() == "Hz") {
1333 1334
1334 FlexiNote note(*i); 1335 FlexiNote note(*i);
1335 1336
1336 cerr << "snapSelectedNotesToPitchTrack: looking at note from " << note.frame << " to " << note.frame + note.duration << endl; 1337 cerr << "snapSelectedNotesToPitchTrack: looking at note from " << note.frame << " to " << note.frame + note.duration << endl;
1337 1338
1338 if (!s.contains(note.frame) || 1339 if (!s.contains(note.frame) &&
1339 !s.contains(note.frame + note.duration - 1)) { 1340 !s.contains(note.frame + note.duration - 1)) {
1340 continue; 1341 continue;
1341 } 1342 }
1342 1343
1343 FlexiNote newNote(note); 1344 FlexiNote newNote(note);
1403 1404
1404 for (SparseModel<TimeValuePoint>::PointList::const_iterator i = 1405 for (SparseModel<TimeValuePoint>::PointList::const_iterator i =
1405 dataPoints.begin(); i != dataPoints.end(); ++i) { 1406 dataPoints.begin(); i != dataPoints.end(); ++i) {
1406 if (i->frame >= note.frame && 1407 if (i->frame >= note.frame &&
1407 i->frame < note.frame + note.duration) { 1408 i->frame < note.frame + note.duration) {
1408 pitchValues.push_back((*i).value); 1409 pitchValues.push_back(i->value);
1409 } 1410 }
1410 } 1411 }
1411 1412
1412 if (pitchValues.empty()) return false; 1413 if (pitchValues.empty()) return false;
1413 1414