| 2425 | } |
| 2426 | |
| 2427 | void AppFrame::handleCurrentModem() { |
| 2428 | |
| 2429 | DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem(); |
| 2430 | |
| 2431 | if (demod->isTracking()) { |
| 2432 | if (spectrumCanvas->getViewState()) { |
| 2433 | long long diff = |
| 2434 | abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()) + (demod->getBandwidth() / 2) + |
| 2435 | (demod->getBandwidth() / 4); |
| 2436 | |
| 2437 | if (diff > spectrumCanvas->getBandwidth() / 2) { |
| 2438 | if (demod->getBandwidth() > (int) spectrumCanvas->getBandwidth()) { |
| 2439 | diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()); |
| 2440 | } else { |
| 2441 | diff = diff - spectrumCanvas->getBandwidth() / 2; |
| 2442 | } |
| 2443 | spectrumCanvas->moveCenterFrequency( |
| 2444 | (demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff); |
| 2445 | demod->setTracking(false); |
| 2446 | } |
| 2447 | } else { |
| 2448 | demod->setTracking(false); |
| 2449 | } |
| 2450 | } |
| 2451 | |
| 2452 | if (demod->getBandwidth() != wxGetApp().getDemodMgr().getLastBandwidth()) { |
| 2453 | wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth()); |
| 2454 | } |
| 2455 | |
| 2456 | if (demod.get() != activeDemodulator) { |
| 2457 | demodSignalMeter->setInputValue(demod->getSquelchLevel()); |
| 2458 | demodGainMeter->setInputValue(demod->getGain()); |
| 2459 | wxGetApp().getDemodMgr().setLastGain(demod->getGain()); |
| 2460 | int outputDevice = demod->getOutputDevice(); |
| 2461 | if (scopeCanvas) { |
| 2462 | auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices(); |
| 2463 | scopeCanvas->setDeviceName(outputDevices[outputDevice].name); |
| 2464 | } |
| 2465 | // outputDeviceMenuItems[outputDevice]->Check(true); |
| 2466 | string dType = demod->getDemodulatorType(); |
| 2467 | demodModeSelector->setSelection(dType); |
| 2468 | #ifdef ENABLE_DIGITAL_LAB |
| 2469 | demodModeSelectorAdv->setSelection(dType); |
| 2470 | #endif |
| 2471 | deltaLockButton->setSelection(demod->isDeltaLock() ? 1 : -1); |
| 2472 | demodMuteButton->setSelection(demod->isMuted() ? 1 : -1); |
| 2473 | modemPropertiesUpdated.store(true); |
| 2474 | demodTuner->setHalfBand(dType == "USB" || dType == "LSB"); |
| 2475 | } |
| 2476 | if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) { |
| 2477 | long long centerFreq = demod->getFrequency(); |
| 2478 | unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25); |
| 2479 | |
| 2480 | if (demod->getDemodulatorType() == "USB") { |
| 2481 | demodBw /= 2; |
| 2482 | centerFreq += demod->getBandwidth() / 4; |
| 2483 | } |
| 2484 |
nothing calls this directly
no test coverage detected