mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-02 22:44:18 +01:00
added time scale toggle checkbox
Conflicts: mainwindow.cpp spectrogram.cpp spectrogram.h spectrogramcontrols.cpp spectrogramcontrols.h
This commit is contained in:
committed by
Tobias Schneider
parent
549d6fa679
commit
dd461bacb7
@@ -37,6 +37,7 @@ SpectrogramPlot::SpectrogramPlot(std::shared_ptr<SampleSource<std::complex<float
|
||||
zoomLevel = 0;
|
||||
powerMax = 0.0f;
|
||||
powerMin = -50.0f;
|
||||
timeScaleIsEnabled = true;
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
float p = (float)i / 256;
|
||||
@@ -53,6 +54,12 @@ void SpectrogramPlot::paintFront(QPainter &painter, QRect &rect, range_t<off_t>
|
||||
if (tunerEnabled())
|
||||
tuner.paintFront(painter, rect, sampleRange);
|
||||
|
||||
if (timeScaleIsEnabled)
|
||||
paintTimeScale(painter, rect, sampleRange);
|
||||
}
|
||||
|
||||
void SpectrogramPlot::paintTimeScale(QPainter &painter, QRect &rect, range_t<off_t> sampleRange)
|
||||
{
|
||||
float startTime = (float)sampleRange.minimum / sampleRate;
|
||||
float stopTime = (float)sampleRange.maximum / sampleRate;
|
||||
float duration = stopTime - startTime;
|
||||
@@ -293,3 +300,8 @@ void SpectrogramPlot::setSampleRate(off_t rate)
|
||||
emit repaint();
|
||||
}
|
||||
|
||||
void SpectrogramPlot::setTimeScaleEnable(bool enabled)
|
||||
{
|
||||
timeScaleIsEnabled = enabled;
|
||||
emit repaint();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user