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

Method setProcessRate

Default/Source/SourceWidget.cpp:646–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

644}
645
646void
647SourceWidget::setProcessRate(unsigned int rate)
648{
649 if (rate != this->processRate) {
650 SUFLOAT percentUsage = 1;
651 this->processRate = rate;
652
653 if (this->rate == 0 || this->processRate == 0) {
654 this->ui->processingRateLabel->setText("N/A");
655 this->ui->deliveryProgress->setEnabled(false);
656 } else {
657 this->ui->deliveryProgress->setEnabled(true);
658 this->ui->processingRateLabel->setText(
659 SuWidgetsHelpers::formatQuantity(this->processRate, 4, "sp/s"));
660 percentUsage =
661 static_cast<SUFLOAT>(this->processRate) /
662 static_cast<SUFLOAT>(this->getEffectiveRate());
663 }
664
665 if (percentUsage <= 1) {
666 this->ui->deliveryProgress->setValue(static_cast<int>(percentUsage * 100));
667 } else {
668 this->ui->deliveryProgress->setValue(100);
669 }
670
671 if (percentUsage >= SU_ADDSFX(.95))
672 this->ui->deliveryLabel->setPixmap(
673 QPixmap(QString::fromUtf8(":/icons/transparent.png")));
674 else if (percentUsage >= SU_ADDSFX(.85))
675 this->ui->deliveryLabel->setPixmap(
676 QPixmap(QString::fromUtf8(":/icons/warning.png")));
677 else
678 this->ui->deliveryLabel->setPixmap(
679 QPixmap(QString::fromUtf8(":/icons/critical.png")));
680 }
681}
682
683void
684SourceWidget::refreshAutoGains(Suscan::Source::Config &config)

Callers 4

applySourceInfoMethod · 0.95
setSampleRateMethod · 0.95
setStateMethod · 0.95
onPSDMessageMethod · 0.95

Calls 3

getEffectiveRateMethod · 0.95
setValueMethod · 0.80
setEnabledMethod · 0.45

Tested by

no test coverage detected