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.
Classes | Signals | Public Member Functions | Static Public Attributes | Private Types | Private Slots | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
FreeDVMod Class Reference

#include <freedvmod.h>

+ Inheritance diagram for FreeDVMod:
+ Collaboration diagram for FreeDVMod:

Classes

class  MsgConfigureChannelizer
 
class  MsgConfigureFileSourceName
 
class  MsgConfigureFileSourceSeek
 
class  MsgConfigureFileSourceStreamTiming
 
class  MsgConfigureFreeDVMod
 
class  MsgReportFileSourceStreamData
 
class  MsgReportFileSourceStreamTiming
 

Signals

void levelChanged (qreal rmsLevel, qreal peakLevel, int numSamples)
 

Public Member Functions

 FreeDVMod (DeviceAPI *deviceAPI)
 
 ~FreeDVMod ()
 
virtual void destroy ()
 
void setSpectrumSampleSink (BasebandSampleSink *sampleSink)
 
virtual void pull (Sample &sample)
 
virtual void pullAudio (int nbSamples)
 
virtual void start ()
 
virtual void stop ()
 
virtual bool handleMessage (const Message &cmd)
 Processing of a message. Returns true if message has actually been processed. More...
 
virtual void getIdentifier (QString &id)
 
virtual void getTitle (QString &title)
 
virtual qint64 getCenterFrequency () const
 Applies to a default stream. More...
 
virtual QByteArray serialize () const
 
virtual bool deserialize (const QByteArray &data)
 
virtual int getNbSinkStreams () const
 
virtual int getNbSourceStreams () const
 
virtual qint64 getStreamCenterFrequency (int streamIndex, bool sinkElseSource) const
 
