1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

DATV demod: removed sample rate from settings

This commit is contained in:
f4exb 2019-03-18 02:43:58 +01:00
parent cc8edc9e75
commit 0d7e573fae
5 changed files with 13 additions and 48 deletions

View File

@ -46,6 +46,7 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) :
m_blnRenderingVideo(false),
m_blnStartStopVideo(false),
m_enmModulation(DATVDemodSettings::BPSK /*DATV_FM1*/),
m_sampleRate(1024000),
m_objSettingsMutex(QMutex::NonRecursive)
{
setObjectName("DATVDemod");
@ -426,8 +427,6 @@ void DATVDemod::InitDATVFramework()
CleanUpDATVFramework(false);
qDebug() << "DATVDemod::InitDATVFramework:"
<< " Msps: " << m_settings.m_msps
<< " Sample Rate: " << m_settings.m_sampleRate
<< " Symbol Rate: " << m_settings.m_symbolRate
<< " Modulation: " << m_settings.m_modulation
<< " Notch Filters: " << m_settings.m_notchFilters
@ -442,7 +441,7 @@ void DATVDemod::InitDATVFramework()
m_objCfg.standard = m_settings.m_standard;
m_objCfg.fec = m_settings.m_fec;
m_objCfg.Fs = (float) m_settings.m_sampleRate;
m_objCfg.Fs = (float) m_sampleRate;
m_objCfg.Fm = (float) m_settings.m_symbolRate;
m_objCfg.fastlock = m_settings.m_fastLock;
@ -864,7 +863,7 @@ bool DATVDemod::handleMessage(const Message& cmd)
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_channelizer->getInputSampleRate(),
m_channelizer->getInputSampleRate(), // do not change sample rate
cfg.getCenterFrequency());
qDebug() << "DATVDemod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getInputSampleRate()
@ -893,12 +892,12 @@ void DATVDemod::applyChannelSettings(int inputSampleRate, int inputFrequencyOffs
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((m_settings.m_centerFrequency != inputFrequencyOffset) ||
(m_settings.m_msps != inputSampleRate) || force)
(m_sampleRate != inputSampleRate) || force)
{
m_objNCO.setFreq(-(float) inputFrequencyOffset, (float) inputSampleRate);
}
if ((m_settings.m_msps != inputSampleRate) || force)
if ((m_sampleRate != inputSampleRate) || force)
{
m_objSettingsMutex.lock();
//Bandpass filter shaping
@ -909,8 +908,7 @@ void DATVDemod::applyChannelSettings(int inputSampleRate, int inputFrequencyOffs
m_objSettingsMutex.unlock();
}
m_settings.m_msps = inputSampleRate;
m_settings.m_sampleRate = m_settings.m_msps;
m_sampleRate = inputSampleRate;
m_settings.m_centerFrequency = inputFrequencyOffset;
}
@ -919,7 +917,7 @@ void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
QString msg = tr("DATVDemod::applySettings: force: %1").arg(force);
settings.debug(msg);
if (m_settings.m_msps == 0) {
if (m_sampleRate == 0) {
return;
}
@ -932,15 +930,15 @@ void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
{
//Bandpass filter shaping
Real fltLowCut = -((float) settings.m_rfBandwidth / 2.0) / (float) m_settings.m_msps;
Real fltHiCut = ((float) settings.m_rfBandwidth / 2.0) / (float) m_settings.m_msps;
Real fltLowCut = -((float) settings.m_rfBandwidth / 2.0) / (float) m_sampleRate;
Real fltHiCut = ((float) settings.m_rfBandwidth / 2.0) / (float) m_sampleRate;
m_objRFFilter->create_filter(fltLowCut, fltHiCut);
}
if ((m_settings.m_centerFrequency != settings.m_centerFrequency)
|| force)
{
m_objNCO.setFreq(-(float) settings.m_centerFrequency, (float) m_settings.m_msps);
m_objNCO.setFreq(-(float) settings.m_centerFrequency, (float) m_sampleRate);
}
m_objSettingsMutex.unlock();
@ -950,31 +948,7 @@ void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
m_settings = settings;
}
// void DATVDemod::ApplySettings()
// {
// if (m_objRunning.intMsps == 0) {
// return;
// }
// InitDATVParameters(m_objRunning.intMsps,
// m_objRunning.intRFBandwidth,
// m_objRunning.intCenterFrequency,
// m_objRunning.enmStandard,
// m_objRunning.enmModulation,
// m_objRunning.enmFEC,
// m_objRunning.intSampleRate,
// m_objRunning.intSymbolRate,
// m_objRunning.intNotchFilters,
// m_objRunning.blnAllowDrift,
// m_objRunning.blnFastLock,
// m_objRunning.enmFilter,
// m_objRunning.blnHardMetric,
// m_objRunning.fltRollOff,
// m_objRunning.blnViterbi,
// m_objRunning.intExcursion);
// }
int DATVDemod::GetSampleRate()
{
return m_settings.m_msps;
return m_sampleRate;
}

