comparison layer/NoteLayer.cpp @ 682:1a0dfcbffaf1

Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author Chris Cannam
date Tue, 26 Nov 2013 14:06:40 +0000
parents 2727bc3aab59
children 917039d333bb 4dcf10bd2863
comparison
equal deleted inserted replaced
681:eaf4446a1bef 682:1a0dfcbffaf1
235 min = Pitch::getFrequencyForPitch(lrintf(min)); 235 min = Pitch::getFrequencyForPitch(lrintf(min));
236 max = Pitch::getFrequencyForPitch(lrintf(max + 1)); 236 max = Pitch::getFrequencyForPitch(lrintf(max + 1));
237 } 237 }
238 238
239 #ifdef DEBUG_NOTE_LAYER 239 #ifdef DEBUG_NOTE_LAYER
240 std::cerr << "NoteLayer::getDisplayExtents: min = " << min << ", max = " << max << " (m_scaleMinimum = " << m_scaleMinimum << ", m_scaleMaximum = " << m_scaleMaximum << ")" << std::endl; 240 cerr << "NoteLayer::getDisplayExtents: min = " << min << ", max = " << max << " (m_scaleMinimum = " << m_scaleMinimum << ", m_scaleMaximum = " << m_scaleMaximum << ")" << endl;
241 #endif 241 #endif
242 242
243 return true; 243 return true;
244 } 244 }
245 245
258 258
259 m_scaleMinimum = min; 259 m_scaleMinimum = min;
260 m_scaleMaximum = max; 260 m_scaleMaximum = max;
261 261
262 #ifdef DEBUG_NOTE_LAYER 262 #ifdef DEBUG_NOTE_LAYER
263 std::cerr << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << std::endl; 263 cerr << "NoteLayer::setDisplayExtents: min = " << min << ", max = " << max << endl;
264 #endif 264 #endif
265 265
266 emit layerParametersChanged(); 266 emit layerParametersChanged();
267 return true; 267 return true;
268 } 268 }
324 // see SpectrogramLayer::setVerticalZoomStep 324 // see SpectrogramLayer::setVerticalZoomStep
325 325
326 newmax = (newdist + sqrtf(newdist*newdist + 4*dmin*dmax)) / 2; 326 newmax = (newdist + sqrtf(newdist*newdist + 4*dmin*dmax)) / 2;
327 newmin = newmax - newdist; 327 newmin = newmax - newdist;
328 328
329 // std::cerr << "newmin = " << newmin << ", newmax = " << newmax << std::endl; 329 // cerr << "newmin = " << newmin << ", newmax = " << newmax << endl;
330 330
331 } else { 331 } else {
332 float dmid = (dmax + dmin) / 2; 332 float dmid = (dmax + dmin) / 2;
333 newmin = dmid - newdist / 2; 333 newmin = dmid - newdist / 2;
334 newmax = dmid + newdist / 2; 334 newmax = dmid + newdist / 2;
341 if (newmax > max) { 341 if (newmax > max) {
342 newmax = max; 342 newmax = max;
343 } 343 }
344 344
345 #ifdef DEBUG_NOTE_LAYER 345 #ifdef DEBUG_NOTE_LAYER
346 std::cerr << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << std::endl; 346 cerr << "NoteLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << endl;
347 #endif 347 #endif
348 348
349 setDisplayExtents(newmin, newmax); 349 setDisplayExtents(newmin, newmax);
350 } 350 }
351 351
423 long frame = v->getFrameForX(x); 423 long frame = v->getFrameForX(x);
424 424
425 NoteModel::PointList onPoints = m_model->getPoints(frame); 425 NoteModel::PointList onPoints = m_model->getPoints(frame);
426 if (onPoints.empty()) return false; 426 if (onPoints.empty()) return false;
427 427
428 // std::cerr << "frame " << frame << ": " << onPoints.size() << " candidate points" << std::endl; 428 // cerr << "frame " << frame << ": " << onPoints.size() << " candidate points" << endl;
429 429
430 int nearestDistance = -1; 430 int nearestDistance = -1;
431 431
432 for (NoteModel::PointList::const_iterator i = onPoints.begin(); 432 for (NoteModel::PointList::const_iterator i = onPoints.begin();
433 i != onPoints.end(); ++i) { 433 i != onPoints.end(); ++i) {
624 min = Pitch::getFrequencyForPitch(lrintf(min)); 624 min = Pitch::getFrequencyForPitch(lrintf(min));
625 max = Pitch::getFrequencyForPitch(lrintf(max + 1)); 625 max = Pitch::getFrequencyForPitch(lrintf(max + 1));
626 } 626 }
627 627
628 #ifdef DEBUG_NOTE_LAYER 628 #ifdef DEBUG_NOTE_LAYER
629 std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl; 629 cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << endl;
630 #endif 630 #endif
631 631
632 } else if (log) { 632 } else if (log) {
633 633
634 LogRange::mapRange(min, max); 634 LogRange::mapRange(min, max);
635 635
636 #ifdef DEBUG_NOTE_LAYER 636 #ifdef DEBUG_NOTE_LAYER
637 std::cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl; 637 cerr << "NoteLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << endl;
638 #endif 638 #endif
639 639
640 } 640 }
641 641
642 } else { 642 } else {
668 int h = v->height(); 668 int h = v->height();
669 669
670 getScaleExtents(v, min, max, logarithmic); 670 getScaleExtents(v, min, max, logarithmic);
671 671
672 #ifdef DEBUG_NOTE_LAYER 672 #ifdef DEBUG_NOTE_LAYER
673 std::cerr << "NoteLayer[" << this << "]::getYForValue(" << val << "): min = " << min << ", max = " << max << ", log = " << logarithmic << std::endl; 673 cerr << "NoteLayer[" << this << "]::getYForValue(" << val << "): min = " << min << ", max = " << max << ", log = " << logarithmic << endl;
674 #endif 674 #endif
675 675
676 if (shouldConvertMIDIToHz()) { 676 if (shouldConvertMIDIToHz()) {
677 val = Pitch::getFrequencyForPitch(lrintf(val), 677 val = Pitch::getFrequencyForPitch(lrintf(val),
678 lrintf((val - lrintf(val)) * 100)); 678 lrintf((val - lrintf(val)) * 100));
679 #ifdef DEBUG_NOTE_LAYER 679 #ifdef DEBUG_NOTE_LAYER
680 std::cerr << "shouldConvertMIDIToHz true, val now = " << val << std::endl; 680 cerr << "shouldConvertMIDIToHz true, val now = " << val << endl;
681 #endif 681 #endif
682 } 682 }
683 683
684 if (logarithmic) { 684 if (logarithmic) {
685 val = LogRange::map(val); 685 val = LogRange::map(val);
686 #ifdef DEBUG_NOTE_LAYER 686 #ifdef DEBUG_NOTE_LAYER
687 std::cerr << "logarithmic true, val now = " << val << std::endl; 687 cerr << "logarithmic true, val now = " << val << endl;
688 #endif 688 #endif
689 } 689 }
690 690
691 int y = int(h - ((val - min) * h) / (max - min)) - 1; 691 int y = int(h - ((val - min) * h) / (max - min)) - 1;
692 #ifdef DEBUG_NOTE_LAYER 692 #ifdef DEBUG_NOTE_LAYER
693 std::cerr << "y = " << y << std::endl; 693 cerr << "y = " << y << endl;
694 #endif 694 #endif
695 return y; 695 return y;
696 } 696 }
697 697
698 float 698 float