virtual int webapiSettingsGet (SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiSettingsPutPatch (bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiReportGet (SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
 
uint32_t getAudioSampleRate () const
 
uint32_t getModemSampleRate () const
 
double getMagSq () const
 
Real getLowCutoff () const
 
Real getHiCutoff () const
 
CWKeyergetCWKeyer ()
 
- Public Member Functions inherited from BasebandSampleSource
 BasebandSampleSource ()
 
virtual ~BasebandSampleSource ()
 
void feed (SampleSourceFifo *sampleFifo, int nbSamples)
 
SampleSourceFifogetSampleSourceFifo ()
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
MessageQueuegetMessageQueueToGUI ()
 
void setDeviceSampleSourceFifo (SampleSourceFifo *deviceSampleFifo)
 
- Public Member Functions inherited from ChannelAPI
 ChannelAPI (const QString &name, StreamType streamType)
 
virtual ~ChannelAPI ()
 
virtual void setName (const QString &name)
 
virtual const QString & getName () const
 
int getIndexInDeviceSet () const
 
void setIndexInDeviceSet (int indexInDeviceSet)
 
int getDeviceSetIndex () const
 
void setDeviceSetIndex (int deviceSetIndex)
 
DeviceAPIgetDeviceAPI ()
 
void setDeviceAPI (DeviceAPI *deviceAPI)
 
uint64_t getUID () const
 
StreamType getStreamType () const
 

Static Public Attributes

static const QString m_channelIdURI = "sdrangel.channeltx.freedvmod"
 
static const QString m_channelId = "FreeDVMod"
 

Private Types

enum  RateState { RSInitialFill, RSRunning }
 

Private Slots

void networkManagerFinished (QNetworkReply *reply)
 

Private Member Functions

void applyAudioSampleRate (int sampleRate)
 
void applyChannelSettings (int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
 
void applySettings (const FreeDVModSettings &settings, bool force=false)
 
void applyFreeDVMode (FreeDVModSettings::FreeDVMode mode)
 
void pullAF (Complex &sample)
 
void calculateLevel (Complex &sample)
 
void calculateLevel (qint16 &sample)
 
void modulateSample ()
 
void openFileStream ()
 
void seekFileStream (int seekPercentage)
 
void webapiFormatChannelSettings (SWGSDRangel::SWGChannelSettings &response, const FreeDVModSettings &settings)
 
void webapiFormatChannelReport (SWGSDRangel::SWGChannelReport &response)
 
void webapiReverseSendSettings (QList< QString > &channelSettingsKeys, const FreeDVModSettings &settings, bool force)
 
void webapiReverseSendCWSettings (const CWKeyerSettings &settings)
 

Private Attributes

DeviceAPIm_deviceAPI
 
ThreadedBasebandSampleSourcem_threadedChannelizer
 
UpChannelizerm_channelizer
 
int m_basebandSampleRate
 
int m_outputSampleRate
 
int m_modemSampleRate
 
int m_inputFrequencyOffset
 
Real m_lowCutoff
 
Real m_hiCutoff
 
FreeDVModSettings m_settings
 
NCOF m_carrierNco
 
NCOF m_toneNco
 
Complex m_modSample
 
Interpolator m_interpolator
 
Real m_interpolatorDistance
 
Real m_interpolatorDistanceRemain
 
bool m_interpolatorConsumed
 
fftfiltm_SSBFilter
 
Complexm_SSBFilterBuffer
 
int m_SSBFilterBufferIndex
 
BasebandSampleSinkm_sampleSink
 
SampleVector m_sampleBuffer
 
fftfilt::cmplx m_sum
 
int m_undersampleCount
 
int m_sumCount
 
double m_magsq
 
MovingAverageUtil< double, double, 16 > m_movingAverage
 
quint32 m_audioSampleRate
 
AudioVector m_audioBuffer
 
uint m_audioBufferFill
 
AudioFifo m_audioFifo
 
QMutex m_settingsMutex
 
std::ifstream m_ifstream
 
QString m_fileName
 
quint64 m_fileSize
 raw file size (bytes) More...
 
quint32 m_recordLength
 record length in seconds computed from file size More...
 
int m_inputSampleRate
 speech (input) sample rate (fixed 8000 S/s) More...
 
quint32 m_levelCalcCount
 
Real m_peakLevel
 
Real m_levelSum
 
CWKeyer m_cwKeyer
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 
struct freedv * m_freeDV
 
int m_nSpeechSamples
 
int m_nNomModemSamples
 
int m_iSpeech
 
int m_iModem
 
int16_tm_speechIn
 
int16_tm_modOut
 
float m_scaleFactor
 divide by this amount to scale from int16 to float in [-1.0, 1.0] interval More...
 
AudioResampler m_audioResampler
 

Static Private Attributes

static const int m_ssbFftLen = 1024
 
static const int m_levelNbSamples = 80
 

Additional Inherited Members

- Public Types inherited from ChannelAPI
enum  StreamType { StreamSingleSink, StreamSingleSource, StreamMIMO }
 < This is the same enum as in PluginInterface More...
 
- Protected Slots inherited from BasebandSampleSource
void handleInputMessages ()
 
void handleWriteToFifo (int nbSamples)
 
void handleWriteToDeviceFifo (int nbSamples)
 
- Protected Member Functions inherited from BasebandSampleSource
void handleWriteToFifo (SampleSourceFifo *sampleFifo, int nbSamples)
 
- Protected Attributes inherited from BasebandSampleSource
MessageQueue m_inputMessageQueue
 Queue for asynchronous inbound communication. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 
SampleSourceFifo m_sampleFifo
 Internal FIFO for multi-channel processing. More...
 
SampleSourceFifom_deviceSampleFifo
 Reference to the device FIFO for single channel processing. More...
 

Detailed Description

Definition at line 51 of file freedvmod.h.

Member Enumeration Documentation

◆ RateState

enum FreeDVMod::RateState
private
Enumerator
RSInitialFill 
RSRunning 

Definition at line 273 of file freedvmod.h.

Constructor & Destructor Documentation

◆ FreeDVMod()

FreeDVMod::FreeDVMod ( DeviceAPI deviceAPI)

Definition at line 57 of file freedvmod.cpp.

References AudioDeviceManager::addAudioSource(), DeviceAPI::addChannelSource(), DeviceAPI::addChannelSourceAPI(), applyChannelSettings(), applySettings(), DSPEngine::getAudioDeviceManager(), BasebandSampleSource::getInputMessageQueue(), AudioDeviceManager::getInputSampleRate(), DSPEngine::instance(), m_audioBuffer, m_audioBufferFill, m_audioFifo, m_audioSampleRate, m_basebandSampleRate, m_channelId, m_channelizer, m_cwKeyer, m_deviceAPI, m_hiCutoff, m_inputFrequencyOffset, m_inputSampleRate, m_lowCutoff, m_magsq, m_networkManager, m_outputSampleRate, m_settings, m_ssbFftLen, m_SSBFilter, m_SSBFilterBuffer, m_sum, m_sumCount, m_threadedChannelizer, m_toneNco, m_undersampleCount, networkManagerFinished(), CWKeyer::reset(), NCOF::setFreq(), and CWKeyer::setSampleRate().

Referenced by FreeDVMod::MsgReportFileSourceStreamData::MsgReportFileSourceStreamData().

57  :
59  m_deviceAPI(deviceAPI),
60  m_basebandSampleRate(48000),
61  m_outputSampleRate(48000),
62  m_modemSampleRate(48000), // // default 2400A mode
64  m_lowCutoff(0.0),
65  m_hiCutoff(6000.0),
66  m_SSBFilter(0),
69  m_sampleSink(0),
70  m_audioFifo(4800),
71  m_settingsMutex(QMutex::Recursive),
72  m_fileSize(0),
73  m_recordLength(0),
74  m_inputSampleRate(8000), // all modes take 8000 S/s input
76  m_peakLevel(0.0f),
77  m_levelSum(0.0f),
78  m_freeDV(0),
81  m_iSpeech(0),
82  m_iModem(0),
83  m_speechIn(0),
84  m_modOut(0),
86 {
87  setObjectName(m_channelId);
88 
91 
93  m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
95 
96  m_audioBuffer.resize(1<<14);
98 
99  m_sum.real(0.0f);
100  m_sum.imag(0.0f);
101  m_undersampleCount = 0;
102  m_sumCount = 0;
103 
104  m_magsq = 0.0;
105 
108  m_cwKeyer.reset();
109 
110  m_channelizer = new UpChannelizer(this);
114 
115  applySettings(m_settings, true);
117 
118  m_networkManager = new QNetworkAccessManager();
119  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
120 }
NCOF m_toneNco
Definition: freedvmod.h:291
int m_inputSampleRate
speech (input) sample rate (fixed 8000 S/s)
Definition: freedvmod.h:323
quint32 m_audioSampleRate
Definition: freedvmod.h:312
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
int getInputSampleRate(int inputDeviceIndex=-1)
int16_t * m_speechIn
Definition: freedvmod.h:338
int m_nNomModemSamples
Definition: freedvmod.h:335
Real m_hiCutoff
Definition: freedvmod.h:287
int m_iModem
Definition: freedvmod.h:337
int m_SSBFilterBufferIndex
Definition: freedvmod.h:299
void networkManagerFinished(QNetworkReply *reply)
Definition: freedvmod.cpp:1121
void applySettings(const FreeDVModSettings &settings, bool force=false)
Definition: freedvmod.cpp:738
int m_inputFrequencyOffset
Definition: freedvmod.h:285
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
uint m_audioBufferFill
Definition: freedvmod.h:314
Exposes a single source stream (output, Tx)
Definition: channelapi.h:42
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: freedvmod.h:279
static const int m_ssbFftLen
Definition: freedvmod.h:300
int m_undersampleCount
Definition: freedvmod.h:306
quint32 m_recordLength
record length in seconds computed from file size
Definition: freedvmod.h:322
int m_iSpeech
Definition: freedvmod.h:336
void addChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Add a channel source (Tx)
Definition: deviceapi.cpp:138
float m_scaleFactor
divide by this amount to scale from int16 to float in [-1.0, 1.0] interval
Definition: freedvmod.h:340
fftfilt::cmplx m_sum
Definition: freedvmod.h:305
void addAudioSource(AudioFifo *audioFifo, MessageQueue *sampleSourceMessageQueue, int inputDeviceIndex=-1)
Add an audio source.
DeviceAPI * m_deviceAPI
Definition: freedvmod.h:278
FreeDVModSettings m_settings
Definition: freedvmod.h:288
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: freedvmod.cpp:580
int m_outputSampleRate
Definition: freedvmod.h:283
static const QString m_channelId
Definition: freedvmod.h:260
static DSPEngine * instance()
Definition: dspengine.cpp:51
AudioVector m_audioBuffer
Definition: freedvmod.h:313
QMutex m_settingsMutex
Definition: freedvmod.h:317
QNetworkAccessManager * m_networkManager
Definition: freedvmod.h:330
AudioFifo m_audioFifo
Definition: freedvmod.h:315
int m_sumCount
Definition: freedvmod.h:307
ChannelAPI(const QString &name, StreamType streamType)
Definition: channelapi.cpp:23
quint64 m_fileSize
raw file size (bytes)
Definition: freedvmod.h:321
double m_magsq
Definition: freedvmod.h:309
int16_t * m_modOut
Definition: freedvmod.h:339
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
struct freedv * m_freeDV
Definition: freedvmod.h:333
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
static const QString m_channelIdURI
Definition: freedvmod.h:259
void addChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:174
int m_modemSampleRate
Definition: freedvmod.h:284
void reset()
Definition: cwkeyer.h:109
std::complex< Real > Complex
Definition: dsptypes.h:43
Real m_levelSum
Definition: freedvmod.h:327
fftfilt * m_SSBFilter
Definition: freedvmod.h:297
int m_basebandSampleRate
Definition: freedvmod.h:282
void setSampleRate(int sampleRate)
Definition: cwkeyer.cpp:186
Real m_lowCutoff
Definition: freedvmod.h:286
UpChannelizer * m_channelizer
Definition: freedvmod.h:280
int m_nSpeechSamples
Definition: freedvmod.h:334
BasebandSampleSink * m_sampleSink
Definition: freedvmod.h:302
Real m_peakLevel
Definition: freedvmod.h:326
Complex * m_SSBFilterBuffer
Definition: freedvmod.h:298
quint32 m_levelCalcCount
Definition: freedvmod.h:325
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~FreeDVMod()

FreeDVMod::~FreeDVMod ( )

Definition at line 122 of file freedvmod.cpp.

References DSPEngine::getAudioDeviceManager(), DSPEngine::instance(), m_audioFifo, m_channelizer, m_deviceAPI, m_freeDV, m_networkManager, m_SSBFilter, m_SSBFilterBuffer, m_threadedChannelizer, networkManagerFinished(), AudioDeviceManager::removeAudioSource(), DeviceAPI::removeChannelSource(), and DeviceAPI::removeChannelSourceAPI().

Referenced by FreeDVMod::MsgReportFileSourceStreamData::MsgReportFileSourceStreamData().

123 {
124  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
125  delete m_networkManager;
126 
128 
131  delete m_threadedChannelizer;
132  delete m_channelizer;
133 
134  delete m_SSBFilter;
135  delete[] m_SSBFilterBuffer;
136 
137  if (m_freeDV) {
138  freedv_close(m_freeDV);
139  }
140 }
void removeChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:181
void removeChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Remove a channel source (Tx)
Definition: deviceapi.cpp:147
void networkManagerFinished(QNetworkReply *reply)
Definition: freedvmod.cpp:1121
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: freedvmod.h:279
DeviceAPI * m_deviceAPI
Definition: freedvmod.h:278
static DSPEngine * instance()
Definition: dspengine.cpp:51
QNetworkAccessManager * m_networkManager
Definition: freedvmod.h:330
AudioFifo m_audioFifo
Definition: freedvmod.h:315
struct freedv * m_freeDV
Definition: freedvmod.h:333
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
fftfilt * m_SSBFilter
Definition: freedvmod.h:297
UpChannelizer * m_channelizer
Definition: freedvmod.h:280
void removeAudioSource(AudioFifo *audioFifo)
Remove an audio source.
Complex * m_SSBFilterBuffer
Definition: freedvmod.h:298
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applyAudioSampleRate()

void FreeDVMod::applyAudioSampleRate ( int  sampleRate)
private

Definition at line 567 of file freedvmod.cpp.

References m_audioResampler, m_audioSampleRate, m_inputSampleRate, m_settingsMutex, AudioResampler::setAudioFilters(), and AudioResampler::setDecimation().

Referenced by applySettings(), and handleMessage().

568 {
569  qDebug("FreeDVMod::applyAudioSampleRate: %d", sampleRate);
570  // TODO: put up simple IIR interpolator when sampleRate < m_modemSampleRate
571 
572  m_settingsMutex.lock();
574  m_audioResampler.setAudioFilters(sampleRate, sampleRate, 250, 3300);
575  m_settingsMutex.unlock();
576 
577  m_audioSampleRate = sampleRate;
578 }
int m_inputSampleRate
speech (input) sample rate (fixed 8000 S/s)
Definition: freedvmod.h:323
quint32 m_audioSampleRate
Definition: freedvmod.h:312
void setAudioFilters(int srHigh, int srLow, int fcLow, int fcHigh, float gain=1.0f)
void setDecimation(uint32_t decimation)
AudioResampler m_audioResampler
Definition: freedvmod.h:341
QMutex m_settingsMutex
Definition: freedvmod.h:317
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyChannelSettings()

void FreeDVMod::applyChannelSettings ( int  basebandSampleRate,
int  outputSampleRate,
int  inputFrequencyOffset,
bool  force = false 
)
private

Definition at line 580 of file freedvmod.cpp.

References Interpolator::create(), m_basebandSampleRate, m_carrierNco, m_hiCutoff, m_inputFrequencyOffset, m_interpolator, m_interpolatorConsumed, m_interpolatorDistance, m_interpolatorDistanceRemain, m_modemSampleRate, m_outputSampleRate, m_settingsMutex, and NCOF::setFreq().

Referenced by FreeDVMod(), handleMessage(), and start().

581 {
582  qDebug() << "FreeDVMod::applyChannelSettings:"
583  << " basebandSampleRate: " << basebandSampleRate
584  << " outputSampleRate: " << outputSampleRate
585  << " inputFrequencyOffset: " << inputFrequencyOffset;
586 
587  if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
588  (outputSampleRate != m_outputSampleRate) || force)
589  {
590  m_settingsMutex.lock();
591  m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
592  m_settingsMutex.unlock();
593  }
594 
595  if ((outputSampleRate != m_outputSampleRate) || force)
596  {
597  m_settingsMutex.lock();
599  m_interpolatorConsumed = false;
600  m_interpolatorDistance = (Real) m_modemSampleRate / (Real) outputSampleRate;
602  m_settingsMutex.unlock();
603  }
604 
605  m_basebandSampleRate = basebandSampleRate;
606  m_outputSampleRate = outputSampleRate;
607  m_inputFrequencyOffset = inputFrequencyOffset;
608 }
Real m_interpolatorDistance
Definition: freedvmod.h:294
Real m_interpolatorDistanceRemain
Definition: freedvmod.h:295
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
Real m_hiCutoff
Definition: freedvmod.h:287
int m_inputFrequencyOffset
Definition: freedvmod.h:285
bool m_interpolatorConsumed
Definition: freedvmod.h:296
Interpolator m_interpolator
Definition: freedvmod.h:293
int m_outputSampleRate
Definition: freedvmod.h:283
QMutex m_settingsMutex
Definition: freedvmod.h:317
NCOF m_carrierNco
Definition: freedvmod.h:290
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
int m_modemSampleRate
Definition: freedvmod.h:284
float Real
Definition: dsptypes.h:42
int m_basebandSampleRate
Definition: freedvmod.h:282
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFreeDVMode()

void FreeDVMod::applyFreeDVMode ( FreeDVModSettings::FreeDVMode  mode)
private

Definition at line 610 of file freedvmod.cpp.

References DSPConfigureAudio::AudioInput, Interpolator::create(), FreeDVMod::MsgConfigureChannelizer::create(), fftfilt::create_filter(), FreeDVModSettings::FreeDVMode1600, FreeDVModSettings::FreeDVMode2400A, FreeDVModSettings::FreeDVMode700C, FreeDVModSettings::FreeDVMode700D, FreeDVModSettings::FreeDVMode800XA, FreeDVModSettings::getHiCutoff(), FreeDVModSettings::getLowCutoff(), BasebandSampleSource::getMessageQueueToGUI(), FreeDVModSettings::getModSampleRate(), m_freeDV, m_hiCutoff, m_iModem, FreeDVModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, m_interpolator, m_interpolatorConsumed, m_interpolatorDistance, m_interpolatorDistanceRemain, m_iSpeech, m_lowCutoff, m_modemSampleRate, m_modOut, m_nNomModemSamples, m_nSpeechSamples, m_outputSampleRate, m_scaleFactor, m_settings, m_settingsMutex, m_speechIn, m_SSBFilter, MessageQueue::push(), and SDR_TX_SCALEF.

Referenced by applySettings().

611 {
614  int modemSampleRate = FreeDVModSettings::getModSampleRate(mode);
615 
616  m_settingsMutex.lock();
617  m_SSBFilter->create_filter(m_lowCutoff / modemSampleRate, m_hiCutoff / modemSampleRate);
618 
619  // baseband interpolator and filter
620  if (modemSampleRate != m_modemSampleRate)
621  {
622  MsgConfigureChannelizer* channelConfigMsg = MsgConfigureChannelizer::create(
623  modemSampleRate, m_settings.m_inputFrequencyOffset);
624  m_inputMessageQueue.push(channelConfigMsg);
625 
627  m_interpolatorConsumed = false;
628  m_interpolatorDistance = (Real) modemSampleRate / (Real) m_outputSampleRate;
629  m_interpolator.create(48, modemSampleRate, m_hiCutoff, 3.0);
630  m_modemSampleRate = modemSampleRate;
631 
632  if (getMessageQueueToGUI())
633  {
635  getMessageQueueToGUI()->push(cfg);
636  }
637  }
638 
639  // FreeDV object
640 
641  if (m_freeDV) {
642  freedv_close(m_freeDV);
643  }
644 
645  int fdv_mode = -1;
646 
647  switch(mode)
648  {
650  fdv_mode = FREEDV_MODE_700C;
651  m_scaleFactor = SDR_TX_SCALEF / 3.2f;
652  break;
654  fdv_mode = FREEDV_MODE_700D;
655  m_scaleFactor = SDR_TX_SCALEF / 3.2f;
656  break;
658  fdv_mode = FREEDV_MODE_800XA;
659  m_scaleFactor = SDR_TX_SCALEF / 8.2f;
660  break;
662  fdv_mode = FREEDV_MODE_1600;
663  m_scaleFactor = SDR_TX_SCALEF / 3.2f;
664  break;
666  default:
667  fdv_mode = FREEDV_MODE_2400A;
668  m_scaleFactor = SDR_TX_SCALEF / 8.2f;
669  break;
670  }
671 
672  if (fdv_mode == FREEDV_MODE_700D)
673  {
674  struct freedv_advanced adv;
675  adv.interleave_frames = 1;
676  m_freeDV = freedv_open_advanced(fdv_mode, &adv);
677  }
678  else
679  {
680  m_freeDV = freedv_open(fdv_mode);
681  }
682 
683  if (m_freeDV)
684  {
685  freedv_set_test_frames(m_freeDV, 0);
686  freedv_set_snr_squelch_thresh(m_freeDV, -100.0);
687  freedv_set_squelch_en(m_freeDV, 1);
688  freedv_set_clip(m_freeDV, 0);
689  freedv_set_tx_bpf(m_freeDV, 1);
690  freedv_set_ext_vco(m_freeDV, 0);
691 
692  freedv_set_callback_txt(m_freeDV, nullptr, nullptr, nullptr);
693  freedv_set_callback_protocol(m_freeDV, nullptr, nullptr, nullptr);
694  freedv_set_callback_data(m_freeDV, nullptr, nullptr, nullptr);
695 
696  int nSpeechSamples = freedv_get_n_speech_samples(m_freeDV);
697  int nNomModemSamples = freedv_get_n_nom_modem_samples(m_freeDV);
698  int Fs = freedv_get_modem_sample_rate(m_freeDV);
699  int Rs = freedv_get_modem_symbol_rate(m_freeDV);
700 
701  if (nSpeechSamples != m_nSpeechSamples)
702  {
703  if (m_speechIn) {
704  delete[] m_speechIn;
705  }
706 
707  m_speechIn = new int16_t[nSpeechSamples];
708  m_nSpeechSamples = nSpeechSamples;
709  }
710 
711  if (nNomModemSamples != m_nNomModemSamples)
712  {
713  if (m_modOut) {
714  delete[] m_modOut;
715  }
716 
717  m_modOut = new int16_t[nNomModemSamples];
718  m_nNomModemSamples = nNomModemSamples;
719  }
720 
721  m_iSpeech = 0;
722  m_iModem = 0;
723 
724  qDebug() << "FreeDVMod::applyFreeDVMode:"
725  << " fdv_mode: " << fdv_mode
726  << " m_modemSampleRate: " << m_modemSampleRate
727  << " m_lowCutoff: " << m_lowCutoff
728  << " m_hiCutoff: " << m_hiCutoff
729  << " Fs: " << Fs
730  << " Rs: " << Rs
731  << " m_nSpeechSamples: " << m_nSpeechSamples
732  << " m_nNomModemSamples: " << m_nNomModemSamples;
733  }
734 
735  m_settingsMutex.unlock();
736 }
short int16_t
Definition: rtptypes_win.h:43
Real m_interpolatorDistance
Definition: freedvmod.h:294
void push(Message *message, bool emitSignal=true)
Push message onto queue.
Real m_interpolatorDistanceRemain
Definition: freedvmod.h:295
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
int16_t * m_speechIn
Definition: freedvmod.h:338
int m_nNomModemSamples
Definition: freedvmod.h:335
Real m_hiCutoff
Definition: freedvmod.h:287
int m_iModem
Definition: freedvmod.h:337
static int getLowCutoff(FreeDVMode freeDVMode)
int m_iSpeech
Definition: freedvmod.h:336
float m_scaleFactor
divide by this amount to scale from int16 to float in [-1.0, 1.0] interval
Definition: freedvmod.h:340
bool m_interpolatorConsumed
Definition: freedvmod.h:296
static int getHiCutoff(FreeDVMode freeDVMode)
FreeDVModSettings m_settings
Definition: freedvmod.h:288
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
Interpolator m_interpolator
Definition: freedvmod.h:293
int m_outputSampleRate
Definition: freedvmod.h:283
void create_filter(float f1, float f2)
Definition: fftfilt.cpp:107
QMutex m_settingsMutex
Definition: freedvmod.h:317
static int getModSampleRate(FreeDVMode freeDVMode)
int16_t * m_modOut
Definition: freedvmod.h:339
struct freedv * m_freeDV
Definition: freedvmod.h:333
MessageQueue * getMessageQueueToGUI()
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: freedvmod.h:85
int m_modemSampleRate
Definition: freedvmod.h:284
fftfilt * m_SSBFilter
Definition: freedvmod.h:297
float Real
Definition: dsptypes.h:42
Real m_lowCutoff
Definition: freedvmod.h:286
int m_nSpeechSamples
Definition: freedvmod.h:334
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applySettings()

void FreeDVMod::applySettings ( const FreeDVModSettings settings,
bool  force = false 
)
private

Definition at line 738 of file freedvmod.cpp.

References AudioDeviceManager::addAudioSource(), applyAudioSampleRate(), applyFreeDVMode(), DSPEngine::getAudioDeviceManager(), AudioDeviceManager::getInputDeviceIndex(), BasebandSampleSource::getInputMessageQueue(), AudioDeviceManager::getInputSampleRate(), DSPEngine::instance(), FreeDVModSettings::m_audioDeviceName, m_audioFifo, FreeDVModSettings::m_audioMute, m_audioSampleRate, FreeDVModSettings::m_freeDVMode, FreeDVModSettings::m_gaugeInputElseModem, FreeDVModSettings::m_inputFrequencyOffset, m_inputSampleRate, FreeDVModSettings::m_modAFInput, FreeDVModSettings::m_playLoop, FreeDVModSettings::m_reverseAPIAddress, FreeDVModSettings::m_reverseAPIChannelIndex, FreeDVModSettings::m_reverseAPIDeviceIndex, FreeDVModSettings::m_reverseAPIPort, FreeDVModSettings::m_rgbColor, m_settings, m_settingsMutex, FreeDVModSettings::m_spanLog2, FreeDVModSettings::m_title, FreeDVModSettings::m_toneFrequency, m_toneNco, FreeDVModSettings::m_useReverseAPI, FreeDVModSettings::m_volumeFactor, NCOF::setFreq(), and webapiReverseSendSettings().

Referenced by FreeDVMod(), and handleMessage().

739 {
740  QList<QString> reverseAPIKeys;
741 
742  if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
743  reverseAPIKeys.append("inputFrequencyOffset");
744  }
745  if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
746  reverseAPIKeys.append("toneFrequency");
747  }
748  if ((settings.m_volumeFactor != m_settings.m_volumeFactor) || force) {
749  reverseAPIKeys.append("volumeFactor");
750  }
751  if ((settings.m_spanLog2 != m_settings.m_spanLog2) || force) {
752  reverseAPIKeys.append("spanLog2");
753  }
754  if ((settings.m_audioMute != m_settings.m_audioMute) || force) {
755  reverseAPIKeys.append("audioMute");
756  }
757  if ((settings.m_playLoop != m_settings.m_playLoop) || force) {
758  reverseAPIKeys.append("playLoop");
759  }
760  if ((settings.m_playLoop != m_settings.m_gaugeInputElseModem) || force) {
761  reverseAPIKeys.append("gaugeInputElseModem");
762  }
763  if ((settings.m_rgbColor != m_settings.m_rgbColor) || force) {
764  reverseAPIKeys.append("rgbColor");
765  }
766  if ((settings.m_title != m_settings.m_title) || force) {
767  reverseAPIKeys.append("title");
768  }
769  if ((settings.m_freeDVMode != m_settings.m_freeDVMode) || force) {
770  reverseAPIKeys.append("freeDVMode");
771  }
772  if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) {
773  reverseAPIKeys.append("modAFInput");
774  }
775  if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) {
776  reverseAPIKeys.append("audioDeviceName");
777  }
778 
779  if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force)
780  {
781  m_settingsMutex.lock();
783  m_settingsMutex.unlock();
784  }
785 
786  if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
787  {
789  int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName);
790  audioDeviceManager->addAudioSource(&m_audioFifo, getInputMessageQueue(), audioDeviceIndex);
791  uint32_t audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex);
792 
793  if (m_audioSampleRate != audioSampleRate) {
794  applyAudioSampleRate(audioSampleRate);
795  }
796  }
797 
798  if ((m_settings.m_freeDVMode != settings.m_freeDVMode) || force) {
799  applyFreeDVMode(settings.m_freeDVMode);
800  }
801 
802  if (settings.m_useReverseAPI)
803  {
804  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
809  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
810  }
811 
812  m_settings = settings;
813 }
void webapiReverseSendSettings(QList< QString > &channelSettingsKeys, const FreeDVModSettings &settings, bool force)
Definition: freedvmod.cpp:1014
NCOF m_toneNco
Definition: freedvmod.h:291
uint16_t m_reverseAPIDeviceIndex
int m_inputSampleRate
speech (input) sample rate (fixed 8000 S/s)
Definition: freedvmod.h:323
void applyFreeDVMode(FreeDVModSettings::FreeDVMode mode)
Definition: freedvmod.cpp:610
quint32 m_audioSampleRate
Definition: freedvmod.h:312
int getInputSampleRate(int inputDeviceIndex=-1)
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
unsigned int uint32_t
Definition: rtptypes_win.h:46
void addAudioSource(AudioFifo *audioFifo, MessageQueue *sampleSourceMessageQueue, int inputDeviceIndex=-1)
Add an audio source.
FreeDVModSettings m_settings
Definition: freedvmod.h:288
static DSPEngine * instance()
Definition: dspengine.cpp:51
QMutex m_settingsMutex
Definition: freedvmod.h:317
AudioFifo m_audioFifo
Definition: freedvmod.h:315
FreeDVModInputAF m_modAFInput
void applyAudioSampleRate(int sampleRate)
Definition: freedvmod.cpp:567
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
int getInputDeviceIndex(const QString &deviceName) const
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateLevel() [1/2]

