1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

FileSource channel: final changes. Bumped version and updated changelogs

This commit is contained in:
f4exb 2019-07-10 01:58:29 +02:00
parent 9526d82ab8
commit 0b0985f918
19 changed files with 413 additions and 75 deletions

View File

@ -1,3 +1,10 @@
sdrangel (4.11.0-1) unstable; urgency=medium
* File Source channel plugin
* Flatpak build update
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Tue, 09 Jul 2019 23:04:06 +0200
sdrangel (4.10.5-1) unstable; urgency=medium
* Windows: removed console display

View File

@ -17,8 +17,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# configure version
set(sdrangel_VERSION_MAJOR "4")
set(sdrangel_VERSION_MINOR "10")
set(sdrangel_VERSION_PATCH "5")
set(sdrangel_VERSION_MINOR "11")
set(sdrangel_VERSION_PATCH "0")
set(sdrangel_VERSION_SUFFIX "")
# SDRAngel cmake options

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
sdrangel (4.11.0-1) unstable; urgency=medium
* File Source channel plugin
* Flatpak build update
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Tue, 09 Jul 2019 23:04:06 +0200
sdrangel (4.10.5-1) unstable; urgency=medium
* Windows: removed console display

View File

@ -36,13 +36,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>171</height>
<width>412</width>
<height>181</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>415</width>
<width>412</width>
<height>0</height>
</size>
</property>

View File

