MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / refreshMeasures

Method refreshMeasures

Components/TimeWindow.cpp:804–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804void
805TimeWindow::refreshMeasures(void)
806{
807 qreal selStart = 0;
808 qreal selEnd = 0;
809 qreal deltaT = 1. / this->ui->realWaveform->getSampleRate();
810 SUCOMPLEX min, max, mean;
811 SUFLOAT rms;
812 int length = static_cast<int>(this->getDisplayDataLength());
813 bool selection = false;
814
815 if (this->ui->realWaveform->getHorizontalSelectionPresent()) {
816 selStart = this->ui->realWaveform->getHorizontalSelectionStart();
817 selEnd = this->ui->realWaveform->getHorizontalSelectionEnd();
818
819 if (selStart < 0)
820 selStart = 0;
821 if (selEnd > length)
822 selEnd = length;
823 }
824
825 if (selEnd - selStart > 0 && this->ui->realWaveform->isComplete()) {
826 WaveLimits limits;
827
828 qreal period =
829 (selEnd - selStart) /
830 (this->ui->periodicSelectionCheck->isChecked()
831 ? this->getPeriodicDivision()
832 : 1)
833 * deltaT;
834 qreal baud = 1 / period;
835
836#if 0
837 const SUCOMPLEX *data = this->getDisplayData();
838
839 SuWidgetsHelpers::kahanMeanAndRms(
840 &mean,
841 &rms,
842 data + static_cast<qint64>(selStart),
843 SCAST(SUSCOUNT, selEnd - selStart));
844 SuWidgetsHelpers::calcLimits(
845 &min,
846 &max,
847 data + static_cast<qint64>(selStart),
848 SCAST(SUSCOUNT, selEnd - selStart));
849#else
850 this->ui->realWaveform->computeLimits(selStart, selEnd, limits);
851
852 mean = limits.mean;
853 min = limits.min;
854 max = limits.max;
855 rms = limits.envelope;
856
857 selection = true;
858
859#endif
860 this->ui->periodLabel->setText(
861 SuWidgetsHelpers::formatQuantityFromDelta(

Callers 5

setDisplayDataMethod · 0.95
TimeWindowMethod · 0.95
onHSelectionMethod · 0.95
onWaveViewChangedMethod · 0.95

Calls 4

getDisplayDataLengthMethod · 0.95
getPeriodicDivisionMethod · 0.95
getDisplayDataMethod · 0.95
getSampleRateMethod · 0.45

Tested by

no test coverage detected