void FreeDVMod::calculateLevel ( Complex sample)
private

Definition at line 375 of file freedvmod.cpp.

References levelChanged(), m_levelCalcCount, m_levelNbSamples, m_levelSum, m_peakLevel, leansdr::max(), and sqrt().

Referenced by modulateSample(), and pullAF().

376 {
377  Real t = sample.real(); // TODO: possibly adjust depending on sample type
378 
380  {
381  m_peakLevel = std::max(std::fabs(m_peakLevel), t);
382  m_levelSum += t * t;
384  }
385  else
386  {
387  qreal rmsLevel = sqrt(m_levelSum / m_levelNbSamples);
388  //qDebug("NFMMod::calculateLevel: %f %f", rmsLevel, m_peakLevel);
389  emit levelChanged(rmsLevel, m_peakLevel, m_levelNbSamples);
390  m_peakLevel = 0.0f;
391  m_levelSum = 0.0f;
392  m_levelCalcCount = 0;
393  }
394 }
static const int m_levelNbSamples
Definition: freedvmod.h:343
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2283
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
Real m_levelSum
Definition: freedvmod.h:327
float Real
Definition: dsptypes.h:42
T max(const T &x, const T &y)
Definition: framework.h:446
Real m_peakLevel
Definition: freedvmod.h:326
quint32 m_levelCalcCount
Definition: freedvmod.h:325
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateLevel() [2/2]

void FreeDVMod::calculateLevel ( qint16 &  sample)
private

Definition at line 396 of file freedvmod.cpp.

References levelChanged(), m_levelCalcCount, m_levelNbSamples, m_levelSum, m_peakLevel, leansdr::max(), SDR_TX_SCALEF, and sqrt().

397 {
398  Real t = sample / SDR_TX_SCALEF;
399 
401  {
402  m_peakLevel = std::max(std::fabs(m_peakLevel), t);
403  m_levelSum += t * t;
405  }
406  else
407  {
408  qreal rmsLevel = sqrt(m_levelSum / m_levelNbSamples);
409  //qDebug("FreeDVMod::calculateLevel: %f %f", rmsLevel, m_peakLevel);
410  emit levelChanged(rmsLevel, m_peakLevel, m_levelNbSamples);
411  m_peakLevel = 0.0f;
412  m_levelSum = 0.0f;
413  m_levelCalcCount = 0;
414  }
415 }
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
static const int m_levelNbSamples
Definition: freedvmod.h:343
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2283
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
Real m_levelSum
Definition: freedvmod.h:327
float Real
Definition: dsptypes.h:42
T max(const T &x, const T &y)
Definition: framework.h:446
Real m_peakLevel
Definition: freedvmod.h:326
quint32 m_levelCalcCount
Definition: freedvmod.h:325
+ Here is the call graph for this function:

◆ deserialize()

bool FreeDVMod::deserialize ( const QByteArray &  data)
virtual

Implements ChannelAPI.

Definition at line 820 of file freedvmod.cpp.

References FreeDVMod::MsgConfigureFreeDVMod::create(), FreeDVModSettings::deserialize(), BasebandSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and FreeDVModSettings::resetToDefaults().

Referenced by getCenterFrequency().

821 {
822  if (m_settings.deserialize(data))
823  {
824  MsgConfigureFreeDVMod *msg = MsgConfigureFreeDVMod::create(m_settings, true);
826  return true;
827  }
828  else
829  {
831  MsgConfigureFreeDVMod *msg = MsgConfigureFreeDVMod::create(m_settings, true);
833  return false;
834  }
835 }
static MsgConfigureFreeDVMod * create(const FreeDVModSettings &settings, bool force)
Definition: freedvmod.h:62
void push(Message *message, bool emitSignal=true)
Push message onto queue.
FreeDVModSettings m_settings
Definition: freedvmod.h:288
bool deserialize(const QByteArray &data)
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

virtual void FreeDVMod::destroy ( )
inlinevirtual

Implements ChannelAPI.

Definition at line 210 of file freedvmod.h.

210 { delete this; }

◆ getAudioSampleRate()

uint32_t FreeDVMod::getAudioSampleRate ( ) const
inline

Definition at line 251 of file freedvmod.h.

References m_audioSampleRate.