@ -41,6 +41,7 @@
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/hbfilterchainconverter.h"
#include "dsp/filerecord.h"
#include "util/db.h"
MESSAGE_CLASS_DEFINITION(FileSource::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(FileSource::MsgSampleRateNotification, Message)
@ -82,6 +83,12 @@ FileSource::FileSource(DeviceAPI *deviceAPI) :
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
m_linearGain = 1.0f;
m_magsq = 0.0f;
m_magsqSum = 0.0f;
m_magsqPeak = 0.0f;
m_magsqCount = 0;
}
FileSource::~FileSource()
@ -96,6 +103,9 @@ FileSource::~FileSource()
void FileSource::pull(Sample& sample)
{
Real re;
Real im;
struct Sample16
{
int16_t real;
@ -110,12 +120,10 @@ void FileSource::pull(Sample& sample)
if (!m_running)
{
sample.setReal(0);
sample.setImag(0);
return;
re = 0;
im = 0;
}
if (m_sampleSize == 16)
else if (m_sampleSize == 16)
{
Sample16 sample16;
m_ifstream.read(reinterpret_cast<char*>(&sample16), sizeof(Sample16));
@ -126,24 +134,12 @@ void FileSource::pull(Sample& sample)
m_samplesCount++;
}
if (SDR_TX_SAMP_SZ == 16)
{
sample.setReal(sample16.real);
sample.setImag(sample16.imag);
}
else if (SDR_TX_SAMP_SZ == 24)
{
sample.setReal(sample16.real << 8);
sample.setImag(sample16.imag << 8);
}
else
{
sample.setReal(0);
sample.setImag(0);
}
}
else if (m_sampleSize == 24)
{
// scale to +/-1.0
re = (sample16.real * m_linearGain) / 32760.0f;
im = (sample16.imag * m_linearGain) / 32760.0f;
}
else if (m_sampleSize == 24)
{
Sample24 sample24;
m_ifstream.read(reinterpret_cast<char*>(&sample24), sizeof(Sample24));
@ -153,27 +149,43 @@ void FileSource::pull(Sample& sample)
m_samplesCount++;
}
if (SDR_TX_SAMP_SZ == 24)
{
sample.setReal(sample24.real);
sample.setImag(sample24.imag);
}
else if (SDR_TX_SAMP_SZ == 16)
{
sample.setReal(sample24.real >> 8);
sample.setImag(sample24.imag >> 8);
}
else
{
sample.setReal(0);
sample.setImag(0);
}
}
// scale to +/-1.0
re = (sample24.real * m_linearGain) / 8388608.0f;
im = (sample24.imag * m_linearGain) / 8388608.0f;
}
else
{
re = 0;
im = 0;
}
if (SDR_TX_SAMP_SZ == 16)
{
sample.setReal(re * 32768.0f);
sample.setImag(im * 32768.0f);
}
else if (SDR_TX_SAMP_SZ == 24)
{
sample.setReal(re * 8388608.0f);
sample.setImag(im * 8388608.0f);
}
else
{
sample.setReal(0);
sample.setImag(0);
}
Real magsq = re*re + im*im;
m_movingAverage(magsq);
m_magsq = m_movingAverage.asDouble();
m_magsqSum += magsq;
if (magsq > m_magsqPeak) {
m_magsqPeak = magsq;
}
m_magsqCount++;
}
void FileSource::pullAudio(int nbSamples)
@ -457,13 +469,19 @@ void FileSource::applySettings(const FileSourceSettings& settings, bool force)
QList<QString> reverseAPIKeys;
if ((m_settings.m_loop != settings.m_loop)) {
if ((m_settings.m_loop != settings.m_loop) || force) {
reverseAPIKeys.append("loop");
}
if ((m_settings.m_fileName != settings.m_fileName)) {
if ((m_settings.m_fileName != settings.m_fileName) || force) {
reverseAPIKeys.append("fileName");
}
if ((m_settings.m_gainDB != settings.m_gainDB) || force)
{
m_linearGain = CalcDb::powerFromdB(settings.m_gainDB);
reverseAPIKeys.append("gainDB");
}
if (settings.m_useReverseAPI)
{
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
@ -530,6 +548,9 @@ int FileSource::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getFileSourceSettings()->getTitle();
}
if (channelSettingsKeys.contains("gainDB")) {
settings.m_gainDB = response.getFileSourceSettings()->getGainDb();
}
if (channelSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getFileSourceSettings()->getUseReverseApi() != 0;
}
@ -576,6 +597,7 @@ void FileSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& re
{
response.getFileSourceSettings()->setLog2Interp(settings.m_log2Interp);
response.getFileSourceSettings()->setFilterChainHash(settings.m_filterChainHash);
response.getFileSourceSettings()->setGainDb(settings.m_gainDB);
response.getFileSourceSettings()->setRgbColor(settings.m_rgbColor);
if (response.getFileSourceSettings()->getTitle()) {
@ -599,9 +621,36 @@ void FileSource::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& re
void FileSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
{
qint64 t_sec = 0;
qint64 t_msec = 0;
quint64 samplesCount = getSamplesCount();
if (m_fileSampleRate > 0)
{
t_sec = samplesCount / m_fileSampleRate;
t_msec = (samplesCount - (t_sec * m_fileSampleRate)) * 1000 / m_fileSampleRate;
}
QTime t(0, 0, 0, 0);
t = t.addSecs(t_sec);
t = t.addMSecs(t_msec);
response.getFileSourceReport()->setElapsedTime(new QString(t.toString("HH:mm:ss.zzz")));
qint64 startingTimeStampMsec = m_startingTimeStamp * 1000LL;
QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
dt = dt.addSecs(t_sec);
dt = dt.addMSecs(t_msec);
response.getFileSourceReport()->setAbsoluteTime(new QString(dt.toString("yyyy-MM-dd HH:mm:ss.zzz")));
QTime recordLength(0, 0, 0, 0);
recordLength = recordLength.addSecs(m_recordLength);
response.getFileSourceReport()->setDurationTime(new QString(recordLength.toString("HH:mm:ss")));
response.getFileSourceReport()->setFileName(new QString(m_settings.m_fileName));
response.getFileSourceReport()->setFileSampleRate(m_fileSampleRate);
response.getFileSourceReport()->setFileSampleSize(m_sampleSize);
response.getFileSourceReport()->setSampleRate(m_sampleRate);
response.getFileSourceReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
}
void FileSource::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const FileSourceSettings& settings, bool force)
@ -622,6 +671,9 @@ void FileSource::webapiReverseSendSettings(QList<QString>& channelSettingsKeys,
if (channelSettingsKeys.contains("filterChainHash") || force) {
swgFileSourceSettings->setFilterChainHash(settings.m_filterChainHash);
}
if (channelSettingsKeys.contains("gainDB") || force) {
swgFileSourceSettings->setGainDb(settings.m_gainDB);
}
if (channelSettingsKeys.contains("rgbColor") || force) {
swgFileSourceSettings->setRgbColor(settings.m_rgbColor);
}

View File

@ -31,7 +31,7 @@
#include "dsp/basebandsamplesource.h"
#include "channel/channelapi.h"
#include "util/message.h"
#include "util/movingaverage.h"
#include "filesourcesettings.h"
class ThreadedBasebandSampleSource;
@ -354,11 +354,40 @@ public:
void setSampleRate(uint32_t sampleRate) { m_sampleRate = sampleRate; }
quint64 getSamplesCount() const { return m_samplesCount; }
double getMagSq() const { return m_magsq; }
void getMagSqLevels(double& avg, double& peak, int& nbSamples)
{
if (m_magsqCount > 0)
{
m_magsq = m_magsqSum / m_magsqCount;
m_magSqLevelStore.m_magsq = m_magsq;
m_magSqLevelStore.m_magsqPeak = m_magsqPeak;
}
avg = m_magSqLevelStore.m_magsq;
peak = m_magSqLevelStore.m_magsqPeak;
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
m_magsqSum = 0.0f;
m_magsqPeak = 0.0f;
m_magsqCount = 0;
}
static const QString m_channelIdURI;
static const QString m_channelId;
private:
struct MagSqLevelsStore
{
MagSqLevelsStore() :
m_magsq(1e-12),
m_magsqPeak(1e-12)
{}
double m_magsq;
double m_magsqPeak;
};
DeviceAPI* m_deviceAPI;
QMutex m_mutex;
ThreadedBasebandSampleSource* m_threadedChannelizer;
@ -380,6 +409,14 @@ private:
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
double m_linearGain;
double m_magsq;
double m_magsqSum;
double m_magsqPeak;
int m_magsqCount;
MagSqLevelsStore m_magSqLevelStore;
MovingAverageUtil<Real, double, 16> m_movingAverage;
void openFileStream();
void seekFileStream(int seekMillis);
void handleEOF();

View File

@ -25,6 +25,8 @@
#include "device/deviceuiset.h"
#include "dsp/hbfilterchainconverter.h"
#include "gui/basicchannelsettingsdialog.h"
#include "util/db.h"
#include "mainwindow.h"
#include "filesource.h"
@ -169,7 +171,10 @@ FileSourceGUI::FileSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
m_tickCount(0)
{
(void) channelTx;
ui->setupUi(this);
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
@ -307,6 +312,8 @@ void FileSourceGUI::displaySettings()
setWindowTitle(m_channelMarker.getTitle());
blockApplySettings(true);
ui->gain->setValue(m_settings.m_gainDB);
ui->gainText->setText(tr("%1 dB").arg(m_settings.m_gainDB));
ui->interpolationFactor->setCurrentIndex(m_settings.m_log2Interp);
applyInterpolation();
blockApplySettings(false);
@ -395,6 +402,13 @@ void FileSourceGUI::on_position_valueChanged(int value)
applyPosition();
}
void FileSourceGUI::on_gain_valueChanged(int value)
{
ui->gainText->setText(tr("%1 dB").arg(value));
m_settings.m_gainDB = value;
applySettings();
}
void FileSourceGUI::on_showFileDialog_clicked(bool checked)
{
(void) checked;
@ -464,6 +478,21 @@ void FileSourceGUI::applyPosition()
void FileSourceGUI::tick()
{
double magsqAvg, magsqPeak;
int nbMagsqSamples;
m_fileSource->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
double powDbAvg = CalcDb::dbPower(magsqAvg);
double powDbPeak = CalcDb::dbPower(magsqPeak);
ui->channelPowerMeter->levelChanged(
(100.0f + powDbAvg) / 100.0f,
(100.0f + powDbPeak) / 100.0f,
nbMagsqSamples);
if (m_tickCount % 4 == 0) {
ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
}
if (++m_tickCount == 20) // once per second
{
FileSource::MsgConfigureFileSourceStreamTiming* message = FileSource::MsgConfigureFileSourceStreamTiming::create();

View File

@ -106,6 +106,7 @@ private slots:
void onMenuDialogCalled(const QPoint& p);
void on_interpolationFactor_currentIndexChanged(int index);
void on_position_valueChanged(int value);
void on_gain_valueChanged(int value);
void on_showFileDialog_clicked(bool checked);
void on_playLoop_toggled(bool checked);
void on_play_toggled(bool checked);

View File

@ -6,28 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>177</height>
<width>382</width>
<height>228</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<width>382</width>
<height>140</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
@ -40,12 +34,18 @@
<widget class="QWidget" name="settingsContainer" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>301</width>
<height>161</height>
<x>0</x>
<y>0</y>
<width>380</width>
<height>221</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>380</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
@ -253,6 +253,117 @@
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="powerLayer">
<property name="spacing">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="powerMeterLayer">
<property name="rightMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="channelPowerUnits">
<property name="text">
<string>dB</string>
</property>
</widget>
</item>
<item>
<widget class="LevelMeterSignalDB" name="channelPowerMeter" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="channelPower">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>-100.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="gainLayer">
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>Gain</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Gain (dB)</string>
</property>
<property name="minimum">
<number>-10</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>45</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Filter chain hash code</string>
</property>
<property name="text">
<string>-10.0 dB</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="fileSelectionLayout">
<item>
@ -299,13 +410,13 @@
<widget class="QLabel" name="sampleRateText">
<property name="minimumSize">
<size>
<width>40</width>
<width>54</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>9</pointsize>
</font>
</property>
<property name="toolTip">
@ -330,13 +441,13 @@
<widget class="QLabel" name="sampleSizeText">
<property name="minimumSize">
<size>
<width>22</width>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>9</pointsize>
</font>
</property>
<property name="toolTip">
@ -361,7 +472,7 @@
<widget class="QLabel" name="crcLabel">
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>9</pointsize>
</font>
</property>
<property name="toolTip">
@ -595,6 +706,12 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
<extends>QWidget</extends>
<header>gui/levelmeter.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -34,6 +34,7 @@ void FileSourceSettings::resetToDefaults()
m_loop = false;
m_log2Interp = 0;
m_filterChainHash = 0;
m_gainDB = 0;
m_rgbColor = QColor(140, 4, 4).rgb();
m_title = "File source";
m_channelMarker = nullptr;
@ -51,13 +52,14 @@ QByteArray FileSourceSettings::serialize() const
s.writeBool(2, m_loop);
s.writeU32(3, m_log2Interp);
s.writeU32(4, m_filterChainHash);
s.writeU32(5, m_rgbColor);
s.writeString(6, m_title);
s.writeBool(7, m_useReverseAPI);
s.writeString(8, m_reverseAPIAddress);
s.writeU32(9, m_reverseAPIPort);
s.writeU32(10, m_reverseAPIDeviceIndex);
s.writeU32(11, m_reverseAPIChannelIndex);
s.writeS32(5, m_gainDB);
s.writeU32(6, m_rgbColor);
s.writeString(7, m_title);
s.writeBool(8, m_useReverseAPI);
s.writeString(9, m_reverseAPIAddress);
s.writeU32(10, m_reverseAPIPort);
s.writeU32(11, m_reverseAPIDeviceIndex);
s.writeU32(12, m_reverseAPIChannelIndex);
return s.final();
}
@ -75,6 +77,7 @@ bool FileSourceSettings::deserialize(const QByteArray& data)
if(d.getVersion() == 1)
{
uint32_t tmp;
int itmp;
QString strtmp;
d.readString(1, &m_fileName, "test.sdriq");
@ -82,6 +85,8 @@ bool FileSourceSettings::deserialize(const QByteArray& data)
d.readU32(3, &tmp, 0);
m_log2Interp = tmp > 6 ? 6 : tmp;
d.readU32(4, &m_filterChainHash, 0);
d.readS32(5, &itmp, 20);
m_gainDB = itmp < -10 ? -10 : itmp > 50 ? 50 : itmp;
d.readU32(5, &m_rgbColor, QColor(140, 4, 4).rgb());
d.readString(6, &m_title, "File source");
d.readBool(7, &m_useReverseAPI, false);

View File

@ -29,6 +29,7 @@ struct FileSourceSettings
bool m_loop;
uint32_t m_log2Interp;
uint32_t m_filterChainHash;
int m_gainDB;
quint32 m_rgbColor;
QString m_title;
bool m_useReverseAPI;

View File

@ -2635,6 +2635,11 @@ margin-bottom: 20px;
"sampleRate" : {
"type" : "integer",
"description" : "Channel sample rate in S/s"
},
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
}
},
"description" : "FileSource"
@ -2655,6 +2660,9 @@ margin-bottom: 20px;
"filterChainHash" : {
"type" : "integer"
},
"gainDB" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
@ -25233,7 +25241,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-07-08T00:35:02.822+02:00
Generated 2019-07-10T00:43:21.317+02:00
</div>
</div>
</div>

View File

@ -11,6 +11,8 @@ FileSourceSettings:
type: integer
filterChainHash:
type: integer
gainDB:
type: integer
rgbColor:
type: integer
title:
@ -50,3 +52,7 @@ FileSourceReport:
sampleRate:
description: Channel sample rate in S/s
type: integer
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float

View File

@ -11,6 +11,8 @@ FileSourceSettings:
type: integer
filterChainHash:
type: integer
gainDB:
type: integer
rgbColor:
type: integer
title:
@ -50,3 +52,7 @@ FileSourceReport:
sampleRate:
description: Channel sample rate in S/s
type: integer
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float

View File

@ -2635,6 +2635,11 @@ margin-bottom: 20px;
"sampleRate" : {
"type" : "integer",
"description" : "Channel sample rate in S/s"
},
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
}
},
"description" : "FileSource"
@ -2655,6 +2660,9 @@ margin-bottom: 20px;
"filterChainHash" : {
"type" : "integer"
},
"gainDB" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
@ -25233,7 +25241,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-07-08T00:35:02.822+02:00
Generated 2019-07-10T00:43:21.317+02:00
</div>
</div>
</div>

View File

@ -42,6 +42,8 @@ SWGFileSourceReport::SWGFileSourceReport() {
m_duration_time_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
}
SWGFileSourceReport::~SWGFileSourceReport() {
@ -64,6 +66,8 @@ SWGFileSourceReport::init() {
m_duration_time_isSet = false;
sample_rate = 0;
m_sample_rate_isSet = false;
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
}
void
@ -83,6 +87,7 @@ SWGFileSourceReport::cleanup() {
delete duration_time;
}
}
SWGFileSourceReport*
@ -110,6 +115,8 @@ SWGFileSourceReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
}
QString
@ -147,6 +154,9 @@ SWGFileSourceReport::asJsonObject() {
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate));
}
if(m_channel_power_db_isSet){
obj->insert("channelPowerDB", QJsonValue(channel_power_db));
}
return obj;
}
@ -221,6 +231,16 @@ SWGFileSourceReport::setSampleRate(qint32 sample_rate) {
this->m_sample_rate_isSet = true;
}
float
SWGFileSourceReport::getChannelPowerDb() {
return channel_power_db;
}
void
SWGFileSourceReport::setChannelPowerDb(float channel_power_db) {
this->channel_power_db = channel_power_db;
this->m_channel_power_db_isSet = true;
}
bool
SWGFileSourceReport::isSet(){
@ -233,6 +253,7 @@ SWGFileSourceReport::isSet(){
if(elapsed_time != nullptr && *elapsed_time != QString("")){ isObjectUpdated = true; break;}
if(duration_time != nullptr && *duration_time != QString("")){ isObjectUpdated = true; break;}
if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -63,6 +63,9 @@ public:
qint32 getSampleRate();
void setSampleRate(qint32 sample_rate);
float getChannelPowerDb();
void setChannelPowerDb(float channel_power_db);
virtual bool isSet() override;
@ -88,6 +91,9 @@ private:
qint32 sample_rate;
bool m_sample_rate_isSet;
float channel_power_db;
bool m_channel_power_db_isSet;
};
}

