SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
ssbmodgui.cpp
Go to the documentation of this file.
1 // Copyright (C) 2016 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #include <QDockWidget>
19 #include <QMainWindow>
20 #include <QFileDialog>
21 #include <QTime>
22 #include <QDebug>
23 
24 #include "ssbmodgui.h"
25 
26 #include "device/deviceuiset.h"
27 #include "dsp/spectrumvis.h"
28 #include "ui_ssbmodgui.h"
29 #include "plugin/pluginapi.h"
30 #include "util/simpleserializer.h"
31 #include "util/db.h"
32 #include "dsp/dspengine.h"
33 #include "dsp/dspcommands.h"
34 #include "gui/crightclickenabler.h"
35 #include "gui/audioselectdialog.h"
37 #include "mainwindow.h"
38 
40 {
41  SSBModGUI* gui = new SSBModGUI(pluginAPI, deviceUISet, channelTx);
42  return gui;
43 }
44 
46 {
47  delete this;
48 }
49 
50 void SSBModGUI::setName(const QString& name)
51 {
52  setObjectName(name);
53 }
54 
55 QString SSBModGUI::getName() const
56 {
57  return objectName();
58 }
59 
62 }
63 
64 void SSBModGUI::setCenterFrequency(qint64 centerFrequency)
65 {
66  m_channelMarker.setCenterFrequency(centerFrequency);
68  applySettings();
69 }
70 
72 {
74 }
75 
76 QByteArray SSBModGUI::serialize() const
77 {
78  return m_settings.serialize();
79 }
80 
81 bool SSBModGUI::deserialize(const QByteArray& data)
82 {
83  if(m_settings.deserialize(data))
84  {
85  qDebug("SSBModGUI::deserialize");
87  applyBandwidths(5 - ui->spanLog2->value(), true); // does applySettings(true)
88  return true;
89  }
90  else
91  {
94  applyBandwidths(5 - ui->spanLog2->value(), true); // does applySettings(true)
95  return false;
96  }
97 }
98 
99 bool SSBModGUI::handleMessage(const Message& message)
100 {
102  {
103  m_recordSampleRate = ((SSBMod::MsgReportFileSourceStreamData&)message).getSampleRate();
104  m_recordLength = ((SSBMod::MsgReportFileSourceStreamData&)message).getRecordLength();
105  m_samplesCount = 0;
107  return true;
108  }
110  {
111  m_samplesCount = ((SSBMod::MsgReportFileSourceStreamTiming&)message).getSamplesCount();
113  return true;
114  }
115  else if (DSPConfigureAudio::match(message))
116  {
117  qDebug("SSBModGUI::handleMessage: DSPConfigureAudio: %d", m_ssbMod->getAudioSampleRate());
118  applyBandwidths(5 - ui->spanLog2->value()); // will update spectrum details with new sample rate
119  return true;
120  }
121  else if (SSBMod::MsgConfigureSSBMod::match(message))
122  {
123  SSBModSettings mod_settings; // different USB/LSB convention between modulator and GUI
125  mod_settings = cfg.getSettings();
126  if (mod_settings.m_usb == false) {
127  mod_settings.m_bandwidth = -mod_settings.m_bandwidth;
128  mod_settings.m_lowCutoff = -mod_settings.m_lowCutoff;
129  }
130  m_settings = mod_settings;
131  blockApplySettings(true);
132  displaySettings();
133  blockApplySettings(false);
134  return true;
135  }
136  else if (CWKeyer::MsgConfigureCWKeyer::match(message))
137  {
139  ui->cwKeyerGUI->setSettings(cfg.getSettings());
140  ui->cwKeyerGUI->displaySettings();
141  return true;
142  }
143  else
144  {
145  return false;
146  }
147 }
148 
150 {
151  ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
153  applySettings();
154 }
155 
157 {
159  displaySettings();
160  applySettings();
161 }
162 
164 {
165  Message* message;
166 
167  while ((message = getInputMessageQueue()->pop()) != 0)
168  {
169  if (handleMessage(*message))
170  {
171  delete message;
172  }
173  }
174 }
175 
177 {
180  applySettings();
181 }
182 
184 {
185  (void) checked;
186  int bwValue = ui->BW->value();
187  int lcValue = ui->lowCut->value();
188  ui->BW->setValue(-bwValue);
189  ui->lowCut->setValue(-lcValue);
190 }
191 
193 {
194  ui->flipSidebands->setEnabled(!dsb);
195  applyBandwidths(5 - ui->spanLog2->value());
196 }
197 
199 {
200  m_settings.m_audioBinaural = checked;
201  applySettings();
202 }
203 
205 {
207  applySettings();
208 }
209 
211 {
212  if ((value < 0) || (value > 4)) {
213  return;
214  }
215 
216  applyBandwidths(5 - value);
217 }
218 
220 {
221  (void) value;
222  applyBandwidths(5 - ui->spanLog2->value());
223 }
224 
226 {
227  (void) value;
228  applyBandwidths(5 - ui->spanLog2->value());
229 }
230 
232 {
233  ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
234  m_settings.m_toneFrequency = value * 10.0;
235  applySettings();
236 }
237 
239 {
240  ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
241  m_settings.m_volumeFactor = value / 10.0;
242  applySettings();
243 }
244 
246 {
247  m_settings.m_audioMute = checked;
248  applySettings();
249 }
250 
252 {
253  m_settings.m_playLoop = checked;
254  applySettings();
255 }
256 
257 void SSBModGUI::on_play_toggled(bool checked)
258 {
259  ui->tone->setEnabled(!checked); // release other source inputs
260  ui->morseKeyer->setEnabled(!checked);
261  ui->mic->setEnabled(!checked);
263  applySettings();
264  ui->navTimeSlider->setEnabled(!checked);
265  m_enableNavTime = !checked;
266 }
267 
268 void SSBModGUI::on_tone_toggled(bool checked)
269 {
270  ui->play->setEnabled(!checked); // release other source inputs
271  ui->morseKeyer->setEnabled(!checked);
272  ui->mic->setEnabled(!checked);
274  applySettings();
275 }
276 
278 {
279  ui->play->setEnabled(!checked); // release other source inputs
280  ui->tone->setEnabled(!checked); // release other source inputs
281  ui->mic->setEnabled(!checked);
283  applySettings();
284 }
285 
286 void SSBModGUI::on_mic_toggled(bool checked)
287 {
288  ui->play->setEnabled(!checked); // release other source inputs
289  ui->morseKeyer->setEnabled(!checked);
290  ui->tone->setEnabled(!checked); // release other source inputs
292  applySettings();
293 }
294 
296 {
298  applySettings();
299 }
300 
302 {
303  ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
304  m_settings.m_feedbackVolumeFactor = value / 100.0;
305  applySettings();
306 }
307 
308 void SSBModGUI::on_agc_toggled(bool checked)
309 {
310  m_settings.m_agc = checked;
311  applySettings();
312 }
313 
315 {
316  if (m_enableNavTime && ((value >= 0) && (value <= 100)))
317  {
318  int t_sec = (m_recordLength * value) / 100;
319  QTime t(0, 0, 0, 0);
320  t = t.addSecs(t_sec);
321 
323  m_ssbMod->getInputMessageQueue()->push(message);
324  }
325 }
326 
328 {
329  (void) checked;
330  QString fileName = QFileDialog::getOpenFileName(this,
331  tr("Open raw audio file"), ".", tr("Raw audio Files (*.raw)"), 0, QFileDialog::DontUseNativeDialog);
332 
333  if (fileName != "")
334  {
335  m_fileName = fileName;
336  ui->recordFileText->setText(m_fileName);
337  ui->play->setEnabled(true);
339  }
340 }
341 
343 {
344  qDebug() << "FileSourceGui::configureFileName: " << m_fileName.toStdString().c_str();
346  m_ssbMod->getInputMessageQueue()->push(message);
347 }
348 
349 void SSBModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
350 {
351  (void) widget;
352  (void) rollDown;
353 }
354 
355 void SSBModGUI::onMenuDialogCalled(const QPoint &p)
356 {
358  {
365 
366  dialog.move(p);
367  dialog.exec();
368 
377 
378  setWindowTitle(m_settings.m_title);
380 
381  applySettings();
382  }
383 
385 }
386 
387 SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent) :
388  RollupWidget(parent),
389  ui(new Ui::SSBModGUI),
390  m_pluginAPI(pluginAPI),
391  m_deviceUISet(deviceUISet),
392  m_channelMarker(this),
393  m_doApplySettings(true),
394  m_spectrumRate(6000),
395  m_recordLength(0),
396  m_recordSampleRate(48000),
397  m_samplesCount(0),
398  m_tickCount(0),
399  m_enableNavTime(false)
400 {
401  ui->setupUi(this);
402  setAttribute(Qt::WA_DeleteOnClose, true);
403  connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
404  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
405 
406  m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
407  m_ssbMod = (SSBMod*) channelTx; //new SSBMod(m_deviceUISet->m_deviceSinkAPI);
410 
411  resetToDefaults();
412 
413  ui->glSpectrum->setCenterFrequency(m_spectrumRate/2);
414  ui->glSpectrum->setSampleRate(m_spectrumRate);
415  ui->glSpectrum->setDisplayWaterfall(true);
416  ui->glSpectrum->setDisplayMaxHold(true);
417  ui->glSpectrum->setSsbSpectrum(true);
418  ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
419 
420  connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
421 
422  CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->mic);
423  connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect()));
424 
425  CRightClickEnabler *feedbackRightClickEnabler = new CRightClickEnabler(ui->feedbackEnable);
426  connect(feedbackRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioFeedbackSelect()));
427 
428  ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
429  ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
430  ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
431 
432  m_channelMarker.blockSignals(true);
433  m_channelMarker.setColor(Qt::green);
437  m_channelMarker.setTitle("SSB Modulator");
439  m_channelMarker.blockSignals(false);
441 
443 
447 
448  connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
449 
450  ui->cwKeyerGUI->setCWKeyer(m_ssbMod->getCWKeyer());
451  ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
452 
454  m_settings.setSpectrumGUI(ui->spectrumGUI);
455  m_settings.setCWKeyerGUI(ui->cwKeyerGUI);
456 
457  connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
458  connect(m_ssbMod, SIGNAL(levelChanged(qreal, qreal, int)), ui->volumeMeter, SLOT(levelChanged(qreal, qreal, int)));
459 
460  m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
461  m_iconDSBUSB.addPixmap(QPixmap("://usb.png"), QIcon::Normal, QIcon::Off);
462  m_iconDSBLSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
463  m_iconDSBLSB.addPixmap(QPixmap("://lsb.png"), QIcon::Normal, QIcon::Off);
464 
465  displaySettings();
466  applyBandwidths(5 - ui->spanLog2->value(), true); // does applySettings(true)
467 }
468 
470 {
472  delete m_ssbMod; // TODO: check this: when the GUI closes it has to delete the modulator
473  delete m_spectrumVis;
474  delete ui;
475 }
476 
478 {
479  bool ret = !m_doApplySettings;
480  m_doApplySettings = !block;
481  return ret;
482 }
483 
484 void SSBModGUI::applySettings(bool force)
485 {
486  if (m_doApplySettings)
487  {
490  m_ssbMod->getInputMessageQueue()->push(msgChan);
491 
492  SSBModSettings mod_settings; // different USB/LSB convention between modulator and GUI
493  mod_settings = m_settings;
494  if (mod_settings.m_bandwidth > 0) {
495  mod_settings.m_usb = true;
496  } else {
497  mod_settings.m_bandwidth = -mod_settings.m_bandwidth;
498  mod_settings.m_lowCutoff = -mod_settings.m_lowCutoff;
499  mod_settings.m_usb = false;
500  }
501 
504  }
505 }
506 
507 void SSBModGUI::applyBandwidths(int spanLog2, bool force)
508 {
509  bool dsb = ui->dsb->isChecked();
510  m_spectrumRate = m_ssbMod->getAudioSampleRate() / (1<<spanLog2);
511  int bw = ui->BW->value();
512  int lw = ui->lowCut->value();
513  int bwMax = m_ssbMod->getAudioSampleRate() / (100*(1<<spanLog2));
514  int tickInterval = m_spectrumRate / 1200;
515  tickInterval = tickInterval == 0 ? 1 : tickInterval;
516 
517  qDebug() << "SSBModGUI::applyBandwidths:"
518  << " dsb: " << dsb
519  << " spanLog2: " << spanLog2
520  << " m_spectrumRate: " << m_spectrumRate
521  << " bw: " << bw
522  << " lw: " << lw
523  << " bwMax: " << bwMax
524  << " tickInterval: " << tickInterval;
525 
526  ui->BW->setTickInterval(tickInterval);
527  ui->lowCut->setTickInterval(tickInterval);
528 
529  bw = bw < -bwMax ? -bwMax : bw > bwMax ? bwMax : bw;
530 
531  if (bw < 0) {
532  lw = lw < bw+1 ? bw+1 : lw < 0 ? lw : 0;
533  } else if (bw > 0) {
534  lw = lw > bw-1 ? bw-1 : lw < 0 ? 0 : lw;
535  } else {
536  lw = 0;
537  }
538 
539  if (dsb)
540  {
541  bw = bw < 0 ? -bw : bw;
542  lw = 0;
543  }
544 
545  QString spanStr = QString::number(bwMax/10.0, 'f', 1);
546  QString bwStr = QString::number(bw/10.0, 'f', 1);
547  QString lwStr = QString::number(lw/10.0, 'f', 1);
548 
549  if (dsb)
550  {
551  ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(bwStr));
552  ui->spanText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(spanStr));
553  ui->scaleMinus->setText("0");
554  ui->scaleCenter->setText("");
555  ui->scalePlus->setText(tr("%1").arg(QChar(0xB1, 0x00)));
556  ui->lsbLabel->setText("");
557  ui->usbLabel->setText("");
558  ui->glSpectrum->setCenterFrequency(0);
559  ui->glSpectrum->setSampleRate(2*m_spectrumRate);
560  ui->glSpectrum->setSsbSpectrum(false);
561  ui->glSpectrum->setLsbDisplay(false);
562  }
563  else
564  {
565  ui->BWText->setText(tr("%1k").arg(bwStr));
566  ui->spanText->setText(tr("%1k").arg(spanStr));
567  ui->scaleMinus->setText("-");
568  ui->scaleCenter->setText("0");
569  ui->scalePlus->setText("+");
570  ui->lsbLabel->setText("LSB");
571  ui->usbLabel->setText("USB");
572  ui->glSpectrum->setCenterFrequency(m_spectrumRate/2);
573  ui->glSpectrum->setSampleRate(m_spectrumRate);
574  ui->glSpectrum->setSsbSpectrum(true);
575  ui->glSpectrum->setLsbDisplay(bw < 0);
576  }
577 
578  ui->lowCutText->setText(tr("%1k").arg(lwStr));
579 
580 
581  ui->BW->blockSignals(true);
582  ui->lowCut->blockSignals(true);
583 
584  ui->BW->setMaximum(bwMax);
585  ui->BW->setMinimum(dsb ? 0 : -bwMax);
586  ui->BW->setValue(bw);
587 
588  ui->lowCut->setMaximum(dsb ? 0 : bwMax);
589  ui->lowCut->setMinimum(dsb ? 0 : -bwMax);
590  ui->lowCut->setValue(lw);
591 
592  ui->lowCut->blockSignals(false);
593  ui->BW->blockSignals(false);
594 
595 
596  m_settings.m_dsb = dsb;
597  m_settings.m_spanLog2 = spanLog2;
598  m_settings.m_bandwidth = bw * 100;
599  m_settings.m_lowCutoff = lw * 100;
600 
601  applySettings(force);
602 
603  bool applySettingsWereBlocked = blockApplySettings(true);
604  m_channelMarker.setBandwidth(bw * 200);
606  ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB : m_iconDSBUSB);
607  if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
608  blockApplySettings(applySettingsWereBlocked);
609 }
610 
612 {
613  m_channelMarker.blockSignals(true);
618 
619  ui->flipSidebands->setEnabled(!m_settings.m_dsb);
620 
621  if (m_settings.m_dsb) {
623  } else {
624  if (m_settings.m_bandwidth < 0) {
626  ui->dsb->setIcon(m_iconDSBLSB);
627  } else {
629  ui->dsb->setIcon(m_iconDSBUSB);
630  }
631  }
632 
633  m_channelMarker.blockSignals(false);
635 
637  setWindowTitle(m_channelMarker.getTitle());
638 
639  blockApplySettings(true);
640 
641  ui->agc->setChecked(m_settings.m_agc);
642  ui->audioBinaural->setChecked(m_settings.m_audioBinaural);
643  ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels);
644  ui->audioMute->setChecked(m_settings.m_audioMute);
645  ui->playLoop->setChecked(m_settings.m_playLoop);
646 
647  // Prevent uncontrolled triggering of applyBandwidths
648  ui->spanLog2->blockSignals(true);
649  ui->dsb->blockSignals(true);
650  ui->BW->blockSignals(true);
651 
652  ui->dsb->setChecked(m_settings.m_dsb);
653  ui->spanLog2->setValue(5 - m_settings.m_spanLog2);
654 
655  ui->BW->setValue(roundf(m_settings.m_bandwidth/100.0));
656  QString s = QString::number(m_settings.m_bandwidth/1000.0, 'f', 1);
657 
658  if (m_settings.m_dsb)
659  {
660  ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(s));
661  }
662  else
663  {
664  ui->BWText->setText(tr("%1k").arg(s));
665  }
666 
667  ui->spanLog2->blockSignals(false);
668  ui->dsb->blockSignals(false);
669  ui->BW->blockSignals(false);
670 
671  // The only one of the four signals triggering applyBandwidths will trigger it once only with all other values
672  // set correctly and therefore validate the settings and apply them to dependent widgets
673  ui->lowCut->setValue(m_settings.m_lowCutoff / 100.0);
674  ui->lowCutText->setText(tr("%1k").arg(m_settings.m_lowCutoff / 1000.0));
675 
676  ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset);
677 
678  ui->toneFrequency->setValue(roundf(m_settings.m_toneFrequency / 10.0));
679  ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2));
680 
681  ui->volume->setValue(m_settings.m_volumeFactor * 10.0);
682  ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
683 
684  ui->tone->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputTone)
685  || (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
686  ui->mic->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputAudio)
687  || (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
688  ui->play->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputFile)
689  || (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
690  ui->morseKeyer->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputCWTone)
691  || (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
692 
693  ui->tone->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputTone);
694  ui->mic->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputAudio);
695  ui->play->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputFile);
696  ui->morseKeyer->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputCWTone);
697 
698  ui->feedbackEnable->setChecked(m_settings.m_feedbackAudioEnable);
699  ui->feedbackVolume->setValue(roundf(m_settings.m_feedbackVolumeFactor * 100.0));
700  ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
701 
702  blockApplySettings(false);
703 }
704 
706 {
708 }
709 
711 {
713 }
714 
716 {
717  qDebug("SSBModGUI::audioSelect");
718  AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_audioDeviceName, true); // true for input
719  audioSelect.exec();
720 
721  if (audioSelect.m_selected)
722  {
724  applySettings();
725  }
726 }
727 
729 {
730  qDebug("SSBModGUI::audioFeedbackSelect");
731  AudioSelectDialog audioSelect(DSPEngine::instance()->getAudioDeviceManager(), m_settings.m_audioDeviceName, false); // false for output
732  audioSelect.exec();
733 
734  if (audioSelect.m_selected)
735  {
737  applySettings();
738  }
739 }
740 
742 {
743  double powDb = CalcDb::dbPower(m_ssbMod->getMagSq());
744  m_channelPowerDbAvg(powDb);
745  ui->channelPower->setText(tr("%1 dB").arg(m_channelPowerDbAvg.asDouble(), 0, 'f', 1));
746 
748  {
750  m_ssbMod->getInputMessageQueue()->push(message);
751  }
752 }
753 
755 {
756  QTime recordLength(0, 0, 0, 0);
757  recordLength = recordLength.addSecs(m_recordLength);
758  QString s_time = recordLength.toString("HH:mm:ss");
759  ui->recordLengthText->setText(s_time);
761 }
762 
764 {
765  int t_sec = 0;
766  int t_msec = 0;
767 
768  if (m_recordSampleRate > 0)
769  {
770  t_msec = ((m_samplesCount * 1000) / m_recordSampleRate) % 1000;
772  }
773 
774  QTime t(0, 0, 0, 0);
775  t = t.addSecs(t_sec);
776  t = t.addMSecs(t_msec);
777  QString s_timems = t.toString("HH:mm:ss.zzz");
778  QString s_time = t.toString("HH:mm:ss");
779  ui->relTimeText->setText(s_timems);
780 
781  if (!m_enableNavTime)
782  {
783  float posRatio = (float) t_sec / (float) m_recordLength;
784  ui->navTimeSlider->setValue((int) (posRatio * 100.0));
785  }
786 }
void applySettings(bool force=false)
Definition: ssbmodgui.cpp:484
SSBModSettings m_settings
Definition: ssbmodgui.h:67
void removeTxChannelInstance(PluginInstanceGUI *pluginGUI)
static MainWindow * getInstance()
Definition: mainwindow.h:73
const QString & getReverseAPIAddress() const
bool blockApplySettings(bool block)
Definition: ssbmodgui.cpp:477
static MsgConfigureSSBMod * create(const SSBModSettings &settings, bool force)
Definition: ssbmod.h:60
MovingAverageUtil< double, double, 20 > m_channelPowerDbAvg
Definition: ssbmodgui.h:73
int getCenterFrequency() const
Definition: channelmarker.h:42
void handleSourceMessages()
Definition: ssbmodgui.cpp:163
void setLowCutoff(int lowCutoff)
void registerTxChannelInstance(const QString &channelName, PluginInstanceGUI *pluginGUI)
Definition: deviceuiset.cpp:88
void channelMarkerUpdate()
Definition: ssbmodgui.cpp:156
Definition: ssbmod.h:49
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
void audioFeedbackSelect()
Definition: ssbmodgui.cpp:728
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
void on_feedbackEnable_toggled(bool checked)
Definition: ssbmodgui.cpp:295
PluginAPI * m_pluginAPI
Definition: ssbmodgui.h:64
static SSBModGUI * create(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
Definition: ssbmodgui.cpp:39
void updateWithStreamData()
Definition: ssbmodgui.cpp:754
void leaveEvent(QEvent *)
Definition: ssbmodgui.cpp:705
virtual qint64 getCenterFrequency() const
Definition: ssbmodgui.cpp:60
void onMenuDialogCalled(const QPoint &p)
Definition: ssbmodgui.cpp:355
static MsgConfigureFileSourceSeek * create(int seekPercentage)
Definition: ssbmod.h:127
qint64 m_inputFrequencyOffset
void tick()
Definition: ssbmodgui.cpp:741
uint16_t m_reverseAPIChannelIndex
void setCWKeyerGUI(Serializable *cwKeyerGUI)
void on_navTimeSlider_valueChanged(int value)
Definition: ssbmodgui.cpp:314
virtual bool handleMessage(const Message &message)
Definition: ssbmodgui.cpp:99
QString m_feedbackAudioDeviceName
This is the audio device you send the audio samples to for audio feedback.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
int m_samplesCount
Definition: ssbmodgui.h:78
QIcon m_iconDSBUSB
Definition: ssbmodgui.h:83
void on_flipSidebands_clicked(bool checked)
Definition: ssbmodgui.cpp:183
void setReverseAPIChannelIndex(uint16_t channelIndex)
void resetContextMenuType()
Definition: rollupwidget.h:50
QString m_fileName
Definition: ssbmodgui.h:75
void addChannelMarker(ChannelMarker *channelMarker)
Add channel marker to spectrum.
Definition: deviceuiset.cpp:72
virtual void setCenterFrequency(qint64 centerFrequency)
Definition: ssbmodgui.cpp:64
void on_lowCut_valueChanged(int value)
Definition: ssbmodgui.cpp:225
QString getName() const
Definition: ssbmodgui.cpp:55
void on_dsb_toggled(bool checked)
Definition: ssbmodgui.cpp:192
void on_tone_toggled(bool checked)
Definition: ssbmodgui.cpp:268
QByteArray serialize() const
Definition: ssbmodgui.cpp:76
const SSBModSettings & getSettings() const
Definition: ssbmod.h:57
ContextMenuType m_contextMenuType
Definition: rollupwidget.h:33
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
int m_recordSampleRate
Definition: ssbmodgui.h:77
void on_morseKeyer_toggled(bool checked)
Definition: ssbmodgui.cpp:277
float m_feedbackVolumeFactor
DeviceUISet * m_deviceUISet
Definition: ssbmodgui.h:65
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
void updateWithStreamTime()
Definition: ssbmodgui.cpp:763
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: ssbmod.h:83
virtual ~SSBModGUI()
Definition: ssbmodgui.cpp:469
quint32 m_recordLength
Definition: ssbmodgui.h:76
void on_playLoop_toggled(bool checked)
Definition: ssbmodgui.cpp:251
void setSourceOrSinkStream(bool sourceOrSinkStream)
Definition: channelmarker.h:75
static DSPEngine * instance()
Definition: dspengine.cpp:51
QString m_audioDeviceName
This is the audio device you get the audio samples from.
SSBModInputAF m_modAFInput
uint16_t m_reverseAPIDeviceIndex
void setTitleColor(const QColor &c)
static MsgConfigureFileSourceStreamTiming * create()
Definition: ssbmod.h:146
void setHighlighted(bool highlighted)
void onWidgetRolled(QWidget *widget, bool rollDown)
Definition: ssbmodgui.cpp:349
bool m_audioFlipChannels
bool deserialize(const QByteArray &data)
Definition: ssbmodgui.cpp:81
void on_deltaFrequency_changed(qint64 value)
Definition: ssbmodgui.cpp:176
void addRollupWidget(QWidget *widget)
Add rollup widget to channel window.
Definition: deviceuiset.cpp:77
virtual void setMessageQueueToGUI(MessageQueue *queue)
void on_play_toggled(bool checked)
Definition: ssbmodgui.cpp:257
int m_spectrumRate
Definition: ssbmodgui.h:69
double getMagSq() const
Definition: ssbmod.h:250
const QString & getTitle() const
Definition: channelmarker.h:38
static bool match(const Message *message)
Definition: message.cpp:45
static MsgConfigureFileSourceName * create(const QString &fileName)
Definition: ssbmod.h:106
virtual MessageQueue * getInputMessageQueue()
Definition: ssbmodgui.h:56
void on_toneFrequency_valueChanged(int value)
Definition: ssbmodgui.cpp:231
QByteArray serialize() const
void enterEvent(QEvent *)
Definition: ssbmodgui.cpp:710
Ui::SSBModGUI * ui
Definition: ssbmodgui.h:63
SSBModGUI(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget *parent=0)
Definition: ssbmodgui.cpp:387
uint16_t m_reverseAPIPort
void setSpectrumGUI(Serializable *spectrumGUI)
void setReverseAPIAddress(const QString &address)
void resetToDefaults()
Definition: ssbmodgui.cpp:71
CWKeyer * getCWKeyer()
Definition: ssbmod.h:252
void setColor(const QColor &color)
void on_spanLog2_valueChanged(int value)
Definition: ssbmodgui.cpp:210
bool m_enableNavTime
Definition: ssbmodgui.h:80
void setChannelMarker(Serializable *channelMarker)
void setVisible(bool visible)
void on_audioBinaural_toggled(bool checked)
Definition: ssbmodgui.cpp:198
SSBMod * m_ssbMod
Definition: ssbmodgui.h:72
std::size_t m_tickCount
Definition: ssbmodgui.h:79
bool m_doApplySettings
Definition: ssbmodgui.h:68
QIcon m_iconDSBLSB
Definition: ssbmodgui.h:84
QString m_reverseAPIAddress
void on_feedbackVolume_valueChanged(int value)
Definition: ssbmodgui.cpp:301
void setBandwidth(int bandwidth)
const QColor & getColor() const
Definition: channelmarker.h:64
void channelMarkerChangedByCursor()
Definition: ssbmodgui.cpp:149
void setTitle(const QString &title)
void displaySettings()
Definition: ssbmodgui.cpp:611
void configureFileName()
Definition: ssbmodgui.cpp:342
void on_audioFlipChannels_toggled(bool checked)
Definition: ssbmodgui.cpp:204
virtual void destroy()
Definition: ssbmodgui.cpp:45
void on_BW_valueChanged(int value)
Definition: ssbmodgui.cpp:219
void on_volume_valueChanged(int value)
Definition: ssbmodgui.cpp:238
void on_audioMute_toggled(bool checked)
Definition: ssbmodgui.cpp:245
uint32_t getAudioSampleRate() const
Definition: ssbmod.h:249
ChannelMarker m_channelMarker
Definition: ssbmodgui.h:66
bool deserialize(const QByteArray &data)
SpectrumVis * m_spectrumVis
Definition: ssbmodgui.h:71
void setCenterFrequency(int centerFrequency)
void setSidebands(sidebands_t sidebands)
void on_mic_toggled(bool checked)
Definition: ssbmodgui.cpp:286
void on_agc_toggled(bool checked)
Definition: ssbmodgui.cpp:308
void applyBandwidths(int spanLog2, bool force=false)
Definition: ssbmodgui.cpp:507
void widgetRolled(QWidget *widget, bool rollDown)
quint32 m_rgbColor
void setName(const QString &name)
Definition: ssbmodgui.cpp:50
void setUseReverseAPI(bool useReverseAPI)
bool m_feedbackAudioEnable
void audioSelect()
Definition: ssbmodgui.cpp:715
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:60
void on_showFileDialog_clicked(bool checked)
Definition: ssbmodgui.cpp:327
static const QString m_channelIdURI
Definition: ssbmod.h:254
void setSpectrumSampleSink(BasebandSampleSink *sampleSink)
Definition: ssbmod.h:210