251 { return m_audioSampleRate; }
quint32 m_audioSampleRate
Definition: freedvmod.h:312

◆ getCenterFrequency()

virtual qint64 FreeDVMod::getCenterFrequency ( ) const
inlinevirtual

Applies to a default stream.

Implements ChannelAPI.

Definition at line 222 of file freedvmod.h.

References deserialize(), FreeDVModSettings::m_inputFrequencyOffset, FreeDVMod::MsgConfigureFreeDVMod::m_settings, and serialize().

FreeDVModSettings m_settings
Definition: freedvmod.h:288
+ Here is the call graph for this function:

◆ getCWKeyer()

CWKeyer* FreeDVMod::getCWKeyer ( )
inline

Definition at line 257 of file freedvmod.h.

References m_cwKeyer.

Referenced by FreeDVModGUI::FreeDVModGUI().

257 { return &m_cwKeyer; }
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
+ Here is the caller graph for this function:

◆ getHiCutoff()

Real FreeDVMod::getHiCutoff ( ) const
inline

Definition at line 255 of file freedvmod.h.

References m_hiCutoff.

255 { return m_hiCutoff; }
Real m_hiCutoff
Definition: freedvmod.h:287

◆ getIdentifier()

virtual void FreeDVMod::getIdentifier ( QString &  id)
inlinevirtual

Implements ChannelAPI.

Definition at line 220 of file freedvmod.h.

220 { id = objectName(); }

◆ getLowCutoff()

Real FreeDVMod::getLowCutoff ( ) const
inline

Definition at line 254 of file freedvmod.h.

References m_lowCutoff.

254 { return m_lowCutoff; }
Real m_lowCutoff
Definition: freedvmod.h:286

◆ getMagSq()

double FreeDVMod::getMagSq ( ) const
inline

Definition at line 253 of file freedvmod.h.

References m_magsq.

Referenced by FreeDVModGUI::tick(), and webapiFormatChannelReport().

253 { return m_magsq; }
double m_magsq
Definition: freedvmod.h:309
+ Here is the caller graph for this function:

◆ getModemSampleRate()

uint32_t FreeDVMod::getModemSampleRate ( ) const
inline

Definition at line 252 of file freedvmod.h.

References m_modemSampleRate.

Referenced by FreeDVModGUI::displayBandwidths(), and FreeDVModGUI::handleMessage().

252 { return m_modemSampleRate; }
int m_modemSampleRate
Definition: freedvmod.h:284
+ Here is the caller graph for this function:

◆ getNbSinkStreams()

virtual int FreeDVMod::getNbSinkStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 227 of file freedvmod.h.

227 { return 1; }

◆ getNbSourceStreams()

virtual int FreeDVMod::getNbSourceStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 228 of file freedvmod.h.

228 { return 0; }

◆ getStreamCenterFrequency()

virtual qint64 FreeDVMod::getStreamCenterFrequency ( int  streamIndex,
bool  sinkElseSource 
) const
inlinevirtual

Implements ChannelAPI.

Definition at line 230 of file freedvmod.h.

References FreeDVModSettings::m_inputFrequencyOffset, FreeDVMod::MsgConfigureFreeDVMod::m_settings, webapiReportGet(), webapiSettingsGet(), and webapiSettingsPutPatch().

231  {
232  (void) streamIndex;
233  (void) sinkElseSource;
235  }
FreeDVModSettings m_settings
Definition: freedvmod.h:288
+ Here is the call graph for this function:

◆ getTitle()

virtual void FreeDVMod::getTitle ( QString &  title)
inlinevirtual

Implements ChannelAPI.

Definition at line 221 of file freedvmod.h.

References FreeDVMod::MsgConfigureFreeDVMod::m_settings, and FreeDVModSettings::m_title.

221 { title = m_settings.m_title; }
FreeDVModSettings m_settings
Definition: freedvmod.h:288

◆ handleMessage()

bool FreeDVMod::handleMessage ( const Message cmd)
virtual

Processing of a message. Returns true if message has actually been processed.

Implements BasebandSampleSource.

Definition at line 430 of file freedvmod.cpp.

References applyAudioSampleRate(), applyChannelSettings(), applySettings(), UpChannelizer::configure(), FreeDVMod::MsgReportFileSourceStreamTiming::create(), UpChannelizer::MsgChannelizerNotification::getBasebandSampleRate(), FreeDVMod::MsgConfigureChannelizer::getCenterFrequency(), FreeDVMod::MsgConfigureFileSourceName::getFileName(), FreeDVMod::MsgConfigureFreeDVMod::getForce(), UpChannelizer::MsgChannelizerNotification::getFrequencyOffset(), BasebandSampleSource::getInputMessageQueue(), BasebandSampleSource::getMessageQueueToGUI(), FreeDVMod::MsgConfigureFileSourceSeek::getPercentage(), UpChannelizer::MsgChannelizerNotification::getSampleRate(), FreeDVMod::MsgConfigureChannelizer::getSampleRate(), DSPConfigureAudio::getSampleRate(), FreeDVMod::MsgConfigureFreeDVMod::getSettings(), CWKeyer::MsgConfigureCWKeyer::getSettings(), m_audioSampleRate, m_channelizer, m_fileName, m_fileSize, m_ifstream, m_settings, FreeDVModSettings::m_useReverseAPI, Message::match(), openFileStream(), MessageQueue::push(), seekFileStream(), and webapiReverseSendCWSettings().

Referenced by setSpectrumSampleSink().

431 {
433  {
435  qDebug() << "FreeDVMod::handleMessage: MsgChannelizerNotification";
436 
438 
439  return true;
440  }
441  else if (MsgConfigureChannelizer::match(cmd))
442  {
443  MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
444  qDebug() << "FreeDVMod::handleMessage: MsgConfigureChannelizer: sampleRate: " << cfg.getSampleRate()
445  << " centerFrequency: " << cfg.getCenterFrequency();
446 
448  cfg.getSampleRate(),
449  cfg.getCenterFrequency());
450 
451  return true;
452  }
453  else if (MsgConfigureFreeDVMod::match(cmd))
454  {
455  MsgConfigureFreeDVMod& cfg = (MsgConfigureFreeDVMod&) cmd;
456  qDebug() << "FreeDVMod::handleMessage: MsgConfigureFreeDVMod";
457 
458  applySettings(cfg.getSettings(), cfg.getForce());
459 
460  return true;
461  }
462  else if (MsgConfigureFileSourceName::match(cmd))
463  {
464  MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
465  m_fileName = conf.getFileName();
466  openFileStream();
467  return true;
468  }
469  else if (MsgConfigureFileSourceSeek::match(cmd))
470  {
471  MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
472  int seekPercentage = conf.getPercentage();
473  seekFileStream(seekPercentage);
474 
475  return true;
476  }
478  {
479  std::size_t samplesCount;
480 
481  if (m_ifstream.eof()) {
482  samplesCount = m_fileSize / sizeof(int16_t);
483  } else {
484  samplesCount = m_ifstream.tellg() / sizeof(int16_t);
485  }
486 
487  if (getMessageQueueToGUI())
488  {
489  MsgReportFileSourceStreamTiming *report;
490  report = MsgReportFileSourceStreamTiming::create(samplesCount);
491  getMessageQueueToGUI()->push(report);
492  }
493 
494  return true;
495  }
497  {
499 
502  }
503 
504  return true;
505  }
506  else if (DSPConfigureAudio::match(cmd))
507  {
508  DSPConfigureAudio& cfg = (DSPConfigureAudio&) cmd;
509  uint32_t sampleRate = cfg.getSampleRate();
510 
511  qDebug() << "FreeDVMod::handleMessage: DSPConfigureAudio:"
512  << " sampleRate: " << sampleRate;
513 
514  if (sampleRate != m_audioSampleRate) {
515  applyAudioSampleRate(sampleRate);
516  }
517 
518  return true;
519  }
520  else if (DSPSignalNotification::match(cmd))
521  {
522  return true;
523  }
524  else
525  {
526  return false;
527  }
528 }
short int16_t
Definition: rtptypes_win.h:43
void push(Message *message, bool emitSignal=true)
Push message onto queue.
quint32 m_audioSampleRate
Definition: freedvmod.h:312
void applySettings(const FreeDVModSettings &settings, bool force=false)
Definition: freedvmod.cpp:738
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
static MsgReportFileSourceStreamTiming * create(std::size_t samplesCount)
Definition: freedvmod.h:167
unsigned int uint32_t
Definition: rtptypes_win.h:46
FreeDVModSettings m_settings
Definition: freedvmod.h:288
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: freedvmod.cpp:580
void openFileStream()
Definition: freedvmod.cpp:530
std::ifstream m_ifstream
Definition: freedvmod.h:319
void seekFileStream(int seekPercentage)
Definition: freedvmod.cpp:554
int getSampleRate() const
Definition: dspcommands.h:390
quint64 m_fileSize
raw file size (bytes)
Definition: freedvmod.h:321
void webapiReverseSendCWSettings(const CWKeyerSettings &settings)
Definition: freedvmod.cpp:1090
static bool match(const Message *message)
Definition: message.cpp:45
void applyAudioSampleRate(int sampleRate)
Definition: freedvmod.cpp:567
MessageQueue * getMessageQueueToGUI()
QString m_fileName
Definition: freedvmod.h:320
UpChannelizer * m_channelizer
Definition: freedvmod.h:280
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:60
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ levelChanged

void FreeDVMod::levelChanged ( qreal  rmsLevel,
qreal  peakLevel,
int  numSamples 
)
signal

Level changed

Parameters
rmsLevelRMS level in range 0.0 - 1.0
peakLevelPeak level in range 0.0 - 1.0
numSamplesNumber of audio samples analyzed

Referenced by calculateLevel().

+ Here is the caller graph for this function:

◆ modulateSample()

void FreeDVMod::modulateSample ( )
private

Definition at line 194 of file freedvmod.cpp.

References calculateLevel(), m_audioBufferFill, FreeDVModSettings::m_gaugeInputElseModem, m_modSample, m_settings, and pullAF().

Referenced by pull().

195 {
199  }
201 }
Complex m_modSample
Definition: freedvmod.h:292
void pullAF(Complex &sample)
Definition: freedvmod.cpp:203
uint m_audioBufferFill
Definition: freedvmod.h:314
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
FreeDVModSettings m_settings
Definition: freedvmod.h:288
void calculateLevel(Complex &sample)
Definition: freedvmod.cpp:375
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void FreeDVMod::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 1121 of file freedvmod.cpp.

Referenced by FreeDVMod(), and ~FreeDVMod().

