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
NFMMod Class Reference

#include <nfmmod.h>

+ Inheritance diagram for NFMMod:
+ Collaboration diagram for NFMMod:

Classes

class  MsgConfigureChannelizer
 
class  MsgConfigureFileSourceName
 
class  MsgConfigureFileSourceSeek
 
class  MsgConfigureFileSourceStreamTiming
 
class  MsgConfigureNFMMod
 
class  MsgReportFileSourceStreamData
 
class  MsgReportFileSourceStreamTiming
 

Signals

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

Public Member Functions

 NFMMod (DeviceAPI *deviceAPI)
 
 ~NFMMod ()
 
virtual void destroy ()
 
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)
 
double getMagSq () 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.modnfm"
 
static const QString m_channelId = "NFMMod"
 

Private Types

enum  RateState { RSInitialFill, RSRunning }
 

Private Slots

void networkManagerFinished (QNetworkReply *reply)
 

Private Member Functions

void applyAudioSampleRate (int sampleRate)
 
void applyFeedbackAudioSampleRate (unsigned int sampleRate)
 
void processOneSample (Complex &ci)
 
void applyChannelSettings (int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
 
void applySettings (const NFMModSettings &settings, bool force=false)
 
void pullAF (Real &sample)
 
void pushFeedback (Real sample)
 
void calculateLevel (Real &sample)
 
void modulateSample ()
 
void openFileStream ()
 
void seekFileStream (int seekPercentage)
 
void webapiFormatChannelSettings (SWGSDRangel::SWGChannelSettings &response, const NFMModSettings &settings)
 
void webapiFormatChannelReport (SWGSDRangel::SWGChannelReport &response)
 
void webapiReverseSendSettings (QList< QString > &channelSettingsKeys, const NFMModSettings &settings, bool force)
 
void webapiReverseSendCWSettings (const CWKeyerSettings &settings)
 

Private Attributes

DeviceAPIm_deviceAPI
 
ThreadedBasebandSampleSourcem_threadedChannelizer
 
UpChannelizerm_channelizer
 
int m_basebandSampleRate
 
int m_outputSampleRate
 
int m_inputFrequencyOffset
 
NFMModSettings m_settings
 
NCO m_carrierNco
 
NCOF m_toneNco
 
NCOF m_ctcssNco
 
float m_modPhasor
 baseband modulator phasor More...
 
Complex m_modSample
 
Interpolator m_interpolator
 
Real m_interpolatorDistance
 
Real m_interpolatorDistanceRemain
 
bool m_interpolatorConsumed
 
Interpolator m_feedbackInterpolator
 
Real m_feedbackInterpolatorDistance
 
Real m_feedbackInterpolatorDistanceRemain
 
bool m_feedbackInterpolatorConsumed
 
Lowpass< Realm_lowpass
 
Bandpass< Realm_bandpass
 
double m_magsq
 
MovingAverageUtil< double, double, 16 > m_movingAverage
 
quint32 m_audioSampleRate
 
AudioVector m_audioBuffer
 
uint m_audioBufferFill
 
AudioFifo m_audioFifo
 
quint32 m_feedbackAudioSampleRate
 
AudioVector m_feedbackAudioBuffer
 
uint m_feedbackAudioBufferFill
 
AudioFifo m_feedbackAudioFifo
 
SampleVector m_sampleBuffer
 
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_sampleRate
 
NFMModSettings::NFMModInputAF m_afInput
 
quint32 m_levelCalcCount
 
Real m_peakLevel
 
Real m_levelSum
 
CWKeyer m_cwKeyer
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 

Static Private Attributes

static const int m_levelNbSamples = 480
 

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 49 of file nfmmod.h.

Member Enumeration Documentation

◆ RateState

enum NFMMod::RateState
private
Enumerator
RSInitialFill 
RSRunning 

Definition at line 265 of file nfmmod.h.

265  {
267  RSRunning
268  };

Constructor & Destructor Documentation

◆ NFMMod()

NFMMod::NFMMod ( DeviceAPI deviceAPI)

Definition at line 55 of file nfmmod.cpp.

References AudioDeviceManager::addAudioSink(), AudioDeviceManager::addAudioSource(), DeviceAPI::addChannelSource(), DeviceAPI::addChannelSourceAPI(), applyChannelSettings(), applyFeedbackAudioSampleRate(), applySettings(), Lowpass< Type >::create(), DSPEngine::getAudioDeviceManager(), BasebandSampleSource::getInputMessageQueue(), AudioDeviceManager::getInputSampleRate(), AudioDeviceManager::getOutputSampleRate(), DSPEngine::instance(), m_audioBuffer, m_audioBufferFill, m_audioFifo, m_audioSampleRate, m_basebandSampleRate, m_channelId, m_channelizer, m_ctcssNco, m_cwKeyer, m_deviceAPI, m_feedbackAudioBuffer, m_feedbackAudioBufferFill, m_feedbackAudioFifo, m_feedbackAudioSampleRate, m_inputFrequencyOffset, m_lowpass, m_magsq, m_networkManager, m_outputSampleRate, m_settings, m_threadedChannelizer, m_toneNco, networkManagerFinished(), CWKeyer::reset(), NCOF::setFreq(), and CWKeyer::setSampleRate().

Referenced by NFMMod::MsgReportFileSourceStreamData::MsgReportFileSourceStreamData().

55  :
57  m_deviceAPI(deviceAPI),
58  m_basebandSampleRate(48000),
59  m_outputSampleRate(48000),
61  m_modPhasor(0.0f),
62  m_audioFifo(4800),
63  m_feedbackAudioFifo(48000),
64  m_settingsMutex(QMutex::Recursive),
65  m_fileSize(0),
66  m_recordLength(0),
67  m_sampleRate(48000),
69  m_peakLevel(0.0f),
70  m_levelSum(0.0f)
71 {
72  setObjectName(m_channelId);
73 
74  m_audioBuffer.resize(1<<14);
76 
77  m_feedbackAudioBuffer.resize(1<<14);
79 
80  m_magsq = 0.0;
81 
84 
88 
89  m_lowpass.create(301, m_audioSampleRate, 250.0);
93  m_cwKeyer.reset();
94 
97 
98  m_channelizer = new UpChannelizer(this);
102 
103  m_networkManager = new QNetworkAccessManager();
104  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
105 }
NCOF m_toneNco
Definition: nfmmod.h:280
void addAudioSink(AudioFifo *audioFifo, MessageQueue *sampleSinkMessageQueue, int outputDeviceIndex=-1)
Add the audio sink.
static const QString m_channelIdURI
Definition: nfmmod.h:251
uint m_feedbackAudioBufferFill
Definition: nfmmod.h:308
int getOutputSampleRate(int outputDeviceIndex=-1)
void networkManagerFinished(QNetworkReply *reply)
Definition: nfmmod.cpp:1023
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: nfmmod.cpp:538
double m_magsq
Definition: nfmmod.h:298
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
DeviceAPI * m_deviceAPI
Definition: nfmmod.h:270
int getInputSampleRate(int inputDeviceIndex=-1)
void create(int nTaps, double sampleRate, double cutoff)
Definition: lowpass.h:15
Real m_peakLevel
Definition: nfmmod.h:322
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
Exposes a single source stream (output, Tx)
Definition: channelapi.h:42
Real m_levelSum
Definition: nfmmod.h:323
void addChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Add a channel source (Tx)
Definition: deviceapi.cpp:138
int m_sampleRate
Definition: nfmmod.h:318
void addAudioSource(AudioFifo *audioFifo, MessageQueue *sampleSourceMessageQueue, int inputDeviceIndex=-1)
Add an audio source.
AudioFifo m_audioFifo
Definition: nfmmod.h:304
AudioVector m_audioBuffer
Definition: nfmmod.h:302
static DSPEngine * instance()
Definition: dspengine.cpp:51
quint32 m_recordLength
record length in seconds computed from file size
Definition: nfmmod.h:317
AudioVector m_feedbackAudioBuffer
Definition: nfmmod.h:307
ChannelAPI(const QString &name, StreamType streamType)
Definition: channelapi.cpp:23
quint32 m_feedbackAudioSampleRate
Definition: nfmmod.h:306
UpChannelizer * m_channelizer
Definition: nfmmod.h:272
NFMModSettings m_settings
Definition: nfmmod.h:277
NCOF m_ctcssNco
Definition: nfmmod.h:281
quint32 m_levelCalcCount
Definition: nfmmod.h:321
int m_basebandSampleRate
Definition: nfmmod.h:274
uint m_audioBufferFill
Definition: nfmmod.h:303
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
void applySettings(const NFMModSettings &settings, bool force=false)
Definition: nfmmod.cpp:568
quint32 m_audioSampleRate
Definition: nfmmod.h:301
Lowpass< Real > m_lowpass
Definition: nfmmod.h:295
QNetworkAccessManager * m_networkManager
Definition: nfmmod.h:326
void applyFeedbackAudioSampleRate(unsigned int sampleRate)
Definition: nfmmod.cpp:521
static const QString m_channelId
Definition: nfmmod.h:252
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: nfmmod.h:271
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
quint64 m_fileSize
raw file size (bytes)
Definition: nfmmod.h:316
float m_modPhasor
baseband modulator phasor
Definition: nfmmod.h:282
AudioFifo m_feedbackAudioFifo
Definition: nfmmod.h:309
void addChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:174
void reset()
Definition: cwkeyer.h:109
int m_outputSampleRate
Definition: nfmmod.h:275
void setSampleRate(int sampleRate)
Definition: cwkeyer.cpp:186
QMutex m_settingsMutex
Definition: nfmmod.h:312
int m_inputFrequencyOffset
Definition: nfmmod.h:276
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~NFMMod()

NFMMod::~NFMMod ( )

Definition at line 107 of file nfmmod.cpp.

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

Referenced by NFMMod::MsgReportFileSourceStreamData::MsgReportFileSourceStreamData().

108 {
109  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
110  delete m_networkManager;
115  delete m_threadedChannelizer;
116  delete m_channelizer;
117 }
void networkManagerFinished(QNetworkReply *reply)
Definition: nfmmod.cpp:1023
void removeChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:181
DeviceAPI * m_deviceAPI
Definition: nfmmod.h:270
void removeChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Remove a channel source (Tx)
Definition: deviceapi.cpp:147
void removeAudioSink(AudioFifo *audioFifo)
Remove the audio sink.
AudioFifo m_audioFifo
Definition: nfmmod.h:304
static DSPEngine * instance()
Definition: dspengine.cpp:51
UpChannelizer * m_channelizer
Definition: nfmmod.h:272
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
QNetworkAccessManager * m_networkManager
Definition: nfmmod.h:326
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: nfmmod.h:271
AudioFifo m_feedbackAudioFifo
Definition: nfmmod.h:309
void removeAudioSource(AudioFifo *audioFifo)
Remove an audio source.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applyAudioSampleRate()

void NFMMod::applyAudioSampleRate ( int  sampleRate)
private

Definition at line 495 of file nfmmod.cpp.

References applyFeedbackAudioSampleRate(), Bandpass< Type >::create(), Lowpass< Type >::create(), Interpolator::create(), NFMMod::MsgConfigureChannelizer::create(), NFMModSettings::getCTCSSFreq(), NFMModSettings::m_afBandwidth, m_audioSampleRate, m_bandpass, NFMModSettings::m_ctcssIndex, m_ctcssNco, m_cwKeyer, m_feedbackAudioSampleRate, NFMModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, m_interpolator, m_interpolatorConsumed, m_interpolatorDistance, m_interpolatorDistanceRemain, m_lowpass, m_outputSampleRate, NFMModSettings::m_rfBandwidth, m_settings, m_settingsMutex, NFMModSettings::m_toneFrequency, m_toneNco, MessageQueue::push(), NCOF::setFreq(), and CWKeyer::setSampleRate().

Referenced by applySettings(), and handleMessage().

496 {
497  qDebug("NFMMod::applyAudioSampleRate: %d", sampleRate);
498 
499  MsgConfigureChannelizer* channelConfigMsg = MsgConfigureChannelizer::create(
500  sampleRate, m_settings.m_inputFrequencyOffset);
501  m_inputMessageQueue.push(channelConfigMsg);
502 
503  m_settingsMutex.lock();
504 
506  m_interpolatorConsumed = false;
508  m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
509  m_lowpass.create(301, sampleRate, 250.0);
510  m_bandpass.create(301, sampleRate, 300.0, m_settings.m_afBandwidth);
513  m_cwKeyer.setSampleRate(sampleRate);
514 
515  m_settingsMutex.unlock();
516 
517  m_audioSampleRate = sampleRate;
519 }
NCOF m_toneNco
Definition: nfmmod.h:280
void push(Message *message, bool emitSignal=true)
Push message onto queue.
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
void create(int nTaps, double sampleRate, double lowCutoff, double highCutoff)
Definition: bandpass.h:15
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
Bandpass< Real > m_bandpass
Definition: nfmmod.h:296
void create(int nTaps, double sampleRate, double cutoff)
Definition: lowpass.h:15
Interpolator m_interpolator
Definition: nfmmod.h:285
static float getCTCSSFreq(int index)
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: nfmmod.h:83
qint64 m_inputFrequencyOffset
Real m_interpolatorDistanceRemain
Definition: nfmmod.h:287
quint32 m_feedbackAudioSampleRate
Definition: nfmmod.h:306
NFMModSettings m_settings
Definition: nfmmod.h:277
NCOF m_ctcssNco
Definition: nfmmod.h:281
bool m_interpolatorConsumed
Definition: nfmmod.h:288
quint32 m_audioSampleRate
Definition: nfmmod.h:301
Lowpass< Real > m_lowpass
Definition: nfmmod.h:295
void applyFeedbackAudioSampleRate(unsigned int sampleRate)
Definition: nfmmod.cpp:521
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
int m_outputSampleRate
Definition: nfmmod.h:275
float Real
Definition: dsptypes.h:42
void setSampleRate(int sampleRate)
Definition: cwkeyer.cpp:186
QMutex m_settingsMutex
Definition: nfmmod.h:312
Real m_interpolatorDistance
Definition: nfmmod.h:286
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyChannelSettings()

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

Definition at line 538 of file nfmmod.cpp.

References Interpolator::create(), m_audioSampleRate, m_basebandSampleRate, m_carrierNco, m_inputFrequencyOffset, m_interpolator, m_interpolatorConsumed, m_interpolatorDistance, m_interpolatorDistanceRemain, m_outputSampleRate, NFMModSettings::m_rfBandwidth, m_settings, m_settingsMutex, and NCO::setFreq().

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

539 {
540  qDebug() << "NFMMod::applyChannelSettings:"
541  << " basebandSampleRate: " << basebandSampleRate
542  << " outputSampleRate: " << outputSampleRate
543  << " inputFrequencyOffset: " << inputFrequencyOffset;
544 
545  if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
546  (outputSampleRate != m_outputSampleRate) || force)
547  {
548  m_settingsMutex.lock();
549  m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
550  m_settingsMutex.unlock();
551  }
552 
553  if ((outputSampleRate != m_outputSampleRate) || force)
554  {
555  m_settingsMutex.lock();
557  m_interpolatorConsumed = false;
558  m_interpolatorDistance = (Real) m_audioSampleRate / (Real) outputSampleRate;
560  m_settingsMutex.unlock();
561  }
562 
563  m_basebandSampleRate = basebandSampleRate;
564  m_outputSampleRate = outputSampleRate;
565  m_inputFrequencyOffset = inputFrequencyOffset;
566 }
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
Interpolator m_interpolator
Definition: nfmmod.h:285
Real m_interpolatorDistanceRemain
Definition: nfmmod.h:287
NFMModSettings m_settings
Definition: nfmmod.h:277
void setFreq(Real freq, Real sampleRate)
Definition: nco.cpp:49
bool m_interpolatorConsumed
Definition: nfmmod.h:288
int m_basebandSampleRate
Definition: nfmmod.h:274
quint32 m_audioSampleRate
Definition: nfmmod.h:301
NCO m_carrierNco
Definition: nfmmod.h:279
int m_outputSampleRate
Definition: nfmmod.h:275
float Real
Definition: dsptypes.h:42
QMutex m_settingsMutex
Definition: nfmmod.h:312
int m_inputFrequencyOffset
Definition: nfmmod.h:276
Real m_interpolatorDistance
Definition: nfmmod.h:286
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFeedbackAudioSampleRate()

void NFMMod::applyFeedbackAudioSampleRate ( unsigned int  sampleRate)
private

Definition at line 521 of file nfmmod.cpp.

References Interpolator::create(), m_audioSampleRate, m_feedbackAudioSampleRate, m_feedbackInterpolator, m_feedbackInterpolatorConsumed, m_feedbackInterpolatorDistance, m_feedbackInterpolatorDistanceRemain, m_settingsMutex, and leansdr::min().

Referenced by applyAudioSampleRate(), applySettings(), handleMessage(), and NFMMod().

522 {
523  qDebug("NFMMod::applyFeedbackAudioSampleRate: %u", sampleRate);
524 
525  m_settingsMutex.lock();
526 
530  Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f;
531  m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
532 
533  m_settingsMutex.unlock();
534 
535  m_feedbackAudioSampleRate = sampleRate;
536 }
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
Interpolator m_feedbackInterpolator
Definition: nfmmod.h:290
quint32 m_feedbackAudioSampleRate
Definition: nfmmod.h:306
Real m_feedbackInterpolatorDistance
Definition: nfmmod.h:291
quint32 m_audioSampleRate
Definition: nfmmod.h:301
bool m_feedbackInterpolatorConsumed
Definition: nfmmod.h:293
float Real
Definition: dsptypes.h:42
QMutex m_settingsMutex
Definition: nfmmod.h:312
Real m_feedbackInterpolatorDistanceRemain
Definition: nfmmod.h:292
T min(const T &x, const T &y)
Definition: framework.h:440
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applySettings()

void NFMMod::applySettings ( const NFMModSettings settings,
bool  force = false 
)
private

Definition at line 568 of file nfmmod.cpp.

References AudioDeviceManager::addAudioSink(), AudioDeviceManager::addAudioSource(), applyAudioSampleRate(), applyFeedbackAudioSampleRate(), Lowpass< Type >::create(), Bandpass< Type >::create(), Interpolator::create(), DSPEngine::getAudioDeviceManager(), NFMModSettings::getCTCSSFreq(), AudioDeviceManager::getInputDeviceIndex(), BasebandSampleSource::getInputMessageQueue(), AudioDeviceManager::getInputSampleRate(), AudioDeviceManager::getOutputDeviceIndex(), AudioDeviceManager::getOutputSampleRate(), DSPEngine::instance(), NFMModSettings::m_afBandwidth, NFMModSettings::m_audioDeviceName, m_audioFifo, m_audioSampleRate, m_bandpass, NFMModSettings::m_channelMute, NFMModSettings::m_ctcssIndex, m_ctcssNco, NFMModSettings::m_ctcssOn, NFMModSettings::m_feedbackAudioDeviceName, m_feedbackAudioFifo, m_feedbackAudioSampleRate, NFMModSettings::m_fmDeviation, NFMModSettings::m_inputFrequencyOffset, m_interpolator, m_interpolatorConsumed, m_interpolatorDistance, m_interpolatorDistanceRemain, m_lowpass, NFMModSettings::m_modAFInput, m_outputSampleRate, NFMModSettings::m_playLoop, NFMModSettings::m_reverseAPIAddress, NFMModSettings::m_reverseAPIChannelIndex, NFMModSettings::m_reverseAPIDeviceIndex, NFMModSettings::m_reverseAPIPort, NFMModSettings::m_rfBandwidth, m_settings, m_settingsMutex, NFMModSettings::m_toneFrequency, m_toneNco, NFMModSettings::m_useReverseAPI, NFMModSettings::m_volumeFactor, NCOF::setFreq(), and webapiReverseSendSettings().

Referenced by handleMessage(), and NFMMod().

