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

Method onHoverTime

Components/TimeWindow.cpp:1145–1271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1143}
1144
1145void
1146TimeWindow::onHoverTime(qreal time)
1147{
1148 const SUCOMPLEX *data = this->getDisplayData();
1149 int length = static_cast<int>(this->getDisplayDataLength());
1150 qreal samp = this->ui->realWaveform->t2samp(time);
1151 qint64 iSamp = static_cast<qint64>(std::floor(samp));
1152 qint64 selStart = 0, selEnd = 0, selLen = 0;
1153 qreal max = std::max<qreal>(
1154 std::max<qreal>(
1155 std::fabs(this->ui->realWaveform->getMax()),
1156 std::fabs(this->ui->realWaveform->getMin())),
1157 std::max<qreal>(
1158 std::fabs(this->ui->imagWaveform->getMax()),
1159 std::fabs(this->ui->imagWaveform->getMin())));
1160
1161 qreal ampl = 1;
1162 if (max > 0)
1163 ampl = 1. / max;
1164
1165 if (iSamp < 0)
1166 samp = iSamp = 0;
1167 if (iSamp > length)
1168 samp = iSamp = length - 1;
1169
1170 SUFLOAT t = static_cast<SUFLOAT>(samp - iSamp);
1171 SUCOMPLEX val = (1 - t) * data[iSamp] + t * data[iSamp + 1];
1172
1173 this->ui->constellation->setGain(ampl);
1174
1175 if (this->ui->realWaveform->getHorizontalSelectionPresent()) {
1176 selStart = static_cast<qint64>(
1177 this->ui->realWaveform->getHorizontalSelectionStart());
1178 selEnd = static_cast<qint64>(
1179 this->ui->realWaveform->getHorizontalSelectionEnd());
1180
1181 if (selStart < 0)
1182 selStart = 0;
1183 if (selEnd > length)
1184 selEnd = length;
1185
1186 if (selEnd - selStart > TIME_WINDOW_MAX_SELECTION)
1187 selStart = selEnd - TIME_WINDOW_MAX_SELECTION;
1188
1189 selLen = selEnd - selStart;
1190
1191 if (selLen > 0) {
1192 this->ui->constellation->setHistorySize(
1193 static_cast<unsigned int>(selLen));
1194 this->ui->constellation->feed(
1195 data + selStart,
1196 static_cast<unsigned int>(selLen));
1197 }
1198 } else {
1199 if (iSamp == length - 1) {
1200 this->ui->constellation->setHistorySize(1);
1201 this->ui->constellation->feed(data + iSamp, 1);
1202 } else if (iSamp >= 0 && iSamp < length - 1) {

Callers

nothing calls this directly

Calls 7

getDisplayDataMethod · 0.95
getDisplayDataLengthMethod · 0.95
valueMethod · 0.80
getMaxMethod · 0.45
getMinMethod · 0.45
setGainMethod · 0.45
feedMethod · 0.45

Tested by

no test coverage detected