1122 {
1123  QNetworkReply::NetworkError replyError = reply->error();
1124 
1125  if (replyError)
1126  {
1127  qWarning() << "FreeDVMod::networkManagerFinished:"
1128  << " error(" << (int) replyError
1129  << "): " << replyError
1130  << ": " << reply->errorString();
1131  return;
1132  }
1133 
1134  QString answer = reply->readAll();
1135  answer.chop(1); // remove last \n
1136  qDebug("FreeDVMod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
1137 }
+ Here is the caller graph for this function:

◆ openFileStream()

void FreeDVMod::openFileStream ( )
private

Definition at line 530 of file freedvmod.cpp.

References FreeDVMod::MsgReportFileSourceStreamData::create(), BasebandSampleSource::getMessageQueueToGUI(), m_fileName, m_fileSize, m_ifstream, m_inputSampleRate, m_recordLength, and MessageQueue::push().

Referenced by handleMessage().

531 {
532  if (m_ifstream.is_open()) {
533  m_ifstream.close();
534  }
535 
536  m_ifstream.open(m_fileName.toStdString().c_str(), std::ios::binary | std::ios::ate);
537  m_fileSize = m_ifstream.tellg();
538  m_ifstream.seekg(0,std::ios_base::beg);
539 
541 
542  qDebug() << "FreeDVMod::openFileStream: " << m_fileName.toStdString().c_str()
543  << " fileSize: " << m_fileSize << "bytes"
544  << " length: " << m_recordLength << " seconds";
545 
546  if (getMessageQueueToGUI())
547  {
548  MsgReportFileSourceStreamData *report;
550  getMessageQueueToGUI()->push(report);
551  }
552 }
short int16_t
Definition: rtptypes_win.h:43
void push(Message *message, bool emitSignal=true)
Push message onto queue.
int m_inputSampleRate
speech (input) sample rate (fixed 8000 S/s)
Definition: freedvmod.h:323
static MsgReportFileSourceStreamData * create(int sampleRate, quint32 recordLength)
Definition: freedvmod.h:188
quint32 m_recordLength
record length in seconds computed from file size
Definition: freedvmod.h:322
std::ifstream m_ifstream
Definition: freedvmod.h:319
quint64 m_fileSize
raw file size (bytes)
Definition: freedvmod.h:321
MessageQueue * getMessageQueueToGUI()
QString m_fileName
Definition: freedvmod.h:320
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pull()

void FreeDVMod::pull ( Sample sample)
virtual

Implements BasebandSampleSource.

Definition at line 142 of file freedvmod.cpp.

References MovingAverageUtil< T, Total, N >::asDouble(), Interpolator::decimate(), Interpolator::interpolate(), m_carrierNco, Sample::m_imag, m_interpolator, m_interpolatorDistance, m_interpolatorDistanceRemain, m_magsq, m_modSample, m_movingAverage, Sample::m_real, m_settingsMutex, modulateSample(), NCOF::nextIQ(), SDR_TX_SCALED, and SDR_TX_SCALEF.

Referenced by setSpectrumSampleSink().

143 {
144  Complex ci;
145 
146  m_settingsMutex.lock();
147 
148  if (m_interpolatorDistance > 1.0f) // decimate
149  {
150  modulateSample();
151 
153  {
154  modulateSample();
155  }
156  }
157  else
158  {
160  {
161  modulateSample();
162  }
163  }
164 
166 
167  ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
168  ci *= 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
169 
170  m_settingsMutex.unlock();
171 
172  double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
173  magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
174  m_movingAverage(magsq);
176 
177  sample.m_real = (FixReal) ci.real();
178  sample.m_imag = (FixReal) ci.imag();
179 }
Real m_interpolatorDistance
Definition: freedvmod.h:294
bool decimate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:38
Real m_interpolatorDistanceRemain
Definition: freedvmod.h:295
bool interpolate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:53
Complex m_modSample
Definition: freedvmod.h:292
Complex nextIQ()
Return next complex sample.
Definition: ncof.cpp:63
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
Interpolator m_interpolator
Definition: freedvmod.h:293
MovingAverageUtil< double, double, 16 > m_movingAverage
Definition: freedvmod.h:310
QMutex m_settingsMutex
Definition: freedvmod.h:317
FixReal m_real
Definition: dsptypes.h:64
void modulateSample()
Definition: freedvmod.cpp:194
double m_magsq
Definition: freedvmod.h:309
NCOF m_carrierNco
Definition: freedvmod.h:290
FixReal m_imag
Definition: dsptypes.h:65
std::complex< Real > Complex
Definition: dsptypes.h:43
double asDouble() const
Definition: movingaverage.h:57
#define SDR_TX_SCALED
Definition: dsptypes.h:40
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAF()

void FreeDVMod::pullAF ( Complex sample)
private

Definition at line 203 of file freedvmod.cpp.

References calculateLevel(), AudioResampler::downSample(), BasebandSampleSink::feed(), FreeDVModSettings::FreeDVModInputAudio, FreeDVModSettings::FreeDVModInputCWTone, FreeDVModSettings::FreeDVModInputFile, FreeDVModSettings::FreeDVModInputNone, FreeDVModSettings::FreeDVModInputTone, CWKeyer::getCWSmoother(), CWSmoother::getFadeSample(), CWKeyer::getSample(), i, m_audioBuffer, m_audioBufferFill, FreeDVModSettings::m_audioMute, m_audioResampler, m_cwKeyer, m_freeDV, FreeDVModSettings::m_gaugeInputElseModem, m_ifstream, m_iModem, FreeDVModSettings::m_modAFInput, m_modOut, m_nNomModemSamples, m_nSpeechSamples, FreeDVModSettings::m_playLoop, m_sampleBuffer, m_sampleSink, m_scaleFactor, m_settings, FreeDVModSettings::m_spanLog2, m_speechIn, m_SSBFilter, m_SSBFilterBuffer, m_SSBFilterBufferIndex, m_sum, m_toneNco, m_undersampleCount, FreeDVModSettings::m_volumeFactor, NCOF::next(), fftfilt::runSSB(), SDR_TX_SCALEF, and NCOF::setPhase().

Referenced by modulateSample().

204 {
206  {
207  sample.real(0.0f);
208  sample.imag(0.0f);
209  return;
210  }
211 
212  Complex ci;
213  fftfilt::cmplx *filtered;
214  int n_out = 0;
215 
216  int decim = 1<<(m_settings.m_spanLog2 - 1);
217  unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
218 
220  {
221  switch (m_settings.m_modAFInput)
222  {
224  for (int i = 0; i < m_nSpeechSamples; i++)
225  {
229  }
230  }
231  freedv_tx(m_freeDV, m_modOut, m_speechIn);
232  break;
235  {
236  if (m_ifstream.is_open())
237  {
238  std::fill(m_speechIn, m_speechIn + m_nSpeechSamples, 0);
239 
240  if (m_ifstream.eof())
241  {
243  {
244  m_ifstream.clear();
245  m_ifstream.seekg(0, std::ios::beg);
246  }
247  }
248 
249  if (m_ifstream.eof())
250  {
251  std::fill(m_modOut, m_modOut + m_nNomModemSamples, 0);
252  }
253  else
254  {
255 
256  m_ifstream.read(reinterpret_cast<char*>(m_speechIn), sizeof(int16_t) * m_nSpeechSamples);
257 
259  {
260  for (int i = 0; i < m_nSpeechSamples; i++)
261  {
262  if (m_settings.m_volumeFactor != 1.0) {
264  }
267  }
268  }
269  }
270 
271  freedv_tx(m_freeDV, m_modOut, m_speechIn);
272  }
273  }
274  else
275  {
276  std::fill(m_modOut, m_modOut + m_nNomModemSamples, 0);
277  }
278  }
279  break;
281  for (int i = 0; i < m_nSpeechSamples; i++)
282  {
285 
286  while (!m_audioResampler.downSample(audioSample, m_speechIn[i]))
287  {
290  }
291 
294  }
295  }
296  freedv_tx(m_freeDV, m_modOut, m_speechIn);
297  break;
299  for (int i = 0; i < m_nSpeechSamples; i++)
300  {
301  Real fadeFactor;
302 
303  if (m_cwKeyer.getSample())
304  {
305  m_cwKeyer.getCWSmoother().getFadeSample(true, fadeFactor);
306  m_speechIn[i] = m_toneNco.next() * 32768.0f * fadeFactor * m_settings.m_volumeFactor;
307  }
308  else
309  {
310  if (m_cwKeyer.getCWSmoother().getFadeSample(false, fadeFactor))
311  {
312  m_speechIn[i] = m_toneNco.next() * 32768.0f * fadeFactor * m_settings.m_volumeFactor;
313  }
314  else
315  {
316  m_speechIn[i] = 0;
317  m_toneNco.setPhase(0);
318  }
319  }
320 
323  }
324  }
325  freedv_tx(m_freeDV, m_modOut, m_speechIn);
326  break;
328  default:
329  std::fill(m_speechIn, m_speechIn + m_nSpeechSamples, 0);
330  freedv_tx(m_freeDV, m_modOut, m_speechIn);
331  break;
332  }
333 
334  m_iModem = 0;
335  }
336 
337  ci.real(m_modOut[m_iModem++] / m_scaleFactor);
338  ci.imag(0.0f);
339 
340  n_out = m_SSBFilter->runSSB(ci, &filtered, true); // USB
341 
342  if (n_out > 0)
343  {
344  memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
346 
347  for (int i = 0; i < n_out; i++)
348  {
349  // Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
350  // smart decimation with bit gain using float arithmetic (23 bits significand)
351 
352  m_sum += filtered[i];
353 
354  if (!(m_undersampleCount++ & decim_mask))
355  {
356  Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
357  Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
358  m_sampleBuffer.push_back(Sample(avgr, avgi));
359  m_sum.real(0.0);
360  m_sum.imag(0.0);
361  }
362  }
363 
364  if (m_sampleSink != 0)
365  {
366  m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true); // SSB
367  }
368 
369  m_sampleBuffer.clear();
370  }
371 
372  sample = m_SSBFilterBuffer[m_SSBFilterBufferIndex++];
373 }
short int16_t
Definition: rtptypes_win.h:43
NCOF m_toneNco
Definition: freedvmod.h:291
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
int16_t * m_speechIn
Definition: freedvmod.h:338
int m_nNomModemSamples
Definition: freedvmod.h:335
int m_iModem
Definition: freedvmod.h:337
AudioResampler m_audioResampler
Definition: freedvmod.h:341
int m_SSBFilterBufferIndex
Definition: freedvmod.h:299
uint m_audioBufferFill
Definition: freedvmod.h:314
int m_undersampleCount
Definition: freedvmod.h:306
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)=0
float m_scaleFactor
divide by this amount to scale from int16 to float in [-1.0, 1.0] interval
Definition: freedvmod.h:340
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
std::complex< float > cmplx
Definition: fftfilt.h:21
fftfilt::cmplx m_sum
Definition: freedvmod.h:305
FreeDVModSettings m_settings
Definition: freedvmod.h:288
void setPhase(Real phase)
Definition: ncof.h:42
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
std::ifstream m_ifstream
Definition: freedvmod.h:319
bool getFadeSample(bool on, float &sample)
Definition: cwkeyer.cpp:487
CWSmoother & getCWSmoother()
Definition: cwkeyer.h:111
AudioVector m_audioBuffer
Definition: freedvmod.h:313
int32_t i
Definition: decimators.h:244
FreeDVModInputAF m_modAFInput
SampleVector m_sampleBuffer
Definition: freedvmod.h:303
int getSample()
Definition: cwkeyer.cpp:194
int16_t * m_modOut
Definition: freedvmod.h:339
struct freedv * m_freeDV
Definition: freedvmod.h:333
int runSSB(const cmplx &in, cmplx **out, bool usb, bool getDC=true)
Definition: fftfilt.cpp:284
void calculateLevel(Complex &sample)
Definition: freedvmod.cpp:375
Real next()
Return next real sample.
Definition: ncof.cpp:57
std::complex< Real > Complex
Definition: dsptypes.h:43
fftfilt * m_SSBFilter
Definition: freedvmod.h:297
float Real
Definition: dsptypes.h:42
int m_nSpeechSamples
Definition: freedvmod.h:334
bool downSample(qint16 sampleIn, qint16 &sampleOut)
BasebandSampleSink * m_sampleSink
Definition: freedvmod.h:302
Complex * m_SSBFilterBuffer
Definition: freedvmod.h:298
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAudio()

void FreeDVMod::pullAudio ( int  nbSamples)
virtual

Reimplemented from BasebandSampleSource.

Definition at line 181 of file freedvmod.cpp.

References m_audioBuffer, m_audioBufferFill, m_audioFifo, m_audioSampleRate, m_modemSampleRate, and AudioFifo::read().

Referenced by setSpectrumSampleSink().

182 {
183  unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_modemSampleRate);
184 
185  if (nbSamplesAudio > m_audioBuffer.size())
186  {
187  m_audioBuffer.resize(nbSamplesAudio);
188  }
189 
190  m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamplesAudio);
191  m_audioBufferFill = 0;
192 }
quint32 m_audioSampleRate
Definition: freedvmod.h:312
uint m_audioBufferFill
Definition: freedvmod.h:314
AudioVector m_audioBuffer
Definition: freedvmod.h:313
AudioFifo m_audioFifo
Definition: freedvmod.h:315
uint32_t read(quint8 *data, uint32_t numSamples)
Definition: audiofifo.cpp:103
int m_modemSampleRate
Definition: freedvmod.h:284
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ seekFileStream()

void FreeDVMod::seekFileStream ( int  seekPercentage)
private

Definition at line 554 of file freedvmod.cpp.

References m_ifstream, m_inputSampleRate, m_recordLength, and m_settingsMutex.

Referenced by handleMessage().

