comparison layer/TimeInstantLayer.cpp @ 990:2d4d0dbb94e3 simple-fft-model

Merge from default branch
author Chris Cannam
date Wed, 07 Jan 2015 17:42:21 +0000
parents 3871dffc31bd
children 2adca8f05583
comparison
equal deleted inserted replaced
986:aef8f6fff278 990:2d4d0dbb94e3
160 // nearest to the given x coordinate, and that are within a 160 // nearest to the given x coordinate, and that are within a
161 // certain fuzz distance of that x coordinate. 161 // certain fuzz distance of that x coordinate.
162 162
163 if (!m_model) return SparseOneDimensionalModel::PointList(); 163 if (!m_model) return SparseOneDimensionalModel::PointList();
164 164
165 long frame = v->getFrameForX(x); 165 sv_frame_t frame = v->getFrameForX(x);
166 166
167 SparseOneDimensionalModel::PointList onPoints = 167 SparseOneDimensionalModel::PointList onPoints =
168 m_model->getPoints(frame); 168 m_model->getPoints(frame);
169 169
170 if (!onPoints.empty()) { 170 if (!onPoints.empty()) {
227 } else { 227 } else {
228 return tr("No local points"); 228 return tr("No local points");
229 } 229 }
230 } 230 }
231 231
232 long useFrame = points.begin()->frame; 232 sv_frame_t useFrame = points.begin()->frame;
233 233
234 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); 234 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate());
235 235
236 QString text; 236 QString text;
237 237
327 327
328 // Profiler profiler("TimeInstantLayer::paint", true); 328 // Profiler profiler("TimeInstantLayer::paint", true);
329 329
330 int x0 = rect.left(), x1 = rect.right(); 330 int x0 = rect.left(), x1 = rect.right();
331 331
332 long frame0 = v->getFrameForX(x0); 332 sv_frame_t frame0 = v->getFrameForX(x0);
333 long frame1 = v->getFrameForX(x1); 333 sv_frame_t frame1 = v->getFrameForX(x1);
334 334
335 SparseOneDimensionalModel::PointList points(m_model->getPoints 335 SparseOneDimensionalModel::PointList points(m_model->getPoints
336 (frame0, frame1)); 336 (frame0, frame1));
337 337
338 bool odd = false; 338 bool odd = false;
365 365
366 // SVDEBUG << "TimeInstantLayer::paint: resolution is " 366 // SVDEBUG << "TimeInstantLayer::paint: resolution is "
367 // << m_model->getResolution() << " frames" << endl; 367 // << m_model->getResolution() << " frames" << endl;
368 368
369 QPoint localPos; 369 QPoint localPos;
370 long illuminateFrame = -1; 370 sv_frame_t illuminateFrame = -1;
371 371
372 if (v->shouldIlluminateLocalFeatures(this, localPos)) { 372 if (v->shouldIlluminateLocalFeatures(this, localPos)) {
373 SparseOneDimensionalModel::PointList localPoints = 373 SparseOneDimensionalModel::PointList localPoints =
374 getLocalPoints(v, localPos.x()); 374 getLocalPoints(v, localPos.x());
375 if (!localPoints.empty()) illuminateFrame = localPoints.begin()->frame; 375 if (!localPoints.empty()) illuminateFrame = localPoints.begin()->frame;
472 cerr << "TimeInstantLayer::drawStart(" << e->x() << ")" << endl; 472 cerr << "TimeInstantLayer::drawStart(" << e->x() << ")" << endl;
473 #endif 473 #endif
474 474
475 if (!m_model) return; 475 if (!m_model) return;
476 476
477 long frame = v->getFrameForX(e->x()); 477 sv_frame_t frame = v->getFrameForX(e->x());
478 if (frame < 0) frame = 0; 478 if (frame < 0) frame = 0;
479 frame = frame / m_model->getResolution() * m_model->getResolution(); 479 frame = frame / m_model->getResolution() * m_model->getResolution();
480 480
481 m_editingPoint = SparseOneDimensionalModel::Point(frame, tr("New Point")); 481 m_editingPoint = SparseOneDimensionalModel::Point(frame, tr("New Point"));
482 482
495 cerr << "TimeInstantLayer::drawDrag(" << e->x() << ")" << endl; 495 cerr << "TimeInstantLayer::drawDrag(" << e->x() << ")" << endl;
496 #endif 496 #endif
497 497
498 if (!m_model || !m_editing) return; 498 if (!m_model || !m_editing) return;
499 499
500 long frame = v->getFrameForX(e->x()); 500 sv_frame_t frame = v->getFrameForX(e->x());
501 if (frame < 0) frame = 0; 501 if (frame < 0) frame = 0;
502 frame = frame / m_model->getResolution() * m_model->getResolution(); 502 frame = frame / m_model->getResolution() * m_model->getResolution();
503 m_editingCommand->deletePoint(m_editingPoint); 503 m_editingCommand->deletePoint(m_editingPoint);
504 m_editingPoint.frame = frame; 504 m_editingPoint.frame = frame;
505 m_editingCommand->addPoint(m_editingPoint); 505 m_editingCommand->addPoint(m_editingPoint);
595 cerr << "TimeInstantLayer::editDrag(" << e->x() << ")" << endl; 595 cerr << "TimeInstantLayer::editDrag(" << e->x() << ")" << endl;
596 #endif 596 #endif
597 597
598 if (!m_model || !m_editing) return; 598 if (!m_model || !m_editing) return;
599 599
600 long frame = v->getFrameForX(e->x()); 600 sv_frame_t frame = v->getFrameForX(e->x());
601 if (frame < 0) frame = 0; 601 if (frame < 0) frame = 0;
602 frame = frame / m_model->getResolution() * m_model->getResolution(); 602 frame = frame / m_model->getResolution() * m_model->getResolution();
603 603
604 if (!m_editingCommand) { 604 if (!m_editingCommand) {
605 m_editingCommand = new SparseOneDimensionalModel::EditCommand(m_model, 605 m_editingCommand = new SparseOneDimensionalModel::EditCommand(m_model,