569 {
570  qDebug() << "NFMMod::applySettings:"
571  << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
572  << " m_rfBandwidth: " << settings.m_rfBandwidth
573  << " m_afBandwidth: " << settings.m_afBandwidth
574  << " m_fmDeviation: " << settings.m_fmDeviation
575  << " m_volumeFactor: " << settings.m_volumeFactor
576  << " m_toneFrequency: " << settings.m_toneFrequency
577  << " m_ctcssIndex: " << settings.m_ctcssIndex
578  << " m_ctcssOn: " << settings.m_ctcssOn
579  << " m_channelMute: " << settings.m_channelMute
580  << " m_playLoop: " << settings.m_playLoop
581  << " m_modAFInput " << settings.m_modAFInput
582  << " m_audioDeviceName: " << settings.m_audioDeviceName
583  << " m_useReverseAPI: " << settings.m_useReverseAPI
584  << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
585  << " m_reverseAPIAddress: " << settings.m_reverseAPIPort
586  << " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
587  << " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
588  << " force: " << force;
589 
590  QList<QString> reverseAPIKeys;
591 
592  if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
593  reverseAPIKeys.append("inputFrequencyOffset");
594  }
595 
596  if ((settings.m_fmDeviation != m_settings.m_fmDeviation) || force) {
597  reverseAPIKeys.append("fmDeviation");
598  }
599 
600  if ((settings.m_volumeFactor != m_settings.m_volumeFactor) || force) {
601  reverseAPIKeys.append("volumeFactor");
602  }
603 
604  if ((settings.m_ctcssOn != m_settings.m_ctcssOn) || force) {
605  reverseAPIKeys.append("ctcssOn");
606  }
607 
608  if ((settings.m_channelMute != m_settings.m_channelMute) || force) {
609  reverseAPIKeys.append("channelMute");
610  }
611 
612  if ((settings.m_playLoop != m_settings.m_playLoop) || force) {
613  reverseAPIKeys.append("playLoop");
614  }
615 
616  if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) {
617  reverseAPIKeys.append("modAFInput");
618  }
619 
620  if((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force)
621  {
622  reverseAPIKeys.append("rfBandwidth");
623  m_settingsMutex.lock();
625  m_interpolatorConsumed = false;
627  m_interpolator.create(48, m_audioSampleRate, settings.m_rfBandwidth / 2.2, 3.0);
628  m_settingsMutex.unlock();
629  }
630 
631  if ((settings.m_afBandwidth != m_settings.m_afBandwidth) || force)
632  {
633  reverseAPIKeys.append("afBandwidth");
634  m_settingsMutex.lock();
635  m_lowpass.create(301, m_audioSampleRate, 250.0);
636  m_bandpass.create(301, m_audioSampleRate, 300.0, settings.m_afBandwidth);
637  m_settingsMutex.unlock();
638  }
639 
640  if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force)
641  {
642  reverseAPIKeys.append("toneFrequency");
643  m_settingsMutex.lock();
645  m_settingsMutex.unlock();
646  }
647 
648  if ((settings.m_ctcssIndex != m_settings.m_ctcssIndex) || force)
649  {
650  reverseAPIKeys.append("ctcssIndex");
651  m_settingsMutex.lock();
653  m_settingsMutex.unlock();
654  }
655 
656  if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
657  {
658  reverseAPIKeys.append("audioDeviceName");
660  int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName);
661  audioDeviceManager->addAudioSource(&m_audioFifo, getInputMessageQueue(), audioDeviceIndex);
662  uint32_t audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex);
663 
664  if (m_audioSampleRate != audioSampleRate) {
665  reverseAPIKeys.append("audioSampleRate");
666  applyAudioSampleRate(audioSampleRate);
667  }
668  }
669 
671  {
672  reverseAPIKeys.append("feedbackAudioDeviceName");
674  int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_feedbackAudioDeviceName);
675  audioDeviceManager->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue(), audioDeviceIndex);
676  uint32_t audioSampleRate = audioDeviceManager->getOutputSampleRate(audioDeviceIndex);
677 
678  if (m_feedbackAudioSampleRate != audioSampleRate) {
679  reverseAPIKeys.append("feedbackAudioSampleRate");
680  applyFeedbackAudioSampleRate(audioSampleRate);
681  }
682  }
683 
684  if (settings.m_useReverseAPI)
685  {
686  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
691  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
692  }
693 
694  m_settings = settings;
695 }
NCOF m_toneNco
Definition: nfmmod.h:280
void webapiReverseSendSettings(QList< QString > &channelSettingsKeys, const NFMModSettings &settings, bool force)
Definition: nfmmod.cpp:910
void addAudioSink(AudioFifo *audioFifo, MessageQueue *sampleSinkMessageQueue, int outputDeviceIndex=-1)
Add the audio sink.
int getOutputSampleRate(int outputDeviceIndex=-1)
void create(int nTaps, double sampleRate, double lowCutoff, double highCutoff)
Definition: bandpass.h:15
int getInputSampleRate(int inputDeviceIndex=-1)
void create(int phaseSteps, double sampleRate, double cutoff, double nbTapsPerPhase=4.5)
Bandpass< Real > m_bandpass
Definition: nfmmod.h:296
void create(int nTaps, double sampleRate, double cutoff)
Definition: lowpass.h:15
int getOutputDeviceIndex(const QString &deviceName) const
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
Interpolator m_interpolator
Definition: nfmmod.h:285
static float getCTCSSFreq(int index)
unsigned int uint32_t
Definition: rtptypes_win.h:46
void addAudioSource(AudioFifo *audioFifo, MessageQueue *sampleSourceMessageQueue, int inputDeviceIndex=-1)
Add an audio source.
AudioFifo m_audioFifo
Definition: nfmmod.h:304
qint64 m_inputFrequencyOffset
static DSPEngine * instance()
Definition: dspengine.cpp:51
Real m_interpolatorDistanceRemain
Definition: nfmmod.h:287
quint32 m_feedbackAudioSampleRate
Definition: nfmmod.h:306
NFMModSettings m_settings
Definition: nfmmod.h:277
NCOF m_ctcssNco
Definition: nfmmod.h:281
bool m_interpolatorConsumed
Definition: nfmmod.h:288
uint16_t m_reverseAPIDeviceIndex
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
quint32 m_audioSampleRate
Definition: nfmmod.h:301
Lowpass< Real > m_lowpass
Definition: nfmmod.h:295
void applyFeedbackAudioSampleRate(unsigned int sampleRate)
Definition: nfmmod.cpp:521
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
NFMModInputAF m_modAFInput
QString m_audioDeviceName
This is the audio device you get the audio samples from.
int getInputDeviceIndex(const QString &deviceName) const
AudioFifo m_feedbackAudioFifo
Definition: nfmmod.h:309
int m_outputSampleRate
Definition: nfmmod.h:275
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
QString m_feedbackAudioDeviceName
This is the audio device you send the audio samples to for audio feedback.
float Real
Definition: dsptypes.h:42
void applyAudioSampleRate(int sampleRate)
Definition: nfmmod.cpp:495
QMutex m_settingsMutex
Definition: nfmmod.h:312
Real m_interpolatorDistance
Definition: nfmmod.h:286
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateLevel()

void NFMMod::calculateLevel ( Real sample)
private

Definition at line 315 of file nfmmod.cpp.

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

Referenced by modulateSample().

316 {
318  {
319  m_peakLevel = std::max(std::fabs(m_peakLevel), sample);
320  m_levelSum += sample * sample;
322  }
323  else
324  {
325  qreal rmsLevel = sqrt(m_levelSum / m_levelNbSamples);
326  //qDebug("NFMMod::calculateLevel: %f %f", rmsLevel, m_peakLevel);
327  emit levelChanged(rmsLevel, m_peakLevel, m_levelNbSamples);
328  m_peakLevel = 0.0f;
329  m_levelSum = 0.0f;
330  m_levelCalcCount = 0;
331  }
332 }
static const int m_levelNbSamples
Definition: nfmmod.h:329
Real m_peakLevel
Definition: nfmmod.h:322
Real m_levelSum
Definition: nfmmod.h:323
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples)
quint32 m_levelCalcCount
Definition: nfmmod.h:321
Fixed< IntType, IntBits > sqrt(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2283
T max(const T &x, const T &y)
Definition: framework.h:446
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

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

Implements ChannelAPI.

Definition at line 702 of file nfmmod.cpp.

References NFMMod::MsgConfigureNFMMod::create(), NFMMod::MsgConfigureChannelizer::create(), NFMModSettings::deserialize(), NFMModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and NFMModSettings::resetToDefaults().

Referenced by getCenterFrequency().

703 {
704  bool success = true;
705 
706  if (!m_settings.deserialize(data))
707  {
709  success = false;
710  }
711 
712  MsgConfigureChannelizer *msgChan = MsgConfigureChannelizer::create(
714  m_inputMessageQueue.push(msgChan);
715 
716  MsgConfigureNFMMod *msg = MsgConfigureNFMMod::create(m_settings, true);
718 
719  return success;
720 }
bool deserialize(const QByteArray &data)
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: nfmmod.h:83
qint64 m_inputFrequencyOffset
NFMModSettings m_settings
Definition: nfmmod.h:277
static MsgConfigureNFMMod * create(const NFMModSettings &settings, bool force)
Definition: nfmmod.h:60
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 NFMMod::destroy ( )
inlinevirtual

Implements ChannelAPI.

Definition at line 208 of file nfmmod.h.

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

208 { delete this; }
+ Here is the call graph for this function:

◆ getCenterFrequency()

virtual qint64 NFMMod::getCenterFrequency ( ) const
inlinevirtual

Applies to a default stream.

Implements ChannelAPI.

Definition at line 218 of file nfmmod.h.

References deserialize(), NFMModSettings::m_inputFrequencyOffset, NFMMod::MsgConfigureNFMMod::m_settings, and serialize().

qint64 m_inputFrequencyOffset
NFMModSettings m_settings
Definition: nfmmod.h:277
+ Here is the call graph for this function:

◆ getCWKeyer()

CWKeyer* NFMMod::getCWKeyer ( )
inline

Definition at line 249 of file nfmmod.h.

References m_cwKeyer.

Referenced by NFMModGUI::NFMModGUI().

249 { return &m_cwKeyer; }
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
+ Here is the caller graph for this function:

◆ getIdentifier()

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

Implements ChannelAPI.

Definition at line 216 of file nfmmod.h.

216 { id = objectName(); }

◆ getMagSq()

double NFMMod::getMagSq ( ) const
inline

Definition at line 247 of file nfmmod.h.

References m_magsq.

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

247 { return m_magsq; }
double m_magsq
Definition: nfmmod.h:298
+ Here is the caller graph for this function:

◆ getNbSinkStreams()

virtual int NFMMod::getNbSinkStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 223 of file nfmmod.h.

223 { return 1; }

◆ getNbSourceStreams()

virtual int NFMMod::getNbSourceStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 224 of file nfmmod.h.

224 { return 0; }

◆ getStreamCenterFrequency()

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

Implements ChannelAPI.

Definition at line 226 of file nfmmod.h.

References NFMModSettings::m_inputFrequencyOffset, NFMMod::MsgConfigureNFMMod::m_settings, webapiReportGet(), webapiSettingsGet(), and webapiSettingsPutPatch().

227  {
228  (void) streamIndex;
229  (void) sinkElseSource;
231  }
qint64 m_inputFrequencyOffset
NFMModSettings m_settings
Definition: nfmmod.h:277
+ Here is the call graph for this function:

◆ getTitle()

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

Implements ChannelAPI.

Definition at line 217 of file nfmmod.h.

References NFMMod::MsgConfigureNFMMod::m_settings, and NFMModSettings::m_title.

217 { title = m_settings.m_title; }
NFMModSettings m_settings
Definition: nfmmod.h:277

◆ handleMessage()

bool NFMMod::handleMessage ( const Message cmd)
virtual

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

Implements BasebandSampleSource.

Definition at line 347 of file nfmmod.cpp.

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

Referenced by destroy().

348 {
350  {
352  qDebug() << "NFMMod::handleMessage: UpChannelizer::MsgChannelizerNotification";
353 
355 
356  return true;
357  }
358  else if (MsgConfigureChannelizer::match(cmd))
359  {
360  MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
361  qDebug() << "NFMMod::handleMessage: MsgConfigureChannelizer:"
362  << " getSampleRate: " << cfg.getSampleRate()
363  << " getCenterFrequency: " << cfg.getCenterFrequency();
364 
366  cfg.getSampleRate(),
367  cfg.getCenterFrequency());
368 
369  return true;
370  }
371  else if (MsgConfigureNFMMod::match(cmd))
372  {
373  MsgConfigureNFMMod& cfg = (MsgConfigureNFMMod&) cmd;
374  qDebug() << "NFMMod::handleMessage: MsgConfigureNFMMod";
375 
376  applySettings(cfg.getSettings(), cfg.getForce());
377 
378  return true;
379  }
380  else if (MsgConfigureFileSourceName::match(cmd))
381  {
382  MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
383  m_fileName = conf.getFileName();
384  openFileStream();
385  qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceName:"
386  << " m_fileName: " << m_fileName;
387  return true;
388  }
389  else if (MsgConfigureFileSourceSeek::match(cmd))
390  {
391  MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd;
392  int seekPercentage = conf.getPercentage();
393  seekFileStream(seekPercentage);
394  qDebug() << "NFMMod::handleMessage: MsgConfigureFileSourceSeek:"
395  << " seekPercentage: " << seekPercentage;
396 
397  return true;
398  }
400  {
401  std::size_t samplesCount;
402 
403  if (m_ifstream.eof()) {
404  samplesCount = m_fileSize / sizeof(Real);
405  } else {
406  samplesCount = m_ifstream.tellg() / sizeof(Real);
407  }
408 
409  MsgReportFileSourceStreamTiming *report;
410  report = MsgReportFileSourceStreamTiming::create(samplesCount);
411  getMessageQueueToGUI()->push(report);
412 
413  return true;
414  }
416  {
418 
421  }
422 
423  return true;
424  }
425  else if (DSPConfigureAudio::match(cmd))
426  {
427  DSPConfigureAudio& cfg = (DSPConfigureAudio&) cmd;
428  uint32_t sampleRate = cfg.getSampleRate();
429  DSPConfigureAudio::AudioType audioType = cfg.getAudioType();
430 
431  qDebug() << "NFMMod::handleMessage: DSPConfigureAudio:"
432  << " sampleRate: " << sampleRate
433  << " audioType: " << audioType;
434 
435  if (audioType == DSPConfigureAudio::AudioInput)
436  {
437  if (sampleRate != m_audioSampleRate) {
438  applyAudioSampleRate(sampleRate);
439  }
440  }
441  else if (audioType == DSPConfigureAudio::AudioOutput)
442  {
443  if (sampleRate != m_audioSampleRate) {
444  applyFeedbackAudioSampleRate(sampleRate);
445  }
446  }
447 
448  return true;
449  }
450  else if (DSPSignalNotification::match(cmd))
451  {
452  return true;
453  }
454  else
455  {
456  return false;
457  }
458 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: nfmmod.cpp:538
void webapiReverseSendCWSettings(const CWKeyerSettings &settings)
Definition: nfmmod.cpp:992
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
unsigned int uint32_t
Definition: rtptypes_win.h:46
AudioType getAudioType() const
Definition: dspcommands.h:391
QString m_fileName
Definition: nfmmod.h:315
int getSampleRate() const
Definition: dspcommands.h:390
static MsgReportFileSourceStreamTiming * create(std::size_t samplesCount)
Definition: nfmmod.h:165
UpChannelizer * m_channelizer
Definition: nfmmod.h:272
static bool match(const Message *message)
Definition: message.cpp:45
NFMModSettings m_settings
Definition: nfmmod.h:277
void seekFileStream(int seekPercentage)
Definition: nfmmod.cpp:482
void openFileStream()
Definition: nfmmod.cpp:460
void applySettings(const NFMModSettings &settings, bool force=false)
Definition: nfmmod.cpp:568
quint32 m_audioSampleRate
Definition: nfmmod.h:301
MessageQueue * getMessageQueueToGUI()
void applyFeedbackAudioSampleRate(unsigned int sampleRate)
Definition: nfmmod.cpp:521
quint64 m_fileSize
raw file size (bytes)
Definition: nfmmod.h:316
std::ifstream m_ifstream
Definition: nfmmod.h:314
float Real
Definition: dsptypes.h:42
void applyAudioSampleRate(int sampleRate)
Definition: nfmmod.cpp:495
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 NFMMod::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 NFMMod::modulateSample ( )
private

Definition at line 177 of file nfmmod.cpp.

References calculateLevel(), cos(), Bandpass< Type >::filter(), m_audioBufferFill, m_audioSampleRate, m_bandpass, m_ctcssNco, NFMModSettings::m_ctcssOn, NFMModSettings::m_feedbackAudioEnable, NFMModSettings::m_feedbackVolumeFactor, NFMModSettings::m_fmDeviation, m_modPhasor, m_modSample, M_PI, m_settings, NCOF::next(), pullAF(), pushFeedback(), SDR_TX_SCALEF, and sin().

Referenced by pull().

178 {
179  Real t;
180 
181  pullAF(t);
182 
185  }
186 
187  calculateLevel(t);
189 
190  if (m_settings.m_ctcssOn)
191  {
192  m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * (0.85f * m_bandpass.filter(t) + 0.15f * 378.0f * m_ctcssNco.next()) * (M_PI / 378.0f);
193  }
194  else
195  {
196  // 378 = 302 * 1.25; 302 = number of filter taps (established experimentally)
198  }
199 
200  m_modSample.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB
201  m_modSample.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF);
202 }
void calculateLevel(Real &sample)
Definition: nfmmod.cpp:315
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
void pushFeedback(Real sample)
Definition: nfmmod.cpp:271
void pullAF(Real &sample)
Definition: nfmmod.cpp:204
Bandpass< Real > m_bandpass
Definition: nfmmod.h:296
bool m_feedbackAudioEnable
Type filter(Type sample)
Definition: bandpass.h:77
#define M_PI
Definition: rdsdemod.cpp:27
#define SDR_TX_SCALEF
Definition: dsptypes.h:39
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
NFMModSettings m_settings
Definition: nfmmod.h:277
NCOF m_ctcssNco
Definition: nfmmod.h:281
float m_feedbackVolumeFactor
uint m_audioBufferFill
Definition: nfmmod.h:303
Complex m_modSample
Definition: nfmmod.h:283
quint32 m_audioSampleRate
Definition: nfmmod.h:301
float m_modPhasor
baseband modulator phasor
Definition: nfmmod.h:282
Real next()
Return next real sample.
Definition: ncof.cpp:57
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void NFMMod::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 1023 of file nfmmod.cpp.

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

1024 {
1025  QNetworkReply::NetworkError replyError = reply->error();
1026 
1027  if (replyError)
1028  {
1029  qWarning() << "NFMMod::networkManagerFinished:"
1030  << " error(" << (int) replyError
1031  << "): " << replyError
1032  << ": " << reply->errorString();
1033  return;
1034  }
1035 
1036  QString answer = reply->readAll();
1037  answer.chop(1); // remove last \n
1038  qDebug("NFMMod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
1039 }
+ Here is the caller graph for this function:

◆ openFileStream()

void NFMMod::openFileStream ( )
private

Definition at line 460 of file nfmmod.cpp.

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

Referenced by handleMessage().

461 {
462  if (m_ifstream.is_open()) {
463  m_ifstream.close();
464  }
465 
466  m_ifstream.open(m_fileName.toStdString().c_str(), std::ios::binary | std::ios::ate);
467  m_fileSize = m_ifstream.tellg();
468  m_ifstream.seekg(0,std::ios_base::beg);
469 
470  m_sampleRate = 48000; // fixed rate
471  m_recordLength = m_fileSize / (sizeof(Real) * m_sampleRate);
472 
473  qDebug() << "NFMMod::openFileStream: " << m_fileName.toStdString().c_str()
474  << " fileSize: " << m_fileSize << "bytes"
475  << " length: " << m_recordLength << " seconds";
476 
477  MsgReportFileSourceStreamData *report;
478  report = MsgReportFileSourceStreamData::create(m_sampleRate, m_recordLength);
479  getMessageQueueToGUI()->push(report);
480 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgReportFileSourceStreamData * create(int sampleRate, quint32 recordLength)
Definition: nfmmod.h:186
int m_sampleRate
Definition: nfmmod.h:318
QString m_fileName
Definition: nfmmod.h:315
quint32 m_recordLength
record length in seconds computed from file size
Definition: nfmmod.h:317
MessageQueue * getMessageQueueToGUI()
quint64 m_fileSize
raw file size (bytes)
Definition: nfmmod.h:316
std::ifstream m_ifstream
Definition: nfmmod.h:314
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processOneSample()

void NFMMod::processOneSample ( Complex ci)
private

Definition at line 294 of file nfmmod.cpp.

References AudioFifo::clear(), m_feedbackAudioBuffer, m_feedbackAudioBufferFill, m_feedbackAudioFifo, m_feedbackInterpolatorDistance, and AudioFifo::write().

Referenced by pushFeedback().

295 {
299 
301  {
303 
304  if (res != m_feedbackAudioBufferFill)
305  {
306  qDebug("AMDemod::pushFeedback: %u/%u audio samples written m_feedbackInterpolatorDistance: %f",
309  }
310 
312  }
313 }
uint m_feedbackAudioBufferFill
Definition: nfmmod.h:308
void clear()
Definition: audiofifo.cpp:156
AudioVector m_feedbackAudioBuffer
Definition: nfmmod.h:307
Real m_feedbackInterpolatorDistance
Definition: nfmmod.h:291
AudioFifo m_feedbackAudioFifo
Definition: nfmmod.h:309
uint32_t write(const quint8 *data, uint32_t numSamples)
Definition: audiofifo.cpp:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pull()

void NFMMod::pull ( Sample sample)
virtual

Implements BasebandSampleSource.

Definition at line 119 of file nfmmod.cpp.

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

Referenced by destroy().

120 {
122  {
123  sample.m_real = 0.0f;
124  sample.m_imag = 0.0f;
125  return;
126  }
127 
128  Complex ci;
129 
130  m_settingsMutex.lock();
131 
132  if (m_interpolatorDistance > 1.0f) // decimate
133  {
134  modulateSample();
135 
137  {
138  modulateSample();
139  }
140  }
141  else
142  {
144  {
145  modulateSample();
146  }
147  }
148 
150 
151  ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
152 
153  m_settingsMutex.unlock();
154 
155  double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
156  magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
157  m_movingAverage(magsq);
159 
160  sample.m_real = (FixReal) ci.real();
161  sample.m_imag = (FixReal) ci.imag();
162 }
Complex nextIQ()
Return next complex sample.
Definition: nco.cpp:61
bool decimate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:38
double m_magsq
Definition: nfmmod.h:298
bool interpolate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:53
Interpolator m_interpolator
Definition: nfmmod.h:285
Real m_interpolatorDistanceRemain
Definition: nfmmod.h:287
FixReal m_real
Definition: dsptypes.h:64
MovingAverageUtil< double, double, 16 > m_movingAverage
Definition: nfmmod.h:299
NFMModSettings m_settings
Definition: nfmmod.h:277
Complex m_modSample
Definition: nfmmod.h:283
void modulateSample()
Definition: nfmmod.cpp:177
FixReal m_imag
Definition: dsptypes.h:65
NCO m_carrierNco
Definition: nfmmod.h:279
std::complex< Real > Complex
Definition: dsptypes.h:43
double asDouble() const
Definition: movingaverage.h:57
#define SDR_TX_SCALED
Definition: dsptypes.h:40
QMutex m_settingsMutex
Definition: nfmmod.h:312
Real m_interpolatorDistance
Definition: nfmmod.h:286
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAF()

void NFMMod::pullAF ( Real sample)
private

Definition at line 204 of file nfmmod.cpp.

References CWKeyer::getCWSmoother(), CWSmoother::getFadeSample(), CWKeyer::getSample(), m_audioBuffer, m_audioBufferFill, m_cwKeyer, m_ifstream, NFMModSettings::m_modAFInput, NFMModSettings::m_playLoop, m_settings, m_toneNco, NFMModSettings::m_volumeFactor, NCOF::next(), NFMModSettings::NFMModInputAudio, NFMModSettings::NFMModInputCWTone, NFMModSettings::NFMModInputFile, NFMModSettings::NFMModInputNone, NFMModSettings::NFMModInputTone, and NCOF::setPhase().

Referenced by modulateSample().

205 {
206  switch (m_settings.m_modAFInput)
207  {
209  sample = m_toneNco.next();
210  break;
212  // sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
213  // ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
214  if (m_ifstream.is_open())
215  {
216  if (m_ifstream.eof())
217  {
219  {
220  m_ifstream.clear();
221  m_ifstream.seekg(0, std::ios::beg);
222  }
223  }
224 
225  if (m_ifstream.eof())
226  {
227  sample = 0.0f;
228  }
229  else
230  {
231  m_ifstream.read(reinterpret_cast<char*>(&sample), sizeof(Real));
232  sample *= m_settings.m_volumeFactor;
233  }
234  }
235  else
236  {
237  sample = 0.0f;
238  }
239  break;
242  break;
244  Real fadeFactor;
245 
246  if (m_cwKeyer.getSample())
247  {
248  m_cwKeyer.getCWSmoother().getFadeSample(true, fadeFactor);
249  sample = m_toneNco.next() * fadeFactor;
250  }
251  else
252  {
253  if (m_cwKeyer.getCWSmoother().getFadeSample(false, fadeFactor))
254  {
255  sample = m_toneNco.next() * fadeFactor;
256  }
257  else
258  {
259  sample = 0.0f;
260  m_toneNco.setPhase(0);
261  }
262  }
263  break;
265  default:
266  sample = 0.0f;
267  break;
268  }
269 }
NCOF m_toneNco
Definition: nfmmod.h:280
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
void setPhase(Real phase)
Definition: ncof.h:42
AudioVector m_audioBuffer
Definition: nfmmod.h:302
bool getFadeSample(bool on, float &sample)
Definition: cwkeyer.cpp:487
CWSmoother & getCWSmoother()
Definition: cwkeyer.h:111
NFMModSettings m_settings
Definition: nfmmod.h:277
int getSample()
Definition: cwkeyer.cpp:194
uint m_audioBufferFill
Definition: nfmmod.h:303
NFMModInputAF m_modAFInput
std::ifstream m_ifstream
Definition: nfmmod.h:314
Real next()
Return next real sample.
Definition: ncof.cpp:57
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAudio()

void NFMMod::pullAudio ( int  nbSamples)
virtual

Reimplemented from BasebandSampleSource.

Definition at line 164 of file nfmmod.cpp.

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

Referenced by destroy().

165 {
166  unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_basebandSampleRate);
167 
168  if (nbSamplesAudio > m_audioBuffer.size())
169  {
170  m_audioBuffer.resize(nbSamplesAudio);
171  }
172 
173  m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamplesAudio);
174  m_audioBufferFill = 0;
175 }
AudioFifo m_audioFifo
Definition: nfmmod.h:304
AudioVector m_audioBuffer
Definition: nfmmod.h:302
uint32_t read(quint8 *data, uint32_t numSamples)
Definition: audiofifo.cpp:103
int m_basebandSampleRate
Definition: nfmmod.h:274
uint m_audioBufferFill
Definition: nfmmod.h:303
quint32 m_audioSampleRate
Definition: nfmmod.h:301
float Real
Definition: dsptypes.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pushFeedback()

void NFMMod::pushFeedback ( Real  sample)
private

Definition at line 271 of file nfmmod.cpp.

References Interpolator::decimate(), Interpolator::interpolate(), m_feedbackInterpolator, m_feedbackInterpolatorDistance, m_feedbackInterpolatorDistanceRemain, and processOneSample().

Referenced by modulateSample().

272 {
273  Complex c(sample, sample);
274  Complex ci;
275 
276  if (m_feedbackInterpolatorDistance < 1.0f) // interpolate
277  {
279  {
280  processOneSample(ci);
282  }
283  }
284  else // decimate
285  {
287  {
288  processOneSample(ci);
290  }
291  }
292 }
void processOneSample(Complex &ci)
Definition: nfmmod.cpp:294
bool decimate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:38
bool interpolate(Real *distance, const Complex &next, Complex *result)
Definition: interpolator.h:53
Interpolator m_feedbackInterpolator
Definition: nfmmod.h:290
Real m_feedbackInterpolatorDistance
Definition: nfmmod.h:291
std::complex< Real > Complex
Definition: dsptypes.h:43
Real m_feedbackInterpolatorDistanceRemain
Definition: nfmmod.h:292
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ seekFileStream()

void NFMMod::seekFileStream ( int  seekPercentage)
private

Definition at line 482 of file nfmmod.cpp.

References m_ifstream, m_recordLength, m_sampleRate, and m_settingsMutex.

Referenced by handleMessage().

483 {
484  QMutexLocker mutexLocker(&m_settingsMutex);
485 
486  if (m_ifstream.is_open())
487  {
488  int seekPoint = ((m_recordLength * seekPercentage) / 100) * m_sampleRate;
489  seekPoint *= sizeof(Real);
490  m_ifstream.clear();
491  m_ifstream.seekg(seekPoint, std::ios::beg);
492  }
493 }
int m_sampleRate
Definition: nfmmod.h:318
quint32 m_recordLength
record length in seconds computed from file size
Definition: nfmmod.h:317
std::ifstream m_ifstream
Definition: nfmmod.h:314
float Real
Definition: dsptypes.h:42
QMutex m_settingsMutex
Definition: nfmmod.h:312
+ Here is the caller graph for this function:

◆ serialize()

QByteArray NFMMod::serialize ( ) const
virtual

Implements ChannelAPI.

Definition at line 697 of file nfmmod.cpp.

References m_settings, and NFMModSettings::serialize().

Referenced by getCenterFrequency().

698 {
699  return m_settings.serialize();
700 }
NFMModSettings m_settings
Definition: nfmmod.h:277
QByteArray serialize() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void NFMMod::start ( )
virtual

Implements BasebandSampleSource.

Definition at line 334 of file nfmmod.cpp.

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

Referenced by destroy().

335 {
336  qDebug() << "NFMMod::start: m_outputSampleRate: " << m_outputSampleRate
337  << " m_inputFrequencyOffset: " << m_inputFrequencyOffset;
338 
339  m_audioFifo.clear();
340  applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
341 }
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: nfmmod.cpp:538
void clear()
Definition: audiofifo.cpp:156
AudioFifo m_audioFifo
Definition: nfmmod.h:304
int m_basebandSampleRate
Definition: nfmmod.h:274
int m_outputSampleRate
Definition: nfmmod.h:275
int m_inputFrequencyOffset
Definition: nfmmod.h:276
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void NFMMod::stop ( )
virtual

Implements BasebandSampleSource.

Definition at line 343 of file nfmmod.cpp.

Referenced by destroy().

344 {
345 }
+ Here is the caller graph for this function:

◆ webapiFormatChannelReport()

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

Definition at line 903 of file nfmmod.cpp.

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

Referenced by webapiReportGet().

904 {
908 }
void setAudioSampleRate(qint32 audio_sample_rate)
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
SWGNFMModReport * getNfmModReport()
void setChannelPowerDb(float channel_power_db)
void setChannelSampleRate(qint32 channel_sample_rate)
quint32 m_audioSampleRate
Definition: nfmmod.h:301
double getMagSq() const
Definition: nfmmod.h:247
int m_outputSampleRate
Definition: nfmmod.h:275
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatChannelSettings()

void NFMMod::webapiFormatChannelSettings ( SWGSDRangel::SWGChannelSettings response,
const NFMModSettings settings 
)
private

Definition at line 852 of file nfmmod.cpp.

References SWGSDRangel::SWGNFMModSettings::getAudioDeviceName(), SWGSDRangel::SWGNFMModSettings::getCwKeyer(), SWGSDRangel::SWGChannelSettings::getNfmModSettings(), SWGSDRangel::SWGNFMModSettings::getReverseApiAddress(), CWKeyer::getSettings(), SWGSDRangel::SWGNFMModSettings::getTitle(), NFMModSettings::m_afBandwidth, NFMModSettings::m_audioDeviceName, NFMModSettings::m_channelMute, NFMModSettings::m_ctcssIndex, NFMModSettings::m_ctcssOn, m_cwKeyer, NFMModSettings::m_fmDeviation, NFMModSettings::m_inputFrequencyOffset, NFMModSettings::m_modAFInput, NFMModSettings::m_playLoop, NFMModSettings::m_reverseAPIAddress, NFMModSettings::m_reverseAPIChannelIndex, NFMModSettings::m_reverseAPIDeviceIndex, NFMModSettings::m_reverseAPIPort, NFMModSettings::m_rfBandwidth, NFMModSettings::m_rgbColor, NFMModSettings::m_title, NFMModSettings::m_toneFrequency, NFMModSettings::m_useReverseAPI, NFMModSettings::m_volumeFactor, CWKeyerSettings::m_wpm, SWGSDRangel::SWGNFMModSettings::setAfBandwidth(), SWGSDRangel::SWGNFMModSettings::setAudioDeviceName(), SWGSDRangel::SWGNFMModSettings::setChannelMute(), SWGSDRangel::SWGNFMModSettings::setCtcssIndex(), SWGSDRangel::SWGNFMModSettings::setCtcssOn(), SWGSDRangel::SWGNFMModSettings::setCwKeyer(), SWGSDRangel::SWGNFMModSettings::setFmDeviation(), SWGSDRangel::SWGNFMModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGNFMModSettings::setModAfInput(), SWGSDRangel::SWGNFMModSettings::setPlayLoop(), SWGSDRangel::SWGNFMModSettings::setReverseApiAddress(), SWGSDRangel::SWGNFMModSettings::setReverseApiChannelIndex(), SWGSDRangel::SWGNFMModSettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGNFMModSettings::setReverseApiPort(), SWGSDRangel::SWGNFMModSettings::setRfBandwidth(), SWGSDRangel::SWGNFMModSettings::setRgbColor(), SWGSDRangel::SWGNFMModSettings::setTitle(), SWGSDRangel::SWGNFMModSettings::setToneFrequency(), SWGSDRangel::SWGNFMModSettings::setUseReverseApi(), SWGSDRangel::SWGNFMModSettings::setVolumeFactor(), SWGSDRangel::SWGCWKeyerSettings::setWpm(), and CWKeyer::webapiFormatChannelSettings().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

853 {
854  response.getNfmModSettings()->setAfBandwidth(settings.m_afBandwidth);
855  response.getNfmModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
856  response.getNfmModSettings()->setCtcssIndex(settings.m_ctcssIndex);
857  response.getNfmModSettings()->setCtcssOn(settings.m_ctcssOn ? 1 : 0);
858  response.getNfmModSettings()->setFmDeviation(settings.m_fmDeviation);
860  response.getNfmModSettings()->setModAfInput((int) settings.m_modAFInput);
861  response.getNfmModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
862  response.getNfmModSettings()->setRfBandwidth(settings.m_rfBandwidth);
863  response.getNfmModSettings()->setRgbColor(settings.m_rgbColor);
864 
865  if (response.getNfmModSettings()->getTitle()) {
866  *response.getNfmModSettings()->getTitle() = settings.m_title;
867  } else {
868  response.getNfmModSettings()->setTitle(new QString(settings.m_title));
869  }
870 
871  response.getNfmModSettings()->setToneFrequency(settings.m_toneFrequency);
872  response.getNfmModSettings()->setVolumeFactor(settings.m_volumeFactor);
873 
874  if (!response.getNfmModSettings()->getCwKeyer()) {
876  }
877 
878  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
879  const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
880  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
881 
882  if (response.getNfmModSettings()->getAudioDeviceName()) {
883  *response.getNfmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
884  } else {
885  response.getNfmModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
886  }
887 
888  apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
889 
890  response.getNfmModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
891 
892  if (response.getNfmModSettings()->getReverseApiAddress()) {
894  } else {
895  response.getNfmModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
896  }
897 
901 }
void setFmDeviation(float fm_deviation)
void setVolumeFactor(float volume_factor)
SWGCWKeyerSettings * getCwKeyer()
void setChannelMute(qint32 channel_mute)
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
void setRgbColor(qint32 rgb_color)
void setReverseApiAddress(QString *reverse_api_address)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setInputFrequencyOffset(qint64 input_frequency_offset)
quint32 m_rgbColor
qint64 m_inputFrequencyOffset
void setToneFrequency(float tone_frequency)
void setReverseApiPort(qint32 reverse_api_port)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setCtcssIndex(qint32 ctcss_index)
uint16_t m_reverseAPIDeviceIndex
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
void setUseReverseApi(qint32 use_reverse_api)
void setRfBandwidth(float rf_bandwidth)
NFMModInputAF m_modAFInput
QString m_audioDeviceName
This is the audio device you get the audio samples from.
SWGNFMModSettings * getNfmModSettings()
void setAudioDeviceName(QString *audio_device_name)
void setPlayLoop(qint32 play_loop)
QString m_reverseAPIAddress
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
void setModAfInput(qint32 mod_af_input)
uint16_t m_reverseAPIPort
void setAfBandwidth(float af_bandwidth)
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

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

Reimplemented from ChannelAPI.

Definition at line 841 of file nfmmod.cpp.

References SWGSDRangel::SWGChannelReport::getNfmModReport(), SWGSDRangel::SWGNFMModReport::init(), SWGSDRangel::SWGChannelReport::setNfmModReport(), and webapiFormatChannelReport().

Referenced by getStreamCenterFrequency().

844 {
845  (void) errorMessage;
847  response.getNfmModReport()->init();
848  webapiFormatChannelReport(response);
849  return 200;
850 }
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport &response)
Definition: nfmmod.cpp:903
SWGNFMModReport * getNfmModReport()
void setNfmModReport(SWGNFMModReport *nfm_mod_report)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendCWSettings()

void NFMMod::webapiReverseSendCWSettings ( const CWKeyerSettings settings)
private

Definition at line 992 of file nfmmod.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), SWGSDRangel::SWGNFMModSettings::getCwKeyer(), SWGSDRangel::SWGChannelSettings::getNfmModSettings(), m_cwKeyer, m_networkManager, m_networkRequest, NFMModSettings::m_reverseAPIAddress, NFMModSettings::m_reverseAPIChannelIndex, NFMModSettings::m_reverseAPIDeviceIndex, NFMModSettings::m_reverseAPIPort, m_settings, SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGNFMModSettings::setCwKeyer(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGChannelSettings::setNfmModSettings(), and CWKeyer::webapiFormatChannelSettings().

Referenced by handleMessage().

993 {
995  swgChannelSettings->setDirection(1); // single source (Tx)
996  swgChannelSettings->setChannelType(new QString("NFMMod"));
997  swgChannelSettings->setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
998  SWGSDRangel::SWGNFMModSettings *swgNFModSettings = swgChannelSettings->getNfmModSettings();
999 
1000  swgNFModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
1001  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFModSettings->getCwKeyer();
1002  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
1003 
1004  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
1009  m_networkRequest.setUrl(QUrl(channelSettingsURL));
1010  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
1011 
1012  QBuffer *buffer=new QBuffer();
1013  buffer->open((QBuffer::ReadWrite));
1014  buffer->write(swgChannelSettings->asJson().toUtf8());
1015  buffer->seek(0);
1016 
1017  // Always use PATCH to avoid passing reverse API settings
1018  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
1019 
1020  delete swgChannelSettings;
1021 }
SWGCWKeyerSettings * getCwKeyer()
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
void setNfmModSettings(SWGNFMModSettings *nfm_mod_settings)
void setChannelType(QString *channel_type)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
NFMModSettings m_settings
Definition: nfmmod.h:277
QNetworkRequest m_networkRequest
Definition: nfmmod.h:327
virtual QString asJson() override
uint16_t m_reverseAPIDeviceIndex
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
QNetworkAccessManager * m_networkManager
Definition: nfmmod.h:326
SWGNFMModSettings * getNfmModSettings()
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

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

Definition at line 910 of file nfmmod.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), SWGSDRangel::SWGNFMModSettings::getCwKeyer(), ChannelAPI::getDeviceSetIndex(), ChannelAPI::getIndexInDeviceSet(), SWGSDRangel::SWGChannelSettings::getNfmModSettings(), CWKeyer::getSettings(), NFMModSettings::m_afBandwidth, NFMModSettings::m_audioDeviceName, NFMModSettings::m_channelMute, NFMModSettings::m_ctcssIndex, NFMModSettings::m_ctcssOn, m_cwKeyer, NFMModSettings::m_fmDeviation, NFMModSettings::m_inputFrequencyOffset, NFMModSettings::m_modAFInput, m_networkManager, m_networkRequest, NFMModSettings::m_playLoop, NFMModSettings::m_reverseAPIAddress, NFMModSettings::m_reverseAPIChannelIndex, NFMModSettings::m_reverseAPIDeviceIndex, NFMModSettings::m_reverseAPIPort, NFMModSettings::m_rfBandwidth, NFMModSettings::m_rgbColor, NFMModSettings::m_title, NFMModSettings::m_toneFrequency, NFMModSettings::m_volumeFactor, SWGSDRangel::SWGNFMModSettings::setAfBandwidth(), SWGSDRangel::SWGNFMModSettings::setAudioDeviceName(), SWGSDRangel::SWGNFMModSettings::setChannelMute(), SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGNFMModSettings::setCtcssIndex(), SWGSDRangel::SWGNFMModSettings::setCtcssOn(), SWGSDRangel::SWGNFMModSettings::setCwKeyer(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGNFMModSettings::setFmDeviation(), SWGSDRangel::SWGNFMModSettings::setInputFrequencyOffset(), SWGSDRangel::SWGNFMModSettings::setModAfInput(), SWGSDRangel::SWGChannelSettings::setNfmModSettings(), SWGSDRangel::SWGChannelSettings::setOriginatorChannelIndex(), SWGSDRangel::SWGChannelSettings::setOriginatorDeviceSetIndex(), SWGSDRangel::SWGNFMModSettings::setPlayLoop(), SWGSDRangel::SWGNFMModSettings::setRfBandwidth(), SWGSDRangel::SWGNFMModSettings::setRgbColor(), SWGSDRangel::SWGNFMModSettings::setTitle(), SWGSDRangel::SWGNFMModSettings::setToneFrequency(), SWGSDRangel::SWGNFMModSettings::setVolumeFactor(), and CWKeyer::webapiFormatChannelSettings().

Referenced by applySettings().

911 {
913  swgChannelSettings->setDirection(1); // single source (Tx)
914  swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
915  swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
916  swgChannelSettings->setChannelType(new QString("NFMMod"));
917  swgChannelSettings->setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
918  SWGSDRangel::SWGNFMModSettings *swgNFMModSettings = swgChannelSettings->getNfmModSettings();
919 
920  // transfer data that has been modified. When force is on transfer all data except reverse API data
921 
922  if (channelSettingsKeys.contains("channelMute") || force) {
923  swgNFMModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
924  }
925  if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
926  swgNFMModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
927  }
928  if (channelSettingsKeys.contains("modAFInput") || force) {
929  swgNFMModSettings->setModAfInput((int) settings.m_modAFInput);
930  }
931  if (channelSettingsKeys.contains("audioDeviceName") || force) {
932  swgNFMModSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
933  }
934  if (channelSettingsKeys.contains("playLoop") || force) {
935  swgNFMModSettings->setPlayLoop(settings.m_playLoop ? 1 : 0);
936  }
937  if (channelSettingsKeys.contains("afBandwidth") || force) {
938  swgNFMModSettings->setAfBandwidth(settings.m_afBandwidth);
939  }
940  if (channelSettingsKeys.contains("fmDeviation") || force) {
941  swgNFMModSettings->setFmDeviation(settings.m_fmDeviation);
942  }
943  if (channelSettingsKeys.contains("rfBandwidth") || force) {
944  swgNFMModSettings->setRfBandwidth(settings.m_rfBandwidth);
945  }
946  if (channelSettingsKeys.contains("rgbColor") || force) {
947  swgNFMModSettings->setRgbColor(settings.m_rgbColor);
948  }
949  if (channelSettingsKeys.contains("title") || force) {
950  swgNFMModSettings->setTitle(new QString(settings.m_title));
951  }
952  if (channelSettingsKeys.contains("toneFrequency") || force) {
953  swgNFMModSettings->setToneFrequency(settings.m_toneFrequency);
954  }
955  if (channelSettingsKeys.contains("volumeFactor") || force) {
956  swgNFMModSettings->setVolumeFactor(settings.m_volumeFactor);
957  }
958  if (channelSettingsKeys.contains("ctcssOn") || force) {
959  swgNFMModSettings->setCtcssOn(settings.m_ctcssOn ? 1 : 0);
960  }
961  if (channelSettingsKeys.contains("ctcssIndex") || force) {
962  swgNFMModSettings->setCtcssIndex(settings.m_ctcssIndex);
963  }
964 
965  if (force)
966  {
967  const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
968  swgNFMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
969  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgNFMModSettings->getCwKeyer();
970  m_cwKeyer.webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
971  }
972 
973  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
974  .arg(settings.m_reverseAPIAddress)
975  .arg(settings.m_reverseAPIPort)
976  .arg(settings.m_reverseAPIDeviceIndex)
977  .arg(settings.m_reverseAPIChannelIndex);
978  m_networkRequest.setUrl(QUrl(channelSettingsURL));
979  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
980 
981  QBuffer *buffer=new QBuffer();
982  buffer->open((QBuffer::ReadWrite));
983  buffer->write(swgChannelSettings->asJson().toUtf8());
984  buffer->seek(0);
985 
986  // Always use PATCH to avoid passing reverse API settings
987  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
988 
989  delete swgChannelSettings;
990 }
void setFmDeviation(float fm_deviation)
void setOriginatorChannelIndex(qint32 originator_channel_index)
void setVolumeFactor(float volume_factor)
SWGCWKeyerSettings * getCwKeyer()
void setChannelMute(qint32 channel_mute)
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
void setRgbColor(qint32 rgb_color)
void setNfmModSettings(SWGNFMModSettings *nfm_mod_settings)
int getDeviceSetIndex() const
Definition: channelapi.h:89
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setChannelType(QString *channel_type)
void setOriginatorDeviceSetIndex(qint32 originator_device_set_index)
quint32 m_rgbColor
qint64 m_inputFrequencyOffset
void setToneFrequency(float tone_frequency)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
QNetworkRequest m_networkRequest
Definition: nfmmod.h:327
void setCtcssIndex(qint32 ctcss_index)
virtual QString asJson() override
uint16_t m_reverseAPIDeviceIndex
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
Definition: cwkeyer.cpp:637
void setRfBandwidth(float rf_bandwidth)
QNetworkAccessManager * m_networkManager
Definition: nfmmod.h:326
NFMModInputAF m_modAFInput
QString m_audioDeviceName
This is the audio device you get the audio samples from.
SWGNFMModSettings * getNfmModSettings()
void setAudioDeviceName(QString *audio_device_name)
void setPlayLoop(qint32 play_loop)
QString m_reverseAPIAddress
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
int getIndexInDeviceSet() const
Definition: channelapi.h:87
void setModAfInput(qint32 mod_af_input)
uint16_t m_reverseAPIPort
void setAfBandwidth(float af_bandwidth)
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsGet()

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

Reimplemented from ChannelAPI.

Definition at line 722 of file nfmmod.cpp.

References SWGSDRangel::SWGChannelSettings::getNfmModSettings(), SWGSDRangel::SWGNFMModSettings::init(), m_settings, SWGSDRangel::SWGChannelSettings::setNfmModSettings(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

725 {
726  (void) errorMessage;
728  response.getNfmModSettings()->init();
730  return 200;
731 }
void setNfmModSettings(SWGNFMModSettings *nfm_mod_settings)
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const NFMModSettings &settings)
Definition: nfmmod.cpp:852
NFMModSettings m_settings
Definition: nfmmod.h:277
SWGNFMModSettings * getNfmModSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

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

Reimplemented from ChannelAPI.

Definition at line 733 of file nfmmod.cpp.

References NFMMod::MsgConfigureNFMMod::create(), CWKeyer::MsgConfigureCWKeyer::create(), NFMMod::MsgConfigureChannelizer::create(), SWGSDRangel::SWGNFMModSettings::getAfBandwidth(), SWGSDRangel::SWGNFMModSettings::getChannelMute(), SWGSDRangel::SWGNFMModSettings::getCtcssIndex(), SWGSDRangel::SWGNFMModSettings::getCtcssOn(), SWGSDRangel::SWGNFMModSettings::getCwKeyer(), SWGSDRangel::SWGNFMModSettings::getFmDeviation(), SWGSDRangel::SWGNFMModSettings::getInputFrequencyOffset(), CWKeyer::getInputMessageQueue(), SWGSDRangel::SWGNFMModSettings::getModAfInput(), SWGSDRangel::SWGChannelSettings::getNfmModSettings(), SWGSDRangel::SWGNFMModSettings::getPlayLoop(), SWGSDRangel::SWGNFMModSettings::getReverseApiAddress(), SWGSDRangel::SWGNFMModSettings::getReverseApiChannelIndex(), SWGSDRangel::SWGNFMModSettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGNFMModSettings::getReverseApiPort(), SWGSDRangel::SWGNFMModSettings::getRfBandwidth(), SWGSDRangel::SWGNFMModSettings::getRgbColor(), CWKeyer::getSettings(), SWGSDRangel::SWGNFMModSettings::getTitle(), SWGSDRangel::SWGNFMModSettings::getToneFrequency(), SWGSDRangel::SWGNFMModSettings::getUseReverseApi(), SWGSDRangel::SWGNFMModSettings::getVolumeFactor(), NFMModSettings::m_afBandwidth, m_audioSampleRate, NFMModSettings::m_channelMute, NFMModSettings::m_ctcssIndex, NFMModSettings::m_ctcssOn, m_cwKeyer, NFMModSettings::m_fmDeviation, BasebandSampleSource::m_guiMessageQueue, NFMModSettings::m_inputFrequencyOffset, BasebandSampleSource::m_inputMessageQueue, NFMModSettings::m_modAFInput, NFMModSettings::m_playLoop, NFMModSettings::m_reverseAPIAddress, NFMModSettings::m_reverseAPIChannelIndex, NFMModSettings::m_reverseAPIDeviceIndex, NFMModSettings::m_reverseAPIPort, NFMModSettings::m_rfBandwidth, NFMModSettings::m_rgbColor, m_settings, NFMModSettings::m_title, NFMModSettings::m_toneFrequency, NFMModSettings::m_useReverseAPI, NFMModSettings::m_volumeFactor, MessageQueue::push(), webapiFormatChannelSettings(), and CWKeyer::webapiSettingsPutPatch().

Referenced by getStreamCenterFrequency().

738 {
739  (void) errorMessage;
740  NFMModSettings settings = m_settings;
741  bool frequencyOffsetChanged = false;
742 
743 // for (int i = 0; i < channelSettingsKeys.size(); i++) {
744 // qDebug("NFMMod::webapiSettingsPutPatch: settingKey: %s", qPrintable(channelSettingsKeys.at(i)));
745 // }
746 
747  if (channelSettingsKeys.contains("afBandwidth")) {
748  settings.m_afBandwidth = response.getNfmModSettings()->getAfBandwidth();
749  }
750  if (channelSettingsKeys.contains("channelMute")) {
751  settings.m_channelMute = response.getNfmModSettings()->getChannelMute() != 0;
752  }
753  if (channelSettingsKeys.contains("ctcssIndex")) {
754  settings.m_ctcssIndex = response.getNfmModSettings()->getCtcssIndex();
755  }
756  if (channelSettingsKeys.contains("ctcssOn")) {
757  settings.m_ctcssOn = response.getNfmModSettings()->getCtcssOn() != 0;
758  }
759  if (channelSettingsKeys.contains("fmDeviation")) {
760  settings.m_fmDeviation = response.getNfmModSettings()->getFmDeviation();
761  }
762  if (channelSettingsKeys.contains("inputFrequencyOffset"))
763  {
765  frequencyOffsetChanged = true;
766  }
767  if (channelSettingsKeys.contains("modAFInput")) {
769  }
770  if (channelSettingsKeys.contains("playLoop")) {
771  settings.m_playLoop = response.getNfmModSettings()->getPlayLoop() != 0;
772  }
773  if (channelSettingsKeys.contains("rfBandwidth")) {
774  settings.m_rfBandwidth = response.getNfmModSettings()->getRfBandwidth();
775  }
776  if (channelSettingsKeys.contains("rgbColor")) {
777  settings.m_rgbColor = response.getNfmModSettings()->getRgbColor();
778  }
779  if (channelSettingsKeys.contains("title")) {
780  settings.m_title = *response.getNfmModSettings()->getTitle();
781  }
782  if (channelSettingsKeys.contains("toneFrequency")) {
783  settings.m_toneFrequency = response.getNfmModSettings()->getToneFrequency();
784  }
785  if (channelSettingsKeys.contains("volumeFactor")) {
786  settings.m_volumeFactor = response.getNfmModSettings()->getVolumeFactor();
787  }
788  if (channelSettingsKeys.contains("useReverseAPI")) {
789  settings.m_useReverseAPI = response.getNfmModSettings()->getUseReverseApi() != 0;
790  }
791  if (channelSettingsKeys.contains("reverseAPIAddress")) {
793  }
794  if (channelSettingsKeys.contains("reverseAPIPort")) {
795  settings.m_reverseAPIPort = response.getNfmModSettings()->getReverseApiPort();
796  }
797  if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
799  }
800  if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
802  }
803 
804  if (channelSettingsKeys.contains("cwKeyer"))
805  {
806  SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
807  CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
808  m_cwKeyer.webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
809 
810  CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
811  m_cwKeyer.getInputMessageQueue()->push(msgCwKeyer);
812 
813  if (m_guiMessageQueue) // forward to GUI if any
814  {
815  CWKeyer::MsgConfigureCWKeyer *msgCwKeyerToGUI = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
816  m_guiMessageQueue->push(msgCwKeyerToGUI);
817  }
818  }
819 
820  if (frequencyOffsetChanged)
821  {
824  m_inputMessageQueue.push(msgChan);
825  }
826 
827  MsgConfigureNFMMod *msg = MsgConfigureNFMMod::create(settings, force);
829 
830  if (m_guiMessageQueue) // forward to GUI if any
831  {
832  MsgConfigureNFMMod *msgToGUI = MsgConfigureNFMMod::create(settings, force);
833  m_guiMessageQueue->push(msgToGUI);
834  }
835 
836  webapiFormatChannelSettings(response, settings);
837 
838  return 200;
839 }
SWGCWKeyerSettings * getCwKeyer()
void push(Message *message, bool emitSignal=true)
Push message onto queue.
CWKeyer m_cwKeyer
Definition: nfmmod.h:324
static MsgConfigureCWKeyer * create(const CWKeyerSettings &settings, bool force)
Definition: cwkeyer.h:63
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const NFMModSettings &settings)
Definition: nfmmod.cpp:852
static MsgConfigureChannelizer * create(int sampleRate, int centerFrequency)
Definition: nfmmod.h:83
quint32 m_rgbColor
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
Definition: cwkeyer.h:104
qint64 m_inputFrequencyOffset
NFMModSettings m_settings
Definition: nfmmod.h:277
static MsgConfigureNFMMod * create(const NFMModSettings &settings, bool force)
Definition: nfmmod.h:60
uint16_t m_reverseAPIDeviceIndex
quint32 m_audioSampleRate
Definition: nfmmod.h:301
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.
NFMModInputAF m_modAFInput
SWGNFMModSettings * getNfmModSettings()
const CWKeyerSettings & getSettings() const
Definition: cwkeyer.h:107
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_afInput

NFMModSettings::NFMModInputAF NFMMod::m_afInput
private

Definition at line 320 of file nfmmod.h.

◆ m_audioBuffer

AudioVector NFMMod::m_audioBuffer
private

Definition at line 302 of file nfmmod.h.

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

◆ m_audioBufferFill

uint NFMMod::m_audioBufferFill
private

Definition at line 303 of file nfmmod.h.

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

◆ m_audioFifo

AudioFifo NFMMod::m_audioFifo
private

Definition at line 304 of file nfmmod.h.

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

◆ m_audioSampleRate

quint32 NFMMod::m_audioSampleRate
private

◆ m_bandpass

Bandpass<Real> NFMMod::m_bandpass
private

Definition at line 296 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applySettings(), and modulateSample().

◆ m_basebandSampleRate

int NFMMod::m_basebandSampleRate
private

Definition at line 274 of file nfmmod.h.

Referenced by applyChannelSettings(), NFMMod(), pullAudio(), and start().

◆ m_carrierNco

NCO NFMMod::m_carrierNco
private

Definition at line 279 of file nfmmod.h.

Referenced by applyChannelSettings(), and pull().

◆ m_channelId

const QString NFMMod::m_channelId = "NFMMod"
static

Definition at line 252 of file nfmmod.h.

Referenced by NFMModPlugin::initPlugin(), and NFMMod().

◆ m_channelIdURI

const QString NFMMod::m_channelIdURI = "sdrangel.channeltx.modnfm"
static

Definition at line 251 of file nfmmod.h.

Referenced by NFMModPlugin::initPlugin(), and NFMModGUI::NFMModGUI().

◆ m_channelizer

UpChannelizer* NFMMod::m_channelizer
private

Definition at line 272 of file nfmmod.h.

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

◆ m_ctcssNco

NCOF NFMMod::m_ctcssNco
private

Definition at line 281 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applySettings(), modulateSample(), and NFMMod().

◆ m_cwKeyer

CWKeyer NFMMod::m_cwKeyer
private

◆ m_deviceAPI

DeviceAPI* NFMMod::m_deviceAPI
private

Definition at line 270 of file nfmmod.h.

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

◆ m_feedbackAudioBuffer

AudioVector NFMMod::m_feedbackAudioBuffer
private

Definition at line 307 of file nfmmod.h.

Referenced by NFMMod(), and processOneSample().

◆ m_feedbackAudioBufferFill

uint NFMMod::m_feedbackAudioBufferFill
private

Definition at line 308 of file nfmmod.h.

Referenced by NFMMod(), and processOneSample().

◆ m_feedbackAudioFifo

AudioFifo NFMMod::m_feedbackAudioFifo
private

Definition at line 309 of file nfmmod.h.

Referenced by applySettings(), NFMMod(), processOneSample(), and ~NFMMod().

◆ m_feedbackAudioSampleRate

quint32 NFMMod::m_feedbackAudioSampleRate
private

◆ m_feedbackInterpolator

Interpolator NFMMod::m_feedbackInterpolator
private

Definition at line 290 of file nfmmod.h.

Referenced by applyFeedbackAudioSampleRate(), and pushFeedback().

◆ m_feedbackInterpolatorConsumed

bool NFMMod::m_feedbackInterpolatorConsumed
private

Definition at line 293 of file nfmmod.h.

Referenced by applyFeedbackAudioSampleRate().

◆ m_feedbackInterpolatorDistance

Real NFMMod::m_feedbackInterpolatorDistance
private

Definition at line 291 of file nfmmod.h.

Referenced by applyFeedbackAudioSampleRate(), processOneSample(), and pushFeedback().

◆ m_feedbackInterpolatorDistanceRemain

Real NFMMod::m_feedbackInterpolatorDistanceRemain
private

Definition at line 292 of file nfmmod.h.

Referenced by applyFeedbackAudioSampleRate(), and pushFeedback().

◆ m_fileName

QString NFMMod::m_fileName
private

◆ m_fileSize

quint64 NFMMod::m_fileSize
private

raw file size (bytes)

Definition at line 316 of file nfmmod.h.

Referenced by handleMessage(), and openFileStream().

◆ m_ifstream

std::ifstream NFMMod::m_ifstream
private

Definition at line 314 of file nfmmod.h.

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

◆ m_inputFrequencyOffset

int NFMMod::m_inputFrequencyOffset
private

Definition at line 276 of file nfmmod.h.

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

◆ m_interpolator

Interpolator NFMMod::m_interpolator
private

Definition at line 285 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applyChannelSettings(), applySettings(), and pull().

◆ m_interpolatorConsumed

bool NFMMod::m_interpolatorConsumed
private

Definition at line 288 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applyChannelSettings(), and applySettings().

◆ m_interpolatorDistance

Real NFMMod::m_interpolatorDistance
private

Definition at line 286 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applyChannelSettings(), applySettings(), and pull().

◆ m_interpolatorDistanceRemain

Real NFMMod::m_interpolatorDistanceRemain
private

Definition at line 287 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applyChannelSettings(), applySettings(), and pull().

◆ m_levelCalcCount

quint32 NFMMod::m_levelCalcCount
private

Definition at line 321 of file nfmmod.h.

Referenced by calculateLevel().

◆ m_levelNbSamples

const int NFMMod::m_levelNbSamples = 480
staticprivate

Definition at line 329 of file nfmmod.h.

Referenced by calculateLevel().

◆ m_levelSum

Real NFMMod::m_levelSum
private

Definition at line 323 of file nfmmod.h.

Referenced by calculateLevel().

◆ m_lowpass

Lowpass<Real> NFMMod::m_lowpass
private

Definition at line 295 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applySettings(), and NFMMod().

◆ m_magsq

double NFMMod::m_magsq
private

Definition at line 298 of file nfmmod.h.

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

◆ m_modPhasor

float NFMMod::m_modPhasor
private

baseband modulator phasor

Definition at line 282 of file nfmmod.h.

Referenced by modulateSample().

◆ m_modSample

Complex NFMMod::m_modSample
private

Definition at line 283 of file nfmmod.h.

Referenced by modulateSample(), and pull().

◆ m_movingAverage

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

Definition at line 299 of file nfmmod.h.

Referenced by pull().

◆ m_networkManager

QNetworkAccessManager* NFMMod::m_networkManager
private

Definition at line 326 of file nfmmod.h.

Referenced by NFMMod(), webapiReverseSendCWSettings(), webapiReverseSendSettings(), and ~NFMMod().

◆ m_networkRequest

QNetworkRequest NFMMod::m_networkRequest
private

Definition at line 327 of file nfmmod.h.

Referenced by webapiReverseSendCWSettings(), and webapiReverseSendSettings().

◆ m_outputSampleRate

int NFMMod::m_outputSampleRate
private

◆ m_peakLevel

Real NFMMod::m_peakLevel
private

Definition at line 322 of file nfmmod.h.

Referenced by calculateLevel().

◆ m_recordLength

quint32 NFMMod::m_recordLength
private

record length in seconds computed from file size

Definition at line 317 of file nfmmod.h.

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

◆ m_sampleBuffer

SampleVector NFMMod::m_sampleBuffer
private

Definition at line 311 of file nfmmod.h.

◆ m_sampleRate

int NFMMod::m_sampleRate
private

◆ m_settings

NFMModSettings NFMMod::m_settings
private

◆ m_settingsMutex

QMutex NFMMod::m_settingsMutex
private

◆ m_threadedChannelizer

ThreadedBasebandSampleSource* NFMMod::m_threadedChannelizer
private

Definition at line 271 of file nfmmod.h.

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

◆ m_toneNco

NCOF NFMMod::m_toneNco
private

Definition at line 280 of file nfmmod.h.

Referenced by applyAudioSampleRate(), applySettings(), NFMMod(), and pullAF().


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