# HG changeset patch # User Chris Cannam # Date 1540916583 0 # Node ID c2a3ac0a6688405c9afefd7b5dae5afc72b7fc5a # Parent a1393b4384a5ba5d75ac3a5dc00d353a4cb7633f Fix the mix/merge channels behaviour in pixels-per-frame zone diff -r a1393b4384a5 -r c2a3ac0a6688 layer/WaveformLayer.cpp --- a/layer/WaveformLayer.cpp Tue Oct 30 15:32:05 2018 +0000 +++ b/layer/WaveformLayer.cpp Tue Oct 30 16:23:03 2018 +0000 @@ -663,7 +663,7 @@ if (mixingOrMerging) { if (minChannel != 0 || maxChannel != 0) { - SVCERR << "Internal error: min & max channels should be 0 when merging or mixing all channels" << endl; + throw std::logic_error("Internal error: min & max channels should be 0 when merging or mixing all channels"); } else if (m_model->getChannelCount() > 1) { ranges.push_back({}); m_model->getSummaries @@ -674,11 +674,24 @@ void WaveformLayer::getOversampledRanges(int minChannel, int maxChannel, - bool /* mixingOrMerging */, + bool mixingOrMerging, sv_frame_t frame0, sv_frame_t frame1, int oversampleBy, RangeVec &ranges) const { + if (mixingOrMerging) { + if (minChannel != 0 || maxChannel != 0) { + throw std::logic_error("Internal error: min & max channels should be 0 when merging or mixing all channels"); + } + if (m_model->getChannelCount() > 1) { + // call back on self for the individual channels with + // mixingOrMerging false + getOversampledRanges + (0, 1, false, frame0, frame1, oversampleBy, ranges); + return; + } + } + // These frame values, tail length, etc variables are at the model // sample rate, not the oversampled rate @@ -721,8 +734,6 @@ << ", from which returning " << rr.size() << " ranges" << endl; #endif } - - //!!! + channel modes return; } @@ -970,6 +981,9 @@ if (showIndividualSample) { paint->setPen(baseColour); paint->drawRect(x-1, rangeTop-1, 2, 2); + if (rangeTop != rangeBottom) { // e.g. for "butterfly" merging mode + paint->drawRect(x-1, rangeBottom-1, 2, 2); + } } if (x != x0 && prevRangeBottom != -1) {