comparison layer/WaveformLayer.cpp @ 585:f4960f8ce798 debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:25 +0100
parents 590b899b7e45
children 4806715f7a19
comparison
equal deleted inserted replaced
584:1fe7951a61e8 585:f4960f8ce798
286 } 286 }
287 287
288 void 288 void
289 WaveformLayer::setChannel(int channel) 289 WaveformLayer::setChannel(int channel)
290 { 290 {
291 // std::cerr << "WaveformLayer::setChannel(" << channel << ")" << std::endl; 291 // DEBUG << "WaveformLayer::setChannel(" << channel << ")" << endl;
292 292
293 if (m_channel == channel) return; 293 if (m_channel == channel) return;
294 m_channel = channel; 294 m_channel = channel;
295 m_cacheValid = false; 295 m_cacheValid = false;
296 emit layerParametersChanged(); 296 emit layerParametersChanged();
380 } 380 }
381 381
382 merging = (m_channelMode == MergeChannels && rawChannels > 1); 382 merging = (m_channelMode == MergeChannels && rawChannels > 1);
383 mixing = (m_channelMode == MixChannels && rawChannels > 1); 383 mixing = (m_channelMode == MixChannels && rawChannels > 1);
384 384
385 // std::cerr << "WaveformLayer::getChannelArrangement: min " << min << ", max " << max << ", merging " << merging << ", channels " << channels << std::endl; 385 // DEBUG << "WaveformLayer::getChannelArrangement: min " << min << ", max " << max << ", merging " << merging << ", channels " << channels << endl;
386 386
387 return channels; 387 return channels;
388 } 388 }
389 389
390 bool 390 bool
472 472
473 int zoomLevel = v->getZoomLevel(); 473 int zoomLevel = v->getZoomLevel();
474 474
475 #ifdef DEBUG_WAVEFORM_PAINT 475 #ifdef DEBUG_WAVEFORM_PAINT
476 Profiler profiler("WaveformLayer::paint", true); 476 Profiler profiler("WaveformLayer::paint", true);
477 std::cerr << "WaveformLayer::paint (" << rect.x() << "," << rect.y() 477 DEBUG << "WaveformLayer::paint (" << rect.x() << "," << rect.y()
478 << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << ", start " << startFrame << std::endl; 478 << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << ", start " << startFrame << endl;
479 #endif 479 #endif
480 480
481 size_t channels = 0, minChannel = 0, maxChannel = 0; 481 size_t channels = 0, minChannel = 0, maxChannel = 0;
482 bool mergingChannels = false, mixingChannels = false; 482 bool mergingChannels = false, mixingChannels = false;
483 483
492 QPainter *paint; 492 QPainter *paint;
493 493
494 if (m_aggressive) { 494 if (m_aggressive) {
495 495
496 #ifdef DEBUG_WAVEFORM_PAINT 496 #ifdef DEBUG_WAVEFORM_PAINT
497 std::cerr << "WaveformLayer::paint: aggressive is true" << std::endl; 497 DEBUG << "WaveformLayer::paint: aggressive is true" << endl;
498 #endif 498 #endif
499 499
500 if (m_cacheValid && (zoomLevel != m_cacheZoomLevel)) { 500 if (m_cacheValid && (zoomLevel != m_cacheZoomLevel)) {
501 m_cacheValid = false; 501 m_cacheValid = false;
502 } 502 }
503 503
504 if (!m_cache || m_cache->width() != w || m_cache->height() != h) { 504 if (!m_cache || m_cache->width() != w || m_cache->height() != h) {
505 #ifdef DEBUG_WAVEFORM_PAINT 505 #ifdef DEBUG_WAVEFORM_PAINT
506 if (m_cache) { 506 if (m_cache) {
507 std::cerr << "WaveformLayer::paint: cache size " << m_cache->width() << "x" << m_cache->height() << " differs from view size " << w << "x" << h << ": regenerating aggressive cache" << std::endl; 507 DEBUG << "WaveformLayer::paint: cache size " << m_cache->width() << "x" << m_cache->height() << " differs from view size " << w << "x" << h << ": regenerating aggressive cache" << endl;
508 } 508 }
509 #endif 509 #endif
510 delete m_cache; 510 delete m_cache;
511 m_cache = new QPixmap(w, h); 511 m_cache = new QPixmap(w, h);
512 m_cacheValid = false; 512 m_cacheValid = false;
560 560
561 getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare); 561 getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare);
562 getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1); 562 getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1);
563 563
564 #ifdef DEBUG_WAVEFORM_PAINT 564 #ifdef DEBUG_WAVEFORM_PAINT
565 std::cerr << "Painting waveform from " << frame0 << " to " << frame1 << " (" << (x1-x0+1) << " pixels at zoom " << zoomLevel << " and model zoom " << modelZoomLevel << ")" << std::endl; 565 DEBUG << "Painting waveform from " << frame0 << " to " << frame1 << " (" << (x1-x0+1) << " pixels at zoom " << zoomLevel << " and model zoom " << modelZoomLevel << ")" << endl;
566 #endif 566 #endif
567 567
568 RangeSummarisableTimeValueModel::RangeBlock *ranges = 568 RangeSummarisableTimeValueModel::RangeBlock *ranges =
569 new RangeSummarisableTimeValueModel::RangeBlock; 569 new RangeSummarisableTimeValueModel::RangeBlock;
570 570
701 701
702 size_t i0 = (f0 - frame0) / modelZoomLevel; 702 size_t i0 = (f0 - frame0) / modelZoomLevel;
703 size_t i1 = (f1 - frame0) / modelZoomLevel; 703 size_t i1 = (f1 - frame0) / modelZoomLevel;
704 704
705 #ifdef DEBUG_WAVEFORM_PAINT 705 #ifdef DEBUG_WAVEFORM_PAINT
706 std::cerr << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << std::endl; 706 DEBUG << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << endl;
707 #endif 707 #endif
708 708
709 if (i1 > i0 + 1) { 709 if (i1 > i0 + 1) {
710 std::cerr << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << std::endl; 710 DEBUG << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl;
711 } 711 }
712 712
713 if (ranges && i0 < ranges->size()) { 713 if (ranges && i0 < ranges->size()) {
714 714
715 range = (*ranges)[i0]; 715 range = (*ranges)[i0];