Mercurial > hg > svgui
comparison layer/WaveformLayer.cpp @ 991:2adca8f05583 3.0-integration
Merge from branch simple-fft-model
author | Chris Cannam |
---|---|
date | Wed, 01 Jul 2015 18:31:28 +0100 |
parents | 4fe7a09be0fe 3871dffc31bd |
children | c02c51ae5238 ee01a4062747 |
comparison
equal
deleted
inserted
replaced
988:4f4f0e158ecf | 991:2adca8f05583 |
---|---|
728 | 728 |
729 if (i1 > i0 + 1) { | 729 if (i1 > i0 + 1) { |
730 cerr << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl; | 730 cerr << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl; |
731 } | 731 } |
732 | 732 |
733 if (ranges && i0 < (int)ranges->size()) { | 733 if (ranges && i0 < (sv_frame_t)ranges->size()) { |
734 | 734 |
735 range = (*ranges)[i0]; | 735 range = (*ranges)[size_t(i0)]; |
736 | 736 |
737 if (i1 > i0 && i1 < (int)ranges->size()) { | 737 if (i1 > i0 && i1 < (int)ranges->size()) { |
738 range.setMax(std::max(range.max(), (*ranges)[i1].max())); | 738 range.setMax(std::max(range.max(), |
739 range.setMin(std::min(range.min(), (*ranges)[i1].min())); | 739 (*ranges)[size_t(i1)].max())); |
740 range.setAbsmean((range.absmean() + (*ranges)[i1].absmean()) / 2); | 740 range.setMin(std::min(range.min(), |
741 (*ranges)[size_t(i1)].min())); | |
742 range.setAbsmean((range.absmean() | |
743 + (*ranges)[size_t(i1)].absmean()) / 2); | |
741 } | 744 } |
742 | 745 |
743 } else { | 746 } else { |
744 #ifdef DEBUG_WAVEFORM_PAINT | 747 #ifdef DEBUG_WAVEFORM_PAINT |
745 cerr << "No (or not enough) ranges for i0 = " << i0 << endl; | 748 cerr << "No (or not enough) ranges for i0 = " << i0 << endl; |
749 | 752 |
750 int rangeBottom = 0, rangeTop = 0, meanBottom = 0, meanTop = 0; | 753 int rangeBottom = 0, rangeTop = 0, meanBottom = 0, meanTop = 0; |
751 | 754 |
752 if (mergingChannels) { | 755 if (mergingChannels) { |
753 | 756 |
754 if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) { | 757 if (otherChannelRanges && i0 < (sv_frame_t)otherChannelRanges->size()) { |
755 | 758 |
756 range.setMax(fabsf(range.max())); | 759 range.setMax(fabsf(range.max())); |
757 range.setMin(-fabsf((*otherChannelRanges)[i0].max())); | 760 range.setMin(-fabsf((*otherChannelRanges)[size_t(i0)].max())); |
758 range.setAbsmean | 761 range.setAbsmean |
759 ((range.absmean() + | 762 ((range.absmean() + |
760 (*otherChannelRanges)[i0].absmean()) / 2); | 763 (*otherChannelRanges)[size_t(i0)].absmean()) / 2); |
761 | 764 |
762 if (i1 > i0 && i1 < (int)otherChannelRanges->size()) { | 765 if (i1 > i0 && i1 < (sv_frame_t)otherChannelRanges->size()) { |
763 // let's not concern ourselves about the mean | 766 // let's not concern ourselves about the mean |
764 range.setMin | 767 range.setMin |
765 (std::min | 768 (std::min |
766 (range.min(), | 769 (range.min(), |
767 -fabsf((*otherChannelRanges)[i1].max()))); | 770 -fabsf((*otherChannelRanges)[size_t(i1)].max()))); |
768 } | 771 } |
769 } | 772 } |
770 | 773 |
771 } else if (mixingChannels) { | 774 } else if (mixingChannels) { |
772 | 775 |
773 if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) { | 776 if (otherChannelRanges && i0 < (sv_frame_t)otherChannelRanges->size()) { |
774 | 777 |
775 range.setMax((range.max() + (*otherChannelRanges)[i0].max()) / 2); | 778 range.setMax((range.max() |
776 range.setMin((range.min() + (*otherChannelRanges)[i0].min()) / 2); | 779 + (*otherChannelRanges)[size_t(i0)].max()) / 2); |
777 range.setAbsmean((range.absmean() + (*otherChannelRanges)[i0].absmean()) / 2); | 780 range.setMin((range.min() |
781 + (*otherChannelRanges)[size_t(i0)].min()) / 2); | |
782 range.setAbsmean((range.absmean() | |
783 + (*otherChannelRanges)[size_t(i0)].absmean()) / 2); | |
778 } | 784 } |
779 } | 785 } |
780 | 786 |
781 int greyLevels = 1; | 787 int greyLevels = 1; |
782 if (m_greyscale && (m_scale == LinearScale)) greyLevels = 4; | 788 if (m_greyscale && (m_scale == LinearScale)) greyLevels = 4; |