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.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
NFMModSettings Struct Reference

#include <nfmmodsettings.h>

+ Collaboration diagram for NFMModSettings:

Public Types

enum  NFMModInputAF {
  NFMModInputNone, NFMModInputTone, NFMModInputFile, NFMModInputAudio,
  NFMModInputCWTone
}
 

Public Member Functions

 NFMModSettings ()
 
void resetToDefaults ()
 
void setChannelMarker (Serializable *channelMarker)
 
void setCWKeyerGUI (Serializable *cwKeyerGUI)
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 

Static Public Member Functions

static int getRFBW (int index)
 
static int getRFBWIndex (int rfbw)
 
static float getCTCSSFreq (int index)
 
static int getCTCSSFreqIndex (float ctcssFreq)
 

Public Attributes

qint64 m_inputFrequencyOffset
 
Real m_rfBandwidth
 
Real m_afBandwidth
 
float m_fmDeviation
 
float m_toneFrequency
 
float m_volumeFactor
 
bool m_channelMute
 
bool m_playLoop
 
bool m_ctcssOn
 
int m_ctcssIndex
 
quint32 m_rgbColor
 
QString m_title
 
NFMModInputAF m_modAFInput
 
QString m_audioDeviceName
 This is the audio device you get the audio samples from. More...
 
QString m_feedbackAudioDeviceName
 This is the audio device you send the audio samples to for audio feedback. More...
 
float m_feedbackVolumeFactor
 
bool m_feedbackAudioEnable
 
bool m_useReverseAPI
 
QString m_reverseAPIAddress
 
uint16_t m_reverseAPIPort
 
uint16_t m_reverseAPIDeviceIndex
 
uint16_t m_reverseAPIChannelIndex
 
Serializablem_channelMarker
 
Serializablem_cwKeyerGUI
 

Static Public Attributes

static const int m_nbRfBW = 11
 
static const int m_rfBW []
 
static const int m_nbCTCSSFreqs = 32
 
static const float m_ctcssFreqs []
 

Detailed Description

Definition at line 25 of file nfmmodsettings.h.

Member Enumeration Documentation

◆ NFMModInputAF

Enumerator
NFMModInputNone 
NFMModInputTone 
NFMModInputFile 
NFMModInputAudio 
NFMModInputCWTone 

Definition at line 27 of file nfmmodsettings.h.

Constructor & Destructor Documentation

◆ NFMModSettings()

NFMModSettings::NFMModSettings ( )

Definition at line 40 of file nfmmodsettings.cpp.

References resetToDefaults().

40  :
41  m_channelMarker(0),
42  m_cwKeyerGUI(0)
43 {
45 }
Serializable * m_cwKeyerGUI
Serializable * m_channelMarker
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool NFMModSettings::deserialize ( const QByteArray &  data)

Definition at line 110 of file nfmmodsettings.cpp.