View File

@ -349,6 +349,7 @@ private:
//DATVConfig m_objRunning;
DATVDemodSettings m_settings;
int m_sampleRate;
MovingAverageUtil<double, double, 32> m_objMagSqAverage;
QMutex m_objSettingsMutex;

View File

@ -647,7 +647,7 @@ void DATVDemodGUI::displayRRCParameters(bool blnVisible)
void DATVDemodGUI::on_cmbFilter_currentIndexChanged(int index)
{
(void) index;
displayRRCParameters((ui->cmbFilter->currentIndex()==2));
displayRRCParameters((ui->cmbFilter->currentIndex() == 2));
applySettings();
}

View File

@ -32,13 +32,11 @@ void DATVDemodSettings::resetToDefaults()
{
m_rgbColor = QColor(Qt::magenta).rgb();
m_title = "DATV Demodulator";
m_msps = 1024000;
m_rfBandwidth = 512000;
m_centerFrequency = 0;
m_standard = DVB_S;
m_modulation = BPSK;
m_fec = leansdr::FEC12;
m_sampleRate = 1024000;
m_symbolRate = 250000;
m_notchFilters = 1;
m_allowDrift = false;
@ -53,7 +51,6 @@ void DATVDemodSettings::resetToDefaults()
QByteArray DATVDemodSettings::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_msps);
s.writeS32(2, m_rfBandwidth);
s.writeS32(3, m_centerFrequency);
s.writeS32(4, (int) m_standard);
@ -66,7 +63,6 @@ QByteArray DATVDemodSettings::serialize() const
s.writeU32(7, m_rgbColor);
s.writeString(8, m_title);
s.writeS32(9, (int) m_fec);
s.writeS32(10, m_sampleRate);
s.writeS32(11, m_symbolRate);
s.writeS32(12, m_notchFilters);
s.writeBool(13, m_allowDrift);
@ -96,7 +92,6 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
qint32 tmp;
QString strtmp;
d.readS32(1, &m_msps, 1024000);
d.readS32(2, &m_rfBandwidth, 512000);
d.readS32(3, &m_centerFrequency, 0);
@ -121,7 +116,6 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
tmp = tmp < 0 ? 0 : tmp >= (int) leansdr::code_rate::FEC_COUNT ? (int) leansdr::code_rate::FEC_COUNT - 1 : tmp;
m_fec = (leansdr::code_rate) tmp;
d.readS32(10, &m_sampleRate, 1024000);
d.readS32(11, &m_symbolRate, 250000);
d.readS32(12, &m_notchFilters, 1);
d.readBool(13, &m_allowDrift, false);
@ -148,8 +142,6 @@ bool DATVDemodSettings::deserialize(const QByteArray& data)
void DATVDemodSettings::debug(const QString& msg) const
{
qDebug() << msg
<< " m_msps: " << m_msps
<< " m_sampleRate: " << m_sampleRate
<< " m_allowDrift: " << m_allowDrift
<< " m_rfBandwidth: " << m_rfBandwidth
<< " m_centerFrequency: " << m_centerFrequency

View File

@ -56,13 +56,11 @@ struct DATVDemodSettings
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
int m_msps; //!< FIXME: ineffective
int m_rfBandwidth;
int m_centerFrequency;
dvb_version m_standard;
DATVModulation m_modulation;
leansdr::code_rate m_fec;
int m_sampleRate; //!< FIXME: innefective
int m_symbolRate;
int m_notchFilters;
bool m_allowDrift;