View File

@ -36,6 +36,8 @@ SWGFileSourceSettings::SWGFileSourceSettings() {
m_log2_interp_isSet = false;
filter_chain_hash = 0;
m_filter_chain_hash_isSet = false;
gain_db = 0;
m_gain_db_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
@ -66,6 +68,8 @@ SWGFileSourceSettings::init() {
m_log2_interp_isSet = false;
filter_chain_hash = 0;
m_filter_chain_hash_isSet = false;
gain_db = 0;
m_gain_db_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString("");
@ -91,6 +95,7 @@ SWGFileSourceSettings::cleanup() {
if(title != nullptr) {
delete title;
}
@ -122,6 +127,8 @@ SWGFileSourceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&filter_chain_hash, pJson["filterChainHash"], "qint32", "");
::SWGSDRangel::setValue(&gain_db, pJson["gainDB"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
@ -164,6 +171,9 @@ SWGFileSourceSettings::asJsonObject() {
if(m_filter_chain_hash_isSet){
obj->insert("filterChainHash", QJsonValue(filter_chain_hash));
}
if(m_gain_db_isSet){
obj->insert("gainDB", QJsonValue(gain_db));
}
if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color));
}
@ -229,6 +239,16 @@ SWGFileSourceSettings::setFilterChainHash(qint32 filter_chain_hash) {
this->m_filter_chain_hash_isSet = true;
}
qint32
SWGFileSourceSettings::getGainDb() {
return gain_db;
}
void
SWGFileSourceSettings::setGainDb(qint32 gain_db) {
this->gain_db = gain_db;
this->m_gain_db_isSet = true;
}
qint32
SWGFileSourceSettings::getRgbColor() {
return rgb_color;
@ -308,6 +328,7 @@ SWGFileSourceSettings::isSet(){
if(m_loop_isSet){ isObjectUpdated = true; break;}
if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
if(m_filter_chain_hash_isSet){ isObjectUpdated = true; break;}
if(m_gain_db_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}

View File

@ -54,6 +54,9 @@ public:
qint32 getFilterChainHash();
void setFilterChainHash(qint32 filter_chain_hash);
qint32 getGainDb();
void setGainDb(qint32 gain_db);
qint32 getRgbColor();
void setRgbColor(qint32 rgb_color);
@ -91,6 +94,9 @@ private:
qint32 filter_chain_hash;
bool m_filter_chain_hash_isSet;
qint32 gain_db;
bool m_gain_db_isSet;
qint32 rgb_color;
bool m_rgb_color_isSet;