Example #1
0
void UI::spectrumBuffer(char* header,char* buffer) {
    //qDebug() << "spectrumBuffer";
    //int length=atoi(&header[26]);
    int length=((header[7]&0xFF)<<8)+(header[8]&0xFF);
    //sampleRate=atoi(&header[32]);
    sampleRate=((header[9]&0xFF)<<24)+((header[10]&0xFF)<<16)+((header[11]&0xFF)<<8)+(header[12]&0xFF);
    widget.spectrumFrame->updateSpectrum(header,buffer,length);
    widget.waterfallFrame->updateWaterfall(header,buffer,length);
    connection.freeBuffers(header,buffer);
    QTimer::singleShot(1000/fps,this,SLOT(updateSpectrum()));
}
/// Update m_spectrum function.
void CrystalFieldMultiSpectrum::updateTargetFunction() const {
  if (!m_target) {
    buildTargetFunction();
    return;
  }
  m_dirty = false;

  DoubleFortranVector en;
  ComplexFortranMatrix wf;
  int nre = 0;
  auto &peakCalculator = dynamic_cast<Peaks &>(*m_source);
  peakCalculator.calculateEigenSystem(en, wf, nre);

  auto &fun = dynamic_cast<MultiDomainFunction &>(*m_target);
  auto temperatures = getAttribute("Temperatures").asVector();
  for (size_t i = 0; i < temperatures.size(); ++i) {
    updateSpectrum(*fun.getFunction(i), nre, en, wf, temperatures[i], i);
  }
}
void ExcitedStates::on_widthSlider_valueChanged(int)
{
   updateSpectrum();
}
void ExcitedStates::on_lorentzianButton_clicked(bool)
{
   m_configurator.widthSlider->setEnabled(true);
   m_configurator.widthLabel->setEnabled(true);
   updateSpectrum();
}
void ExcitedStates::on_impulseButton_clicked(bool)
{
   m_configurator.widthSlider->setEnabled(false);
   m_configurator.widthLabel->setEnabled(false);
   updateSpectrum();
}
void ExcitedStates::on_resetZoomButton_clicked(bool)
{
   updateSpectrum();
}
Example #7
0
void UI::connected() {
    QString command;

    qDebug() << "UI::connected";

    configure.connected(TRUE);

    // send initial settings
    frequency=band.getFrequency();
    command.clear(); QTextStream(&command) << "setFrequency " << frequency;
    connection.sendCommand(command);
    widget.spectrumFrame->setFrequency(frequency);
    widget.waterfallFrame->setFrequency(frequency);

    command.clear(); QTextStream(&command) << "setMode " << band.getMode();
    connection.sendCommand(command);

    int low,high;
    if(mode.getMode()==MODE_CWL) {
        low=-cwPitch-filters.getLow();
        high=-cwPitch+filters.getHigh();
    } else if(mode.getMode()==MODE_CWU) {
        low=cwPitch-filters.getLow();
        high=cwPitch+filters.getHigh();
    } else {
        low=filters.getLow();
        high=filters.getHigh();
    }
    command.clear(); QTextStream(&command) << "setFilter " << low << " " << high;
    connection.sendCommand(command);

    qDebug() << "connected calling widget.spectrumFrame.setFilter";

    widget.spectrumFrame->setFilter(low,high);
    widget.waterfallFrame->setFilter(low,high);

    widget.actionConnectToServer->setDisabled(TRUE);
    widget.actionDisconnectFromServer->setDisabled(FALSE);
    widget.actionSubrx->setDisabled(FALSE);
    widget.actionMuteSubRx->setDisabled(TRUE);


    // start the audio
    audio_buffers=0;
    actionGain(gain);
    connection.sendCommand(command);

    if (!getenv("QT_RADIO_NO_LOCAL_AUDIO")) {
       command.clear(); QTextStream(&command) << "startAudioStream " << (400*(audio.get_sample_rate()/8000)) << " " << audio.get_sample_rate() << " " << audio.get_channels();
       connection.sendCommand(command);
    }

    command.clear(); QTextStream(&command) << "SetPan 0.5"; // center
    connection.sendCommand(command);

    command.clear(); QTextStream(&command) << "SetAGC " << agc;
    connection.sendCommand(command);

    command.clear(); QTextStream(&command) << "SetANFVals " << configure.getAnfTaps() << " " << configure.getAnfDelay() << " "
                                           << configure.getAnfGain() << " " << configure.getAnfLeak();
    connection.sendCommand(command);

    command.clear(); QTextStream(&command) << "SetNRVals " << configure.getNrTaps() << " " << configure.getNrDelay() << " "
                                           << configure.getNrGain() << " " << configure.getNrLeak();
    connection.sendCommand(command);

    command.clear(); QTextStream(&command) << "SetNBVals " << configure.getNbThreshold();
    connection.sendCommand(command);

    command.clear(); QTextStream(&command) << "SetANF " << (widget.actionANF->isChecked()?"true":"false");
    connection.sendCommand(command);
    command.clear(); QTextStream(&command) << "SetNR " << (widget.actionNR->isChecked()?"true":"false");
    connection.sendCommand(command);
    command.clear(); QTextStream(&command) << "SetNB " << (widget.actionNB->isChecked()?"true":"false");
    connection.sendCommand(command);

    //command.clear(); QTextStream(&command) << "SetDCBlock 1";
    //connection.sendCommand(command);

    // start the spectrum
    //qDebug() << "starting spectrum timer";
    //QTimer::singleShot(1000/fps,this,SLOT(updateSpectrum()));
    updateSpectrum();
}