Mercurial > hg > svgui
diff layer/SpectrumLayer.cpp @ 274:b9380f679f70
* Fix centre line position
* Fix failure to update overview when generating peaks from wav file
* Provide y-coordinate scale values and differences for spectrum measurement
mode, and fix values for waveform (inc dB for both)
* Add Printer colour scheme (may be futile)
author | Chris Cannam |
---|---|
date | Mon, 02 Jul 2007 13:04:17 +0000 |
parents | 4ed1446ad604 |
children | bbe57afe9d7d |
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp Fri Jun 29 16:50:59 2007 +0000 +++ b/layer/SpectrumLayer.cpp Mon Jul 02 13:04:17 2007 +0000 @@ -324,7 +324,8 @@ break; case InvertedLogBins: - x = (w - log10f(maxfreq - freq) * w) / log10f(maxfreq); + if (maxfreq == freq) x = w; + else x = w - (log10f(maxfreq - freq) * w) / log10f(maxfreq); break; } @@ -343,6 +344,40 @@ } bool +SpectrumLayer::getYScaleValue(const View *v, int y, + float &value, QString &unit) const +{ + value = getValueForY(y, v); + + if (m_energyScale == dBScale || m_energyScale == MeterScale) { + + float thresh = -80.f; + + if (value > 0.f) { + value = 10.f * log10f(value); + if (value < thresh) value = thresh; + } else value = thresh; + + unit = "dBV"; + + } else { + unit = "V"; + } + + return true; +} + +bool +SpectrumLayer::getYScaleDifference(const View *v, int y0, int y1, + float &diff, QString &unit) const +{ + bool rv = SliceLayer::getYScaleDifference(v, y0, y1, diff, unit); + if (rv && (unit == "dBV")) unit = "dB"; + return rv; +} + + +bool SpectrumLayer::getCrosshairExtents(View *v, QPainter &paint, QPoint cursorPos, std::vector<QRect> &extents) const