comparison layer/WaveformLayer.cpp @ 1417:2487521e857b

Merge
author Chris Cannam
date Wed, 23 Jan 2019 14:44:16 +0000
parents c8a6fd3f9dff
children e866102db32a
comparison
equal deleted inserted replaced
1416:d794630429a7 1417:2487521e857b
39 using std::vector; 39 using std::vector;
40 40
41 41
42 WaveformLayer::WaveformLayer() : 42 WaveformLayer::WaveformLayer() :
43 SingleColourLayer(), 43 SingleColourLayer(),
44 m_model(0), 44 m_model(nullptr),
45 m_gain(1.0f), 45 m_gain(1.0f),
46 m_autoNormalize(false), 46 m_autoNormalize(false),
47 m_showMeans(true), 47 m_showMeans(true),
48 m_channelMode(SeparateChannels), 48 m_channelMode(SeparateChannels),
49 m_channel(-1), 49 m_channel(-1),
50 m_scale(LinearScale), 50 m_scale(LinearScale),
51 m_middleLineHeight(0.5), 51 m_middleLineHeight(0.5),
52 m_aggressive(false), 52 m_aggressive(false),
53 m_cache(0), 53 m_cache(nullptr),
54 m_cacheValid(false) 54 m_cacheValid(false)
55 { 55 {
56 } 56 }
57 57
58 WaveformLayer::~WaveformLayer() 58 WaveformLayer::~WaveformLayer()
216 WaveformLayer::getNewPropertyRangeMapper(const PropertyName &name) const 216 WaveformLayer::getNewPropertyRangeMapper(const PropertyName &name) const
217 { 217 {
218 if (name == "Gain") { 218 if (name == "Gain") {
219 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB")); 219 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB"));
220 } 220 }
221 return 0; 221 return nullptr;
222 } 222 }
223 223
224 void 224 void
225 WaveformLayer::setProperty(const PropertyName &name, int value) 225 WaveformLayer::setProperty(const PropertyName &name, int value)
226 { 226 {
917 } 917 }
918 break; 918 break;
919 919
920 case MeterScale: 920 case MeterScale:
921 if (!mergingChannels) { 921 if (!mergingChannels) {
922 double r0 = fabs(AudioLevel::multiplier_to_preview 922 double r0 = std::abs(AudioLevel::multiplier_to_preview
923 (range.min() * gain, m)); 923 (range.min() * gain, m));
924 double r1 = fabs(AudioLevel::multiplier_to_preview 924 double r1 = std::abs(AudioLevel::multiplier_to_preview
925 (range.max() * gain, m)); 925 (range.max() * gain, m));
926 rangeTop = std::max(r0, r1); 926 rangeTop = std::max(r0, r1);
927 meanTop = std::min(r0, r1); 927 meanTop = std::min(r0, r1);
928 if (mixingChannels) rangeBottom = meanTop; 928 if (mixingChannels) rangeBottom = meanTop;
929 else rangeBottom = AudioLevel::multiplier_to_preview 929 else rangeBottom = AudioLevel::multiplier_to_preview