555 {
556  QMutexLocker mutexLocker(&m_settingsMutex);
557 
558  if (m_ifstream.is_open())
559  {
560  int seekPoint = ((m_recordLength * seekPercentage) / 100) * m_inputSampleRate;
561  seekPoint *= sizeof(Real);
562  m_ifstream.clear();
563  m_ifstream.seekg(seekPoint, std::ios::beg);
564  }
565 }
int m_inputSampleRate
speech (input) sample rate (fixed 8000 S/s)
Definition: freedvmod.h:323
quint32 m_recordLength
record length in seconds computed from file size
Definition: freedvmod.h:322
std::ifstream m_ifstream
Definition: freedvmod.h:319
QMutex m_settingsMutex
Definition: freedvmod.h:317
float Real
Definition: dsptypes.h:42
+ Here is the caller graph for this function:

◆ serialize()

QByteArray FreeDVMod::serialize ( ) const
virtual

Implements ChannelAPI.

Definition at line 815 of file freedvmod.cpp.

References m_settings, and FreeDVModSettings::serialize().

Referenced by getCenterFrequency().

816 {
817  return m_settings.serialize();
818 }
QByteArray serialize() const
FreeDVModSettings m_settings
Definition: freedvmod.h:288
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSpectrumSampleSink()

void FreeDVMod::setSpectrumSampleSink ( BasebandSampleSink sampleSink)
inline

Definition at line 212 of file freedvmod.h.

References handleMessage(), m_sampleSink, pull(), pullAudio(), start(), and stop().

Referenced by FreeDVModGUI::FreeDVModGUI().

212 { m_sampleSink = sampleSink; }
BasebandSampleSink * m_sampleSink
Definition: freedvmod.h:302
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void FreeDVMod::start ( )
virtual

Implements BasebandSampleSource.

Definition at line 417 of file freedvmod.cpp.

References applyChannelSettings(), AudioFifo::clear(), m_audioFifo, m_basebandSampleRate, FreeDVModSettings::m_inputFrequencyOffset, m_inputFrequencyOffset, m_outputSampleRate, and m_settings.

Referenced by setSpectrumSampleSink().

418 {
419  qDebug() << "FreeDVMod::start: m_outputSampleRate: " << m_outputSampleRate
420  << " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
421 
422  m_audioFifo.clear();
424 }
void clear()
Definition: audiofifo.cpp:156
int m_inputFrequencyOffset
Definition: freedvmod.h:285
FreeDVModSettings m_settings
Definition: freedvmod.h:288
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: freedvmod.cpp:580
int m_outputSampleRate
Definition: freedvmod.h:283
AudioFifo m_audioFifo
Definition: freedvmod.h:315
int m_basebandSampleRate
Definition: freedvmod.h:282
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void FreeDVMod::stop ( )
virtual

Implements BasebandSampleSource.

Definition at line 426 of file freedvmod.cpp.

Referenced by setSpectrumSampleSink().

427 {
428 }
+ Here is the caller graph for this function:

◆ webapiFormatChannelReport()

void FreeDVMod::webapiFormatChannelReport ( SWGSDRangel::SWGChannelReport response)
private

Definition at line 1007 of file freedvmod.cpp.

References CalcDb::dbPower(), SWGSDRangel::SWGChannelReport::getFreeDvModReport(), getMagSq(), m_audioSampleRate, m_outputSampleRate, SWGSDRangel::SWGFreeDVModReport::setAudioSampleRate(), SWGSDRangel::SWGFreeDVModReport::setChannelPowerDb(), and SWGSDRangel::SWGFreeDVModReport::setChannelSampleRate().

Referenced by webapiReportGet().

1008 {
1012 }
quint32 m_audioSampleRate
Definition: freedvmod.h:312
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
void setChannelSampleRate(qint32 channel_sample_rate)
double getMagSq() const
Definition: freedvmod.h:253
int m_outputSampleRate
Definition: freedvmod.h:283
void setChannelPowerDb(float channel_power_db)
SWGFreeDVModReport * getFreeDvModReport()
void setAudioSampleRate(qint32 audio_sample_rate)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatChannelSettings()

void FreeDVMod::webapiFormatChannelSettings ( SWGSDRangel::SWGChannelSettings response,
const FreeDVModSettings settings 
)
private

Definition at line 960 of file freedvmod.cpp.

References SWGSDRangel::SWGFreeDVModSettings::getAudioDeviceName(), SWGSDRangel::SWGFreeDVModSettings::getCwKeyer(), SWGSDRangel::SWGChannelSettings::getFreeDvModSettings(), SWGSDRangel::SWGFreeDVModSettings::getReverseApiAddress(), CWKeyer::getSettings(), SWGSDRangel::SWGFreeDVModSettings::getTitle(), FreeDVModSettings::m_audioDeviceName, FreeDVModSettings::m_audioMute, m_cwKeyer, FreeDVModSettings::m_freeDVMode, FreeDVModSettings::m_gaugeInputElseModem, FreeDVModSettings::m_inputFrequencyOffset, FreeDVModSettings::m_modAFInput, FreeDVModSettings::m_playLoop, FreeDVModSettings::m_reverseAPIAddress, FreeDVModSettings::m_reverseAPIChannelIndex, FreeDVModSettings::m_reverseAPIDeviceIndex, FreeDVModSettings::m_reverseAPIPort, FreeDVModSettings::m_rgbColor, FreeDVModSettings::m_spanLog2, FreeDVModSettings::m_title, FreeDVModSettings::m_toneFrequency, FreeDVModSettings::m_useReverseAPI, FreeDVModSettings::m_volumeFactor, SWGSDRangel::SWGFreeDVModSettings::setAudioDeviceName(), SWGSDRangel::SWGFreeDVModSettings::setAudioMute(), SWGSDRangel::SWGFreeDVModSettings::setCwKeyer(), SWGSDRangel::SWGFreeDVModSettings::setFreeDvMode(), SWGSDRangel::SWGFreeDVModSettings::setGaugeInputElseModem(), SWGSDRangel::SWGFreeDVModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGFreeDVModSettings::setModAfInput(), SWGSDRangel::SWGFreeDVModSettings::setPlayLoop(), SWGSDRangel::SWGFreeDVModSettings::setReverseApiAddress(), SWGSDRangel::SWGFreeDVModSettings::setReverseApiChannelIndex(), SWGSDRangel::SWGFreeDVModSettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGFreeDVModSettings::setReverseApiPort(), SWGSDRangel::SWGFreeDVModSettings::setRgbColor(), SWGSDRangel::SWGFreeDVModSettings::setSpanLog2(), SWGSDRangel::SWGFreeDVModSettings::setTitle(), SWGSDRangel::SWGFreeDVModSettings::setToneFrequency(), SWGSDRangel::SWGFreeDVModSettings::setUseReverseApi(), SWGSDRangel::SWGFreeDVModSettings::setVolumeFactor(), and CWKeyer::webapiFormatChannelSettings().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

961 {
965  response.getFreeDvModSettings()->setSpanLog2(settings.m_spanLog2);
966  response.getFreeDvModSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
967  response.getFreeDvModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
968  response.getFreeDvModSettings()->setRgbColor(settings.m_rgbColor);
970 
971  if (response.getFreeDvModSettings()->getTitle()) {
972  *response.getFreeDvModSettings()->getTitle() = settings.m_title;
973  } else {
974  response.getFreeDvModSettings()->setTitle(new QString(settings.m_title));
975  }
976 
977  response.getFreeDvModSettings()->setModAfInput((int) settings.m_modAFInput);
978  response.getFreeDvModSettings()->setFreeDvMode((int) settings.m_freeDVMode);
979 
980  if (response.getFreeDvModSettings()->getAudioDeviceName()) {
982  } else {
983  response.getFreeDvModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
984  }
985 
986  if (!response.getFreeDvModSettings()->getCwKeyer()) {
988  }
989 
990  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
991  const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
992  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
993 
994  response.getFreeDvModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
995 
996  if (response.getFreeDvModSettings()->getReverseApiAddress()) {
998  } else {
999  response.getFreeDvModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
1000  }
1001 
1005 }
void setVolumeFactor(float volume_factor)
void setAudioDeviceName(QString *audio_device_name)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
uint16_t m_reverseAPIDeviceIndex
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setReverseApiPort(qint32 reverse_api_port)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
void setReverseApiAddress(QString *reverse_api_address)
void setGaugeInputElseModem(qint32 gauge_input_else_modem)
void setToneFrequency(float tone_frequency)
SWGFreeDVModSettings * getFreeDvModSettings()
FreeDVModInputAF m_modAFInput
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setFreeDvMode(qint32 free_dv_mode)
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
void setModAfInput(qint32 mod_af_input)
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

int FreeDVMod::webapiReportGet ( SWGSDRangel::SWGChannelReport response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 949 of file freedvmod.cpp.

References SWGSDRangel::SWGChannelReport::getFreeDvModReport(), SWGSDRangel::SWGFreeDVModReport::init(), SWGSDRangel::SWGChannelReport::setFreeDvModReport(), and webapiFormatChannelReport().

Referenced by getStreamCenterFrequency().

952 {
953  (void) errorMessage;
955  response.getFreeDvModReport()->init();
956  webapiFormatChannelReport(response);
957  return 200;
958 }
void setFreeDvModReport(SWGFreeDVModReport *free_dv_mod_report)
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport &response)
Definition: freedvmod.cpp:1007
SWGFreeDVModReport * getFreeDvModReport()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendCWSettings()

void FreeDVMod::webapiReverseSendCWSettings ( const CWKeyerSettings settings)
private

Definition at line 1090 of file freedvmod.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), SWGSDRangel::SWGFreeDVModSettings::getCwKeyer(), SWGSDRangel::SWGChannelSettings::getFreeDvModSettings(), m_cwKeyer, m_networkManager, m_networkRequest, FreeDVModSettings::m_reverseAPIAddress, FreeDVModSettings::m_reverseAPIChannelIndex, FreeDVModSettings::m_reverseAPIDeviceIndex, FreeDVModSettings::m_reverseAPIPort, m_settings, SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGFreeDVModSettings::setCwKeyer(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGChannelSettings::setFreeDvModSettings(), and CWKeyer::webapiFormatChannelSettings().

Referenced by handleMessage().

1091 {
1093  swgChannelSettings->setDirection(1); // single source (Tx)
1094  swgChannelSettings->setChannelType(new QString("FreeDVMod"));
1095  swgChannelSettings->setFreeDvModSettings(new SWGSDRangel::SWGFreeDVModSettings());
1096  SWGSDRangel::SWGFreeDVModSettings *swgFreeDVModSettings = swgChannelSettings->getFreeDvModSettings();
1097 
1098  swgFreeDVModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
1099  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgFreeDVModSettings->getCwKeyer();
1100  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
1101 
1102  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
1107  m_networkRequest.setUrl(QUrl(channelSettingsURL));
1108  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
1109 
1110  QBuffer *buffer=new QBuffer();
1111  buffer->open((QBuffer::ReadWrite));
1112  buffer->write(swgChannelSettings->asJson().toUtf8());
1113  buffer->seek(0);
1114 
1115  // Always use PATCH to avoid passing reverse API settings
1116  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
1117 
1118  delete swgChannelSettings;
1119 }
QNetworkRequest m_networkRequest
Definition: freedvmod.h:331
uint16_t m_reverseAPIDeviceIndex
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setChannelType(QString *channel_type)
FreeDVModSettings m_settings
Definition: freedvmod.h:288
SWGFreeDVModSettings * getFreeDvModSettings()
QNetworkAccessManager * m_networkManager
Definition: freedvmod.h:330
virtual QString asJson() override
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
uint16_t m_reverseAPIChannelIndex
void setFreeDvModSettings(SWGFreeDVModSettings *free_dv_mod_settings)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

void FreeDVMod::webapiReverseSendSettings ( QList< QString > &  channelSettingsKeys,
const FreeDVModSettings settings,
bool  force 
)
private

Definition at line 1014 of file freedvmod.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), SWGSDRangel::SWGFreeDVModSettings::getCwKeyer(), ChannelAPI::getDeviceSetIndex(), SWGSDRangel::SWGChannelSettings::getFreeDvModSettings(), ChannelAPI::getIndexInDeviceSet(), CWKeyer::getSettings(), FreeDVModSettings::m_audioDeviceName, FreeDVModSettings::m_audioMute, m_cwKeyer, FreeDVModSettings::m_freeDVMode, FreeDVModSettings::m_gaugeInputElseModem, FreeDVModSettings::m_inputFrequencyOffset, FreeDVModSettings::m_modAFInput, m_networkManager, m_networkRequest, FreeDVModSettings::m_playLoop, FreeDVModSettings::m_reverseAPIAddress, FreeDVModSettings::m_reverseAPIChannelIndex, FreeDVModSettings::m_reverseAPIDeviceIndex, FreeDVModSettings::m_reverseAPIPort, FreeDVModSettings::m_rgbColor, FreeDVModSettings::m_spanLog2, FreeDVModSettings::m_title, FreeDVModSettings::m_toneFrequency, FreeDVModSettings::m_volumeFactor, SWGSDRangel::SWGFreeDVModSettings::setAudioDeviceName(), SWGSDRangel::SWGFreeDVModSettings::setAudioMute(), SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGFreeDVModSettings::setCwKeyer(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGFreeDVModSettings::setFreeDvMode(), SWGSDRangel::SWGChannelSettings::setFreeDvModSettings(), SWGSDRangel::SWGFreeDVModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGFreeDVModSettings::setModAfInput(), SWGSDRangel::SWGChannelSettings::setOriginatorChannelIndex(), SWGSDRangel::SWGChannelSettings::setOriginatorDeviceSetIndex(), SWGSDRangel::SWGFreeDVModSettings::setPlayLoop(), SWGSDRangel::SWGFreeDVModSettings::setRgbColor(), SWGSDRangel::SWGFreeDVModSettings::setSpanLog2(), SWGSDRangel::SWGFreeDVModSettings::setTitle(), SWGSDRangel::SWGFreeDVModSettings::setToneFrequency(), SWGSDRangel::SWGFreeDVModSettings::setVolumeFactor(), and CWKeyer::webapiFormatChannelSettings().

Referenced by applySettings().

1015 {
1017  swgChannelSettings->setDirection(1); // single source (Tx)
1018  swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
1019  swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
1020  swgChannelSettings->setChannelType(new QString("FreeDVMod"));
1021  swgChannelSettings->setFreeDvModSettings(new SWGSDRangel::SWGFreeDVModSettings());
1022  SWGSDRangel::SWGFreeDVModSettings *swgFreeDVModSettings = swgChannelSettings->getFreeDvModSettings();
1023 
1024  // transfer data that has been modified. When force is on transfer all data except reverse API data
1025 
1026  if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
1027  swgFreeDVModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
1028  }
1029  if (channelSettingsKeys.contains("toneFrequency") || force) {
1030  swgFreeDVModSettings->setToneFrequency(settings.m_toneFrequency);
1031  }
1032  if (channelSettingsKeys.contains("volumeFactor") || force) {
1033  swgFreeDVModSettings->setVolumeFactor(settings.m_volumeFactor);
1034  }
1035  if (channelSettingsKeys.contains("spanLog2") || force) {
1036  swgFreeDVModSettings->setSpanLog2(settings.m_spanLog2);
1037  }
1038  if (channelSettingsKeys.contains("audioMute") || force) {
1039  swgFreeDVModSettings->setAudioMute(settings.m_audioMute ? 1 : 0);
1040  }
1041  if (channelSettingsKeys.contains("playLoop") || force) {
1042  swgFreeDVModSettings->setPlayLoop(settings.m_playLoop ? 1 : 0);
1043  }
1044  if (channelSettingsKeys.contains("gaugeInputElseModem") || force) {
1045  swgFreeDVModSettings->setPlayLoop(settings.m_gaugeInputElseModem ? 1 : 0);
1046  }
1047  if (channelSettingsKeys.contains("rgbColor") || force) {
1048  swgFreeDVModSettings->setRgbColor(settings.m_rgbColor);
1049  }
1050  if (channelSettingsKeys.contains("title") || force) {
1051  swgFreeDVModSettings->setTitle(new QString(settings.m_title));
1052  }
1053  if (channelSettingsKeys.contains("freeDVMode") || force) {
1054  swgFreeDVModSettings->setFreeDvMode((int) settings.m_freeDVMode);
1055  }
1056  if (channelSettingsKeys.contains("modAFInput") || force) {
1057  swgFreeDVModSettings->setModAfInput((int) settings.m_modAFInput);
1058  }
1059  if (channelSettingsKeys.contains("audioDeviceName") || force) {
1060  swgFreeDVModSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
1061  }
1062 
1063  if (force)
1064  {
1065  const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
1066  swgFreeDVModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
1067  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgFreeDVModSettings->getCwKeyer();
1068  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
1069  }
1070 
1071  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
1072  .arg(settings.m_reverseAPIAddress)
1073  .arg(settings.m_reverseAPIPort)
1074  .arg(settings.m_reverseAPIDeviceIndex)
1075  .arg(settings.m_reverseAPIChannelIndex);
1076  m_networkRequest.setUrl(QUrl(channelSettingsURL));
1077  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
1078 
1079  QBuffer *buffer=new QBuffer();
1080  buffer->open((QBuffer::ReadWrite));
1081  buffer->write(swgChannelSettings->asJson().toUtf8());
1082  buffer->seek(0);
1083 
1084  // Always use PATCH to avoid passing reverse API settings
1085  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
1086 
1087  delete swgChannelSettings;
1088 }
void setVolumeFactor(float volume_factor)
QNetworkRequest m_networkRequest
Definition: freedvmod.h:331
void setAudioDeviceName(QString *audio_device_name)
void setOriginatorChannelIndex(qint32 originator_channel_index)
uint16_t m_reverseAPIDeviceIndex
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
int getDeviceSetIndex() const
Definition: channelapi.h:89
void setChannelType(QString *channel_type)
void setOriginatorDeviceSetIndex(qint32 originator_device_set_index)
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
void setToneFrequency(float tone_frequency)
SWGFreeDVModSettings * getFreeDvModSettings()
QNetworkAccessManager * m_networkManager
Definition: freedvmod.h:330
FreeDVModInputAF m_modAFInput
void setInputFrequencyOffset(qint64 input_frequency_offset)
virtual QString asJson() override
void setFreeDvMode(qint32 free_dv_mode)
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
void setModAfInput(qint32 mod_af_input)
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
uint16_t m_reverseAPIChannelIndex
int getIndexInDeviceSet() const
Definition: channelapi.h:87
void setFreeDvModSettings(SWGFreeDVModSettings *free_dv_mod_settings)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsGet()

int FreeDVMod::webapiSettingsGet ( SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 837 of file freedvmod.cpp.

References SWGSDRangel::SWGChannelSettings::getFreeDvModSettings(), SWGSDRangel::SWGFreeDVModSettings::init(), m_settings, SWGSDRangel::SWGChannelSettings::setFreeDvModSettings(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

840 {
841  (void) errorMessage;
843  response.getFreeDvModSettings()->init();
845  return 200;
846 }
FreeDVModSettings m_settings
Definition: freedvmod.h:288
SWGFreeDVModSettings * getFreeDvModSettings()
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const FreeDVModSettings &settings)
Definition: freedvmod.cpp:960
void setFreeDvModSettings(SWGFreeDVModSettings *free_dv_mod_settings)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

int FreeDVMod::webapiSettingsPutPatch ( bool  force,
const QStringList &  channelSettingsKeys,
SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 848 of file freedvmod.cpp.

References FreeDVMod::MsgConfigureFreeDVMod::create(), CWKeyer::MsgConfigureCWKeyer::create(), FreeDVMod::MsgConfigureChannelizer::create(), SWGSDRangel::SWGFreeDVModSettings::getAudioDeviceName(), SWGSDRangel::SWGFreeDVModSettings::getAudioMute(), SWGSDRangel::SWGFreeDVModSettings::getCwKeyer(), SWGSDRangel::SWGFreeDVModSettings::getFreeDvMode(), SWGSDRangel::SWGChannelSettings::getFreeDvModSettings(), SWGSDRangel::SWGFreeDVModSettings::getGaugeInputElseModem(), SWGSDRangel::SWGFreeDVModSettings::getInputFrequencyOffset(), CWKeyer::getInputMessageQueue(), SWGSDRangel::SWGFreeDVModSettings::getModAfInput(), SWGSDRangel::SWGFreeDVModSettings::getPlayLoop(), SWGSDRangel::SWGFreeDVModSettings::getReverseApiAddress(), SWGSDRangel::SWGFreeDVModSettings::getReverseApiChannelIndex(), SWGSDRangel::SWGFreeDVModSettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGFreeDVModSettings::getReverseApiPort(), SWGSDRangel::SWGFreeDVModSettings::getRgbColor(), CWKeyer::getSettings(), SWGSDRangel::SWGFreeDVModSettings::getSpanLog2(), SWGSDRangel::SWGFreeDVModSettings::getTitle(), SWGSDRangel::SWGFreeDVModSettings::getToneFrequency(), SWGSDRangel::SWGFreeDVModSettings::getUseReverseApi(), SWGSDRangel::SWGFreeDVModSettings::getVolumeFactor(), FreeDVModSettings::m_audioDeviceName, FreeDVModSettings::m_audioMute, m_audioSampleRate, m_cwKeyer, FreeDVModSettings::m_freeDVMode, FreeDVModSettings::m_gaugeInputElseModem, BasebandSampleSource::m_guiMessageQueue, FreeDVModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, FreeDVModSettings::m_modAFInput, FreeDVModSettings::m_playLoop, FreeDVModSettings::m_reverseAPIAddress, FreeDVModSettings::m_reverseAPIChannelIndex, FreeDVModSettings::m_reverseAPIDeviceIndex, FreeDVModSettings::m_reverseAPIPort, FreeDVModSettings::m_rgbColor, m_settings, FreeDVModSettings::m_spanLog2, FreeDVModSettings::m_title, FreeDVModSettings::m_toneFrequency, FreeDVModSettings::m_useReverseAPI, FreeDVModSettings::m_volumeFactor, MessageQueue::push(), webapiFormatChannelSettings(), and CWKeyer::webapiSettingsPutPatch().

Referenced by getStreamCenterFrequency().

853 {
854  (void) errorMessage;
855  FreeDVModSettings settings = m_settings;
856  bool frequencyOffsetChanged = false;
857 
858  if (channelSettingsKeys.contains("inputFrequencyOffset"))
859  {
861  frequencyOffsetChanged = true;
862  }
863  if (channelSettingsKeys.contains("toneFrequency")) {
864  settings.m_toneFrequency = response.getFreeDvModSettings()->getToneFrequency();
865  }
866  if (channelSettingsKeys.contains("volumeFactor")) {
867  settings.m_volumeFactor = response.getFreeDvModSettings()->getVolumeFactor();
868  }
869  if (channelSettingsKeys.contains("spanLog2")) {
870  settings.m_spanLog2 = response.getFreeDvModSettings()->getSpanLog2();
871  }
872  if (channelSettingsKeys.contains("audioMute")) {
873  settings.m_audioMute = response.getFreeDvModSettings()->getAudioMute() != 0;
874  }
875  if (channelSettingsKeys.contains("playLoop")) {
876  settings.m_playLoop = response.getFreeDvModSettings()->getPlayLoop() != 0;
877  }
878  if (channelSettingsKeys.contains("gaugeInputElseModem")) {
880  }
881  if (channelSettingsKeys.contains("rgbColor")) {
882  settings.m_rgbColor = response.getFreeDvModSettings()->getRgbColor();
883  }
884  if (channelSettingsKeys.contains("title")) {
885  settings.m_title = *response.getFreeDvModSettings()->getTitle();
886  }
887  if (channelSettingsKeys.contains("freeDVMode")) {
889  }
890  if (channelSettingsKeys.contains("modAFInput")) {
892  }
893  if (channelSettingsKeys.contains("audioDeviceName")) {
895  }
896  if (channelSettingsKeys.contains("useReverseAPI")) {
897  settings.m_useReverseAPI = response.getFreeDvModSettings()->getUseReverseApi() != 0;
898  }
899  if (channelSettingsKeys.contains("reverseAPIAddress")) {
901  }
902  if (channelSettingsKeys.contains("reverseAPIPort")) {
904  }
905  if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
907  }
908  if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
910  }
911 
912  if (channelSettingsKeys.contains("cwKeyer"))
913  {
914  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getFreeDvModSettings()->getCwKeyer();
915  CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
916  m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
917 
918  CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
919  m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
920 
921  if (m_guiMessageQueue) // forward to GUI if any
922  {
923  CWKeyer::MsgConfigureCWKeyer *msgCwKeyerToGUI = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
924  m_guiMessageQueue->push(msgCwKeyerToGUI);
925  }
926  }
927 
928  if (frequencyOffsetChanged)
929  {
932  m_inputMessageQueue.push(msgChan);
933  }
934 
935  MsgConfigureFreeDVMod *msg = MsgConfigureFreeDVMod::create(settings, force);
937 
938  if (m_guiMessageQueue) // forward to GUI if any
939  {
940  MsgConfigureFreeDVMod *msgToGUI = MsgConfigureFreeDVMod::create(settings, force);
941  m_guiMessageQueue->push(msgToGUI);
942  }
943 
944  webapiFormatChannelSettings(response, settings);
945 
946  return 200;
947 }
static MsgConfigureFreeDVMod * create(const FreeDVModSettings &settings, bool force)
Definition: freedvmod.h:62
uint16_t m_reverseAPIDeviceIndex
void push(Message *message, bool emitSignal=true)
Push message onto queue.
quint32 m_audioSampleRate
Definition: freedvmod.h:312
CWKeyer m_cwKeyer
Definition: freedvmod.h:328
static MsgConfigureCWKeyer * create(const CWKeyerSettings &settings, bool force)
Definition: cwkeyer.h:63
bool m_gaugeInputElseModem
Volume gauge shows speech input level else modem level.
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
Definition: cwkeyer.h:104
FreeDVModSettings m_settings
Definition: freedvmod.h:288
SWGFreeDVModSettings * getFreeDvModSettings()
FreeDVModInputAF m_modAFInput
static void webapiSettingsPutPatch(const QStringList &channelSettingsKeys, CWKeyerSettings &cwKeyerSettings, SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings)
Definition: cwkeyer.cpp:599
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: freedvmod.h:85
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const FreeDVModSettings &settings)
Definition: freedvmod.cpp:960
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_audioBuffer

AudioVector FreeDVMod::m_audioBuffer
private

Definition at line 313 of file freedvmod.h.

Referenced by FreeDVMod(), pullAF(), and pullAudio().

◆ m_audioBufferFill

uint FreeDVMod::m_audioBufferFill
private

Definition at line 314 of file freedvmod.h.

Referenced by FreeDVMod(), modulateSample(), pullAF(), and pullAudio().

◆ m_audioFifo

AudioFifo FreeDVMod::m_audioFifo
private

Definition at line 315 of file freedvmod.h.

Referenced by applySettings(), FreeDVMod(), pullAudio(), start(), and ~FreeDVMod().

◆ m_audioResampler

AudioResampler FreeDVMod::m_audioResampler
private

Definition at line 341 of file freedvmod.h.

Referenced by applyAudioSampleRate(), and pullAF().

◆ m_audioSampleRate

quint32 FreeDVMod::m_audioSampleRate
private

◆ m_basebandSampleRate

int FreeDVMod::m_basebandSampleRate
private

Definition at line 282 of file freedvmod.h.

Referenced by applyChannelSettings(), FreeDVMod(), and start().

◆ m_carrierNco

NCOF FreeDVMod::m_carrierNco
private

Definition at line 290 of file freedvmod.h.

Referenced by applyChannelSettings(), and pull().

◆ m_channelId

const QString FreeDVMod::m_channelId = "FreeDVMod"
static

Definition at line 260 of file freedvmod.h.

Referenced by FreeDVMod(), and FreeDVModPlugin::initPlugin().

◆ m_channelIdURI

const QString FreeDVMod::m_channelIdURI = "sdrangel.channeltx.freedvmod"
static

Definition at line 259 of file freedvmod.h.

Referenced by FreeDVModGUI::FreeDVModGUI(), and FreeDVModPlugin::initPlugin().

◆ m_channelizer

UpChannelizer* FreeDVMod::m_channelizer
private

Definition at line 280 of file freedvmod.h.

Referenced by FreeDVMod(), handleMessage(), and ~FreeDVMod().

◆ m_cwKeyer

CWKeyer FreeDVMod::m_cwKeyer
private

◆ m_deviceAPI

DeviceAPI* FreeDVMod::m_deviceAPI
private

Definition at line 278 of file freedvmod.h.

Referenced by FreeDVMod(), and ~FreeDVMod().

◆ m_fileName

QString FreeDVMod::m_fileName
private

◆ m_fileSize

quint64 FreeDVMod::m_fileSize
private

raw file size (bytes)

Definition at line 321 of file freedvmod.h.

Referenced by handleMessage(), and openFileStream().

◆ m_freeDV

struct freedv* FreeDVMod::m_freeDV
private

Definition at line 333 of file freedvmod.h.

Referenced by applyFreeDVMode(), pullAF(), and ~FreeDVMod().

◆ m_hiCutoff

Real FreeDVMod::m_hiCutoff
private

Definition at line 287 of file freedvmod.h.

Referenced by applyChannelSettings(), applyFreeDVMode(), FreeDVMod(), and getHiCutoff().

◆ m_ifstream

std::ifstream FreeDVMod::m_ifstream
private

Definition at line 319 of file freedvmod.h.

Referenced by handleMessage(), openFileStream(), pullAF(), and seekFileStream().

◆ m_iModem

int FreeDVMod::m_iModem
private

Definition at line 337 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_inputFrequencyOffset

int FreeDVMod::m_inputFrequencyOffset
private

Definition at line 285 of file freedvmod.h.

Referenced by applyChannelSettings(), FreeDVMod(), and start().

◆ m_inputSampleRate

int FreeDVMod::m_inputSampleRate
private

speech (input) sample rate (fixed 8000 S/s)

Definition at line 323 of file freedvmod.h.

Referenced by applyAudioSampleRate(), applySettings(), FreeDVMod(), openFileStream(), and seekFileStream().

◆ m_interpolator

Interpolator FreeDVMod::m_interpolator
private

Definition at line 293 of file freedvmod.h.

Referenced by applyChannelSettings(), applyFreeDVMode(), and pull().

◆ m_interpolatorConsumed

bool FreeDVMod::m_interpolatorConsumed
private

Definition at line 296 of file freedvmod.h.

Referenced by applyChannelSettings(), and applyFreeDVMode().

◆ m_interpolatorDistance

Real FreeDVMod::m_interpolatorDistance
private

Definition at line 294 of file freedvmod.h.

Referenced by applyChannelSettings(), applyFreeDVMode(), and pull().

◆ m_interpolatorDistanceRemain

Real FreeDVMod::m_interpolatorDistanceRemain
private

Definition at line 295 of file freedvmod.h.

Referenced by applyChannelSettings(), applyFreeDVMode(), and pull().

◆ m_iSpeech

int FreeDVMod::m_iSpeech
private

Definition at line 336 of file freedvmod.h.

Referenced by applyFreeDVMode().

◆ m_levelCalcCount

quint32 FreeDVMod::m_levelCalcCount
private

Definition at line 325 of file freedvmod.h.

Referenced by calculateLevel().

◆ m_levelNbSamples

const int FreeDVMod::m_levelNbSamples = 80
staticprivate

Definition at line 343 of file freedvmod.h.

Referenced by calculateLevel().

◆ m_levelSum

Real FreeDVMod::m_levelSum
private

Definition at line 327 of file freedvmod.h.

Referenced by calculateLevel().

◆ m_lowCutoff

Real FreeDVMod::m_lowCutoff
private

Definition at line 286 of file freedvmod.h.

Referenced by applyFreeDVMode(), FreeDVMod(), and getLowCutoff().

◆ m_magsq

double FreeDVMod::m_magsq
private

Definition at line 309 of file freedvmod.h.

Referenced by FreeDVMod(), getMagSq(), and pull().

◆ m_modemSampleRate

int FreeDVMod::m_modemSampleRate
private

Definition at line 284 of file freedvmod.h.

Referenced by applyChannelSettings(), applyFreeDVMode(), getModemSampleRate(), and pullAudio().

◆ m_modOut

int16_t* FreeDVMod::m_modOut
private

Definition at line 339 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_modSample

Complex FreeDVMod::m_modSample
private

Definition at line 292 of file freedvmod.h.

Referenced by modulateSample(), and pull().

◆ m_movingAverage

MovingAverageUtil<double, double, 16> FreeDVMod::m_movingAverage
private

Definition at line 310 of file freedvmod.h.

Referenced by pull().

◆ m_networkManager

QNetworkAccessManager* FreeDVMod::m_networkManager
private

◆ m_networkRequest

QNetworkRequest FreeDVMod::m_networkRequest
private

Definition at line 331 of file freedvmod.h.

Referenced by webapiReverseSendCWSettings(), and webapiReverseSendSettings().

◆ m_nNomModemSamples

int FreeDVMod::m_nNomModemSamples
private

Definition at line 335 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_nSpeechSamples

int FreeDVMod::m_nSpeechSamples
private

Definition at line 334 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_outputSampleRate

int FreeDVMod::m_outputSampleRate
private

◆ m_peakLevel

Real FreeDVMod::m_peakLevel
private

Definition at line 326 of file freedvmod.h.

Referenced by calculateLevel().

◆ m_recordLength

quint32 FreeDVMod::m_recordLength
private

record length in seconds computed from file size

Definition at line 322 of file freedvmod.h.

Referenced by FreeDVMod::MsgReportFileSourceStreamData::getRecordLength(), openFileStream(), and seekFileStream().

◆ m_sampleBuffer

SampleVector FreeDVMod::m_sampleBuffer
private

Definition at line 303 of file freedvmod.h.

Referenced by pullAF().

◆ m_sampleSink

BasebandSampleSink* FreeDVMod::m_sampleSink
private

Definition at line 302 of file freedvmod.h.

Referenced by pullAF(), and setSpectrumSampleSink().

◆ m_scaleFactor

float FreeDVMod::m_scaleFactor
private

divide by this amount to scale from int16 to float in [-1.0, 1.0] interval

Definition at line 340 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_settings

FreeDVModSettings FreeDVMod::m_settings
private

◆ m_settingsMutex

QMutex FreeDVMod::m_settingsMutex
private

◆ m_speechIn

int16_t* FreeDVMod::m_speechIn
private

Definition at line 338 of file freedvmod.h.

Referenced by applyFreeDVMode(), and pullAF().

◆ m_ssbFftLen

const int FreeDVMod::m_ssbFftLen = 1024
staticprivate

Definition at line 300 of file freedvmod.h.

Referenced by FreeDVMod().

◆ m_SSBFilter

fftfilt* FreeDVMod::m_SSBFilter
private

Definition at line 297 of file freedvmod.h.

Referenced by applyFreeDVMode(), FreeDVMod(), pullAF(), and ~FreeDVMod().

◆ m_SSBFilterBuffer

Complex* FreeDVMod::m_SSBFilterBuffer
private

Definition at line 298 of file freedvmod.h.

Referenced by FreeDVMod(), pullAF(), and ~FreeDVMod().

◆ m_SSBFilterBufferIndex

int FreeDVMod::m_SSBFilterBufferIndex
private

Definition at line 299 of file freedvmod.h.

Referenced by pullAF().

◆ m_sum

fftfilt::cmplx FreeDVMod::m_sum
private

Definition at line 305 of file freedvmod.h.

Referenced by FreeDVMod(), and pullAF().

◆ m_sumCount

int FreeDVMod::m_sumCount
private

Definition at line 307 of file freedvmod.h.

Referenced by FreeDVMod().

◆ m_threadedChannelizer

ThreadedBasebandSampleSource* FreeDVMod::m_threadedChannelizer
private

Definition at line 279 of file freedvmod.h.

Referenced by FreeDVMod(), and ~FreeDVMod().

◆ m_toneNco

NCOF FreeDVMod::m_toneNco
private

Definition at line 291 of file freedvmod.h.

Referenced by applySettings(), FreeDVMod(), and pullAF().

◆ m_undersampleCount

int FreeDVMod::m_undersampleCount
private

Definition at line 306 of file freedvmod.h.

Referenced by FreeDVMod(), and pullAF().


The documentation for this class was generated from the following files: