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

Method setSelectedSampleRate

Settings/ProfileConfigTab.cpp:1045–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045void
1046ProfileConfigTab::setSelectedSampleRate(unsigned int rate)
1047{
1048 // Set sample rate in both places
1049 qreal dist = std::numeric_limits<qreal>::infinity();
1050 int bestIndex = -1;
1051 for (auto i = 0; i < this->ui->sampleRateCombo->count(); ++i) {
1052 qreal value = this->ui->sampleRateCombo->itemData(i).value<qreal>();
1053 if (fabs(value - rate) < dist) {
1054 bestIndex = i;
1055 dist = fabs(value - rate);
1056 }
1057 }
1058
1059 if (bestIndex != -1)
1060 this->ui->sampleRateCombo->setCurrentIndex(bestIndex);
1061
1062 this->ui->sampleRateSpinBox->setValue(rate);
1063}
1064
1065void
1066ProfileConfigTab::onSpinsChanged(void)

Callers 2

refreshUiStateMethod · 0.95
refreshProfileUiMethod · 0.95

Calls 1

setValueMethod · 0.80

Tested by

no test coverage detected