Mercurial > hg > svgui
comparison layer/WaveformLayer.cpp @ 1366:c2a3ac0a6688
Fix the mix/merge channels behaviour in pixels-per-frame zone
author | Chris Cannam |
---|---|
date | Tue, 30 Oct 2018 16:23:03 +0000 |
parents | 4949061fcb8c |
children | f5566f7271fe |
comparison
equal
deleted
inserted
replaced
1365:a1393b4384a5 | 1366:c2a3ac0a6688 |
---|---|
661 #endif | 661 #endif |
662 } | 662 } |
663 | 663 |
664 if (mixingOrMerging) { | 664 if (mixingOrMerging) { |
665 if (minChannel != 0 || maxChannel != 0) { | 665 if (minChannel != 0 || maxChannel != 0) { |
666 SVCERR << "Internal error: min & max channels should be 0 when merging or mixing all channels" << endl; | 666 throw std::logic_error("Internal error: min & max channels should be 0 when merging or mixing all channels"); |
667 } else if (m_model->getChannelCount() > 1) { | 667 } else if (m_model->getChannelCount() > 1) { |
668 ranges.push_back({}); | 668 ranges.push_back({}); |
669 m_model->getSummaries | 669 m_model->getSummaries |
670 (1, frame0, frame1 - frame0, ranges[1], blockSize); | 670 (1, frame0, frame1 - frame0, ranges[1], blockSize); |
671 } | 671 } |
672 } | 672 } |
673 } | 673 } |
674 | 674 |
675 void | 675 void |
676 WaveformLayer::getOversampledRanges(int minChannel, int maxChannel, | 676 WaveformLayer::getOversampledRanges(int minChannel, int maxChannel, |
677 bool /* mixingOrMerging */, | 677 bool mixingOrMerging, |
678 sv_frame_t frame0, sv_frame_t frame1, | 678 sv_frame_t frame0, sv_frame_t frame1, |
679 int oversampleBy, RangeVec &ranges) | 679 int oversampleBy, RangeVec &ranges) |
680 const | 680 const |
681 { | 681 { |
682 if (mixingOrMerging) { | |
683 if (minChannel != 0 || maxChannel != 0) { | |
684 throw std::logic_error("Internal error: min & max channels should be 0 when merging or mixing all channels"); | |
685 } | |
686 if (m_model->getChannelCount() > 1) { | |
687 // call back on self for the individual channels with | |
688 // mixingOrMerging false | |
689 getOversampledRanges | |
690 (0, 1, false, frame0, frame1, oversampleBy, ranges); | |
691 return; | |
692 } | |
693 } | |
694 | |
682 // These frame values, tail length, etc variables are at the model | 695 // These frame values, tail length, etc variables are at the model |
683 // sample rate, not the oversampled rate | 696 // sample rate, not the oversampled rate |
684 | 697 |
685 sv_frame_t tail = 16; | 698 sv_frame_t tail = 16; |
686 sv_frame_t startFrame = m_model->getStartFrame(); | 699 sv_frame_t startFrame = m_model->getStartFrame(); |
719 << " -> got " << oversampled.size() | 732 << " -> got " << oversampled.size() |
720 << " oversampled values for channel " << ch | 733 << " oversampled values for channel " << ch |
721 << ", from which returning " << rr.size() << " ranges" << endl; | 734 << ", from which returning " << rr.size() << " ranges" << endl; |
722 #endif | 735 #endif |
723 } | 736 } |
724 | |
725 //!!! + channel modes | |
726 | 737 |
727 return; | 738 return; |
728 } | 739 } |
729 | 740 |
730 void | 741 void |
968 } | 979 } |
969 | 980 |
970 if (showIndividualSample) { | 981 if (showIndividualSample) { |
971 paint->setPen(baseColour); | 982 paint->setPen(baseColour); |
972 paint->drawRect(x-1, rangeTop-1, 2, 2); | 983 paint->drawRect(x-1, rangeTop-1, 2, 2); |
984 if (rangeTop != rangeBottom) { // e.g. for "butterfly" merging mode | |
985 paint->drawRect(x-1, rangeBottom-1, 2, 2); | |
986 } | |
973 } | 987 } |
974 | 988 |
975 if (x != x0 && prevRangeBottom != -1) { | 989 if (x != x0 && prevRangeBottom != -1) { |
976 if (prevRangeBottom > rangeBottom + 1 && | 990 if (prevRangeBottom > rangeBottom + 1 && |
977 prevRangeTop > rangeBottom + 1) { | 991 prevRangeTop > rangeBottom + 1) { |