References Serializable::deserialize(), SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_afBandwidth, m_audioDeviceName, m_channelMarker, m_ctcssIndex, m_ctcssOn, m_cwKeyerGUI, AudioDeviceManager::m_defaultDeviceName, m_feedbackAudioDeviceName, m_feedbackAudioEnable, m_feedbackVolumeFactor, m_fmDeviation, m_inputFrequencyOffset, m_modAFInput, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_title, m_toneFrequency, m_useReverseAPI, m_volumeFactor, NFMModInputNone, SimpleDeserializer::readBlob(), SimpleDeserializer::readBool(), SimpleDeserializer::readReal(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by NFMModGUI::deserialize(), NFMMod::deserialize(), and setCWKeyerGUI().

111 {
112  SimpleDeserializer d(data);
113 
114  if(!d.isValid())
115  {
116  resetToDefaults();
117  return false;
118  }
119 
120  if(d.getVersion() == 1)
121  {
122  QByteArray bytetmp;
123  qint32 tmp;
124  uint32_t utmp;
125 
126  d.readS32(1, &tmp, 0);
128  d.readReal(2, &m_rfBandwidth, 12500.0);
129  d.readReal(3, &m_afBandwidth, 1000.0);
130  d.readReal(4, &m_fmDeviation, 5000.0);
131  d.readU32(5, &m_rgbColor);
132  d.readReal(6, &m_toneFrequency, 1000.0);
133  d.readReal(7, &m_volumeFactor, 1.0);
134 
135  if (m_cwKeyerGUI) {
136  d.readBlob(8, &bytetmp);
137  m_cwKeyerGUI->deserialize(bytetmp);
138  }
139 
140  d.readBool(9, &m_ctcssOn, false);
141  d.readS32(10, &m_ctcssIndex, 0);
142 
143  if (m_channelMarker) {
144  d.readBlob(11, &bytetmp);
145  m_channelMarker->deserialize(bytetmp);
146  }
147 
148  d.readString(12, &m_title, "NFM Modulator");
149 
150  d.readS32(13, &tmp, 0);
151  if ((tmp < 0) || (tmp > (int) NFMModInputAF::NFMModInputTone)) {
153  } else {
154  m_modAFInput = (NFMModInputAF) tmp;
155  }
156 
158 
159  d.readBool(15, &m_useReverseAPI, false);
160  d.readString(16, &m_reverseAPIAddress, "127.0.0.1");
161  d.readU32(17, &utmp, 0);
162 
163  if ((utmp > 1023) && (utmp < 65535)) {
164  m_reverseAPIPort = utmp;
165  } else {
166  m_reverseAPIPort = 8888;
167  }
168 
169  d.readU32(18, &utmp, 0);
170  m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
171  d.readU32(19, &utmp, 0);
172  m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
174  d.readReal(21, &m_feedbackVolumeFactor, 1.0);
175  d.readBool(22, &m_feedbackAudioEnable, false);
176 
177  return true;
178  }
179  else
180  {
181  qDebug() << "NFMModSettings::deserialize: ERROR";
182  resetToDefaults();
183  return false;
184  }
185 }
static const QString m_defaultDeviceName
bool m_feedbackAudioEnable
quint32 m_rgbColor
unsigned int uint32_t
Definition: rtptypes_win.h:46
qint64 m_inputFrequencyOffset
Serializable * m_cwKeyerGUI
virtual bool deserialize(const QByteArray &data)=0
uint16_t m_reverseAPIDeviceIndex
float m_feedbackVolumeFactor
NFMModInputAF m_modAFInput
Serializable * m_channelMarker
QString m_audioDeviceName
This is the audio device you get the audio samples from.
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
QString m_feedbackAudioDeviceName
This is the audio device you send the audio samples to for audio feedback.
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCTCSSFreq()

float NFMModSettings::getCTCSSFreq ( int  index)
static

Definition at line 211 of file nfmmodsettings.cpp.

References m_ctcssFreqs, and m_nbCTCSSFreqs.

Referenced by NFMMod::applyAudioSampleRate(), NFMMod::applySettings(), NFMModGUI::NFMModGUI(), and setCWKeyerGUI().

212 {
213  if (index < 0) {
214  return m_ctcssFreqs[0];
215  } else if (index < m_nbCTCSSFreqs) {
216  return m_ctcssFreqs[index];
217  } else {
218  return m_ctcssFreqs[m_nbCTCSSFreqs-1];
219  }
220 }
static const int m_nbCTCSSFreqs
static const float m_ctcssFreqs[]
+ Here is the caller graph for this function:

◆ getCTCSSFreqIndex()

int NFMModSettings::getCTCSSFreqIndex ( float  ctcssFreq)
static

Definition at line 222 of file nfmmodsettings.cpp.

References i, m_ctcssFreqs, and m_nbCTCSSFreqs.

Referenced by setCWKeyerGUI().

223 {
224  for (int i = 0; i < m_nbCTCSSFreqs; i++)
225  {
226  if (ctcssFreq <= m_ctcssFreqs[i])
227  {
228  return i;
229  }
230  }
231 
232  return m_nbCTCSSFreqs-1;
233 }
static const int m_nbCTCSSFreqs
int32_t i
Definition: decimators.h:244
static const float m_ctcssFreqs[]
+ Here is the caller graph for this function:

◆ getRFBW()

int NFMModSettings::getRFBW ( int  index)
static

Definition at line 187 of file nfmmodsettings.cpp.

References m_nbRfBW, and m_rfBW.

Referenced by NFMModGUI::NFMModGUI(), NFMModGUI::on_rfBW_currentIndexChanged(), and setCWKeyerGUI().

188 {
189  if (index < 0) {
190  return m_rfBW[0];
191  } else if (index < m_nbRfBW) {
192  return m_rfBW[index];
193  } else {
194  return m_rfBW[m_nbRfBW-1];
195  }
196 }
static const int m_nbRfBW
static const int m_rfBW[]
+ Here is the caller graph for this function:

◆ getRFBWIndex()

int NFMModSettings::getRFBWIndex ( int  rfbw)
static

Definition at line 198 of file nfmmodsettings.cpp.

References i, m_nbRfBW, and m_rfBW.

Referenced by NFMModGUI::displaySettings(), and setCWKeyerGUI().

199 {
200  for (int i = 0; i < m_nbRfBW; i++)
201  {
202  if (rfbw <= m_rfBW[i])
203  {
204  return i;
205  }
206  }
207 
208  return m_nbRfBW-1;
209 }
static const int m_nbRfBW
static const int m_rfBW[]
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ resetToDefaults()

void NFMModSettings::resetToDefaults ( )

Definition at line 47 of file nfmmodsettings.cpp.

References m_afBandwidth, m_audioDeviceName, m_channelMute, m_ctcssIndex, m_ctcssOn, AudioDeviceManager::m_defaultDeviceName, m_feedbackAudioDeviceName, m_feedbackAudioEnable, m_feedbackVolumeFactor, m_fmDeviation, m_inputFrequencyOffset, m_modAFInput, m_playLoop, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_title, m_toneFrequency, m_useReverseAPI, and m_volumeFactor.

Referenced by deserialize(), NFMMod::deserialize(), NFMModSettings(), and NFMModGUI::resetToDefaults().

48 {
49  m_afBandwidth = 3000;
51  m_rfBandwidth = 12500.0f;
52  m_fmDeviation = 5000.0f;
53  m_toneFrequency = 1000.0f;
54  m_volumeFactor = 1.0f;
55  m_channelMute = false;
56  m_playLoop = false;
57  m_ctcssOn = false;
58  m_ctcssIndex = 0;
59  m_rgbColor = QColor(255, 0, 0).rgb();
60  m_title = "NFM Modulator";
61  m_modAFInput = NFMModInputAF::NFMModInputNone;
65  m_feedbackAudioEnable = false;
66  m_useReverseAPI = false;
67  m_reverseAPIAddress = "127.0.0.1";
68  m_reverseAPIPort = 8888;
71 }
static const QString m_defaultDeviceName
bool m_feedbackAudioEnable
quint32 m_rgbColor
qint64 m_inputFrequencyOffset
uint16_t m_reverseAPIDeviceIndex
float m_feedbackVolumeFactor
NFMModInputAF m_modAFInput
QString m_audioDeviceName
This is the audio device you get the audio samples from.
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
QString m_feedbackAudioDeviceName
This is the audio device you send the audio samples to for audio feedback.
uint16_t m_reverseAPIChannelIndex
+ Here is the caller graph for this function:

◆ serialize()

QByteArray NFMModSettings::serialize ( ) const

Definition at line 73 of file nfmmodsettings.cpp.

References SimpleSerializer::final(), m_afBandwidth, m_audioDeviceName, m_channelMarker, m_ctcssIndex, m_ctcssOn, m_cwKeyerGUI, m_feedbackAudioDeviceName, m_feedbackAudioEnable, m_feedbackVolumeFactor, m_fmDeviation, m_inputFrequencyOffset, m_modAFInput, m_reverseAPIAddress, m_reverseAPIChannelIndex, m_reverseAPIDeviceIndex, m_reverseAPIPort, m_rfBandwidth, m_rgbColor, m_title, m_toneFrequency, m_useReverseAPI, m_volumeFactor, Serializable::serialize(), SimpleSerializer::writeBlob(), SimpleSerializer::writeBool(), SimpleSerializer::writeReal(), SimpleSerializer::writeS32(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by NFMModGUI::serialize(), NFMMod::serialize(), and setCWKeyerGUI().

74 {
75  SimpleSerializer s(1);
76 
77  s.writeS32(1, m_inputFrequencyOffset);
78  s.writeReal(2, m_rfBandwidth);
79  s.writeReal(3, m_afBandwidth);
80  s.writeReal(4, m_fmDeviation);
81  s.writeU32(5, m_rgbColor);
82  s.writeReal(6, m_toneFrequency);
83  s.writeReal(7, m_volumeFactor);
84 
85  if (m_cwKeyerGUI) {
86  s.writeBlob(8, m_cwKeyerGUI->serialize());
87  }
88 
89  if (m_channelMarker) {
90  s.writeBlob(11, m_channelMarker->serialize());
91  }
92 
93  s.writeBool(9, m_ctcssOn);
94  s.writeS32(10, m_ctcssIndex);
95  s.writeString(12, m_title);
96  s.writeS32(13, (int) m_modAFInput);
97  s.writeString(14, m_audioDeviceName);
98  s.writeBool(15, m_useReverseAPI);
99  s.writeString(16, m_reverseAPIAddress);
100  s.writeU32(17, m_reverseAPIPort);
101  s.writeU32(18, m_reverseAPIDeviceIndex);
102  s.writeU32(19, m_reverseAPIChannelIndex);
103  s.writeString(20, m_feedbackAudioDeviceName);
104  s.writeReal(21, m_feedbackVolumeFactor);
105  s.writeBool(22, m_feedbackAudioEnable);
106 
107  return s.final();
108 }
bool m_feedbackAudioEnable
quint32 m_rgbColor
qint64 m_inputFrequencyOffset
Serializable * m_cwKeyerGUI
uint16_t m_reverseAPIDeviceIndex
float m_feedbackVolumeFactor
virtual QByteArray serialize() const =0
NFMModInputAF m_modAFInput
Serializable * m_channelMarker
QString m_audioDeviceName
This is the audio device you get the audio samples from.
QString m_reverseAPIAddress
uint16_t m_reverseAPIPort
QString m_feedbackAudioDeviceName
This is the audio device you send the audio samples to for audio feedback.
uint16_t m_reverseAPIChannelIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChannelMarker()

void NFMModSettings::setChannelMarker ( Serializable channelMarker)
inline

Definition at line 69 of file nfmmodsettings.h.

Referenced by NFMModGUI::NFMModGUI().

69 { m_channelMarker = channelMarker; }
Serializable * m_channelMarker
+ Here is the caller graph for this function:

◆ setCWKeyerGUI()

void NFMModSettings::setCWKeyerGUI ( Serializable cwKeyerGUI)
inline

Definition at line 70 of file nfmmodsettings.h.

References deserialize(), getCTCSSFreq(), getCTCSSFreqIndex(), getRFBW(), getRFBWIndex(), and serialize().

Referenced by NFMModGUI::NFMModGUI().

70 { m_cwKeyerGUI = cwKeyerGUI; }
Serializable * m_cwKeyerGUI
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_afBandwidth

Real NFMModSettings::m_afBandwidth

◆ m_audioDeviceName

QString NFMModSettings::m_audioDeviceName

◆ m_channelMarker

Serializable* NFMModSettings::m_channelMarker

Definition at line 64 of file nfmmodsettings.h.

Referenced by deserialize(), and serialize().

◆ m_channelMute

bool NFMModSettings::m_channelMute

◆ m_ctcssFreqs

const float NFMModSettings::m_ctcssFreqs
static
Initial value:
= {
67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8,
97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8,
136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2,
192.8, 203.5
}

Definition at line 39 of file nfmmodsettings.h.

Referenced by getCTCSSFreq(), and getCTCSSFreqIndex().

◆ m_ctcssIndex

int NFMModSettings::m_ctcssIndex

◆ m_ctcssOn

bool NFMModSettings::m_ctcssOn

◆ m_cwKeyerGUI

Serializable* NFMModSettings::m_cwKeyerGUI

Definition at line 65 of file nfmmodsettings.h.

Referenced by deserialize(), and serialize().

◆ m_feedbackAudioDeviceName

QString NFMModSettings::m_feedbackAudioDeviceName

This is the audio device you send the audio samples to for audio feedback.

Definition at line 55 of file nfmmodsettings.h.

Referenced by NFMMod::applySettings(), NFMModGUI::audioFeedbackSelect(), deserialize(), resetToDefaults(), and serialize().

◆ m_feedbackAudioEnable

bool NFMModSettings::m_feedbackAudioEnable

◆ m_feedbackVolumeFactor

float NFMModSettings::m_feedbackVolumeFactor

◆ m_fmDeviation

float NFMModSettings::m_fmDeviation

◆ m_inputFrequencyOffset

qint64 NFMModSettings::m_inputFrequencyOffset

◆ m_modAFInput

NFMModInputAF NFMModSettings::m_modAFInput

◆ m_nbCTCSSFreqs

const int NFMModSettings::m_nbCTCSSFreqs = 32
static

Definition at line 38 of file nfmmodsettings.h.

Referenced by getCTCSSFreq(), getCTCSSFreqIndex(), and NFMModGUI::NFMModGUI().

◆ m_nbRfBW

const int NFMModSettings::m_nbRfBW = 11
static

Definition at line 36 of file nfmmodsettings.h.

Referenced by getRFBW(), getRFBWIndex(), and NFMModGUI::NFMModGUI().

◆ m_playLoop

bool NFMModSettings::m_playLoop

◆ m_reverseAPIAddress

QString NFMModSettings::m_reverseAPIAddress

◆ m_reverseAPIChannelIndex

uint16_t NFMModSettings::m_reverseAPIChannelIndex

◆ m_reverseAPIDeviceIndex

uint16_t NFMModSettings::m_reverseAPIDeviceIndex

◆ m_reverseAPIPort

uint16_t NFMModSettings::m_reverseAPIPort

◆ m_rfBandwidth

Real NFMModSettings::m_rfBandwidth

◆ m_rfBW

const int NFMModSettings::m_rfBW
static
Initial value:
= {
3000, 4000, 5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000
}

Definition at line 37 of file nfmmodsettings.h.

Referenced by getRFBW(), and getRFBWIndex().

◆ m_rgbColor

quint32 NFMModSettings::m_rgbColor

◆ m_title

QString NFMModSettings::m_title

◆ m_toneFrequency

float NFMModSettings::m_toneFrequency

◆ m_useReverseAPI

bool NFMModSettings::m_useReverseAPI

◆ m_volumeFactor

float NFMModSettings::m_volumeFactor

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