1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

All concerned mods: call applyChannelSettings with force=true at construction and start.

This commit is contained in:
f4exb 2018-01-09 01:10:49 +01:00
parent 6885dd1fe6
commit 561420415e
12 changed files with 36 additions and 24 deletions

View File

@ -80,6 +80,7 @@ AMMod::AMMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
}
@ -255,6 +256,7 @@ void AMMod::start()
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
m_audioFifo.clear();
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
}
void AMMod::stop()
@ -376,7 +378,7 @@ void AMMod::seekFileStream(int seekPercentage)
}
}
void AMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
void AMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "AMMod::applyChannelSettings:"
<< " basebandSampleRate: " << basebandSampleRate
@ -384,14 +386,14 @@ void AMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, i
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
if ((outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;

View File

@ -310,7 +310,7 @@ private:
static const int m_levelNbSamples;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const AMModSettings& settings, bool force = false);
void pullAF(Real& sample);
void calculateLevel(Real& sample);

View File

@ -97,6 +97,7 @@ ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true); // does applyStandard() too;
}
@ -489,6 +490,7 @@ void ATVMod::start()
{
qDebug() << "ATVMod::start: m_outputSampleRate: " << m_outputSampleRate
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
applyChannelSettings(m_outputSampleRate, m_inputFrequencyOffset, true);
}
void ATVMod::stop()
@ -1024,21 +1026,21 @@ void ATVMod::mixImageAndText(cv::Mat& image)
cv::putText(image, m_overlayText, textOrg, fontFace, fontScale, cv::Scalar::all(255*m_settings.m_uniformLevel), thickness, CV_AA);
}
void ATVMod::applyChannelSettings(int outputSampleRate, int inputFrequencyOffset)
void ATVMod::applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "AMMod::applyChannelSettings:"
<< " outputSampleRate: " << outputSampleRate
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
if ((outputSampleRate != m_outputSampleRate) || force)
{
getBaseValues(outputSampleRate, m_settings.m_nbLines * m_settings.m_fps, m_tvSampleRate, m_pointsPerLine);

View File

@ -561,7 +561,7 @@ private:
static const int m_nbBars; //!< number of bars in bar or chessboard patterns
static const int m_cameraFPSTestNbFrames; //!< number of frames for camera FPS test
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const ATVModSettings& settings, bool force = false);
void pullFinalize(Complex& ci, Sample& sample);
void pullVideo(Real& sample);

View File

@ -86,6 +86,7 @@ NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
}
@ -270,6 +271,7 @@ void NFMMod::start()
<< " m_inputFrequencyOffset: " << m_inputFrequencyOffset;
m_audioFifo.clear();
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
}
void NFMMod::stop()
@ -385,7 +387,7 @@ void NFMMod::seekFileStream(int seekPercentage)
}
}
void NFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
void NFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "NFMMod::applyChannelSettings:"
<< " basebandSampleRate: " << basebandSampleRate
@ -393,14 +395,14 @@ void NFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate,
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
if ((outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;

View File

@ -304,7 +304,7 @@ private:
CWKeyer m_cwKeyer;
static const int m_levelNbSamples;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const NFMModSettings& settings, bool force = false);
void pullAF(Real& sample);
void calculateLevel(Real& sample);

View File

@ -104,6 +104,7 @@ SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
}
@ -528,6 +529,7 @@ void SSBMod::start()
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
m_audioFifo.clear();
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
}
void SSBMod::stop()
@ -645,7 +647,7 @@ void SSBMod::seekFileStream(int seekPercentage)
}
}
void SSBMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
void SSBMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "SSBMod::applyChannelSettings:"
<< " basebandSampleRate: " << basebandSampleRate
@ -653,14 +655,14 @@ void SSBMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate,
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
if ((outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;

View File

@ -327,7 +327,7 @@ private:
static const int m_levelNbSamples;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const SSBModSettings& settings, bool force = false);
void pullAF(Complex& sample);
void calculateLevel(Complex& sample);

View File

@ -92,6 +92,7 @@ WFMMod::WFMMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
}
@ -282,6 +283,7 @@ void WFMMod::start()
<< " m_inputFrequencyOffset: " << m_inputFrequencyOffset;
m_audioFifo.clear();
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
}
void WFMMod::stop()
@ -402,7 +404,7 @@ void WFMMod::seekFileStream(int seekPercentage)
}
}
void WFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
void WFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "WFMMod::applyChannelSettings:"
<< " basebandSampleRate: " << basebandSampleRate
@ -410,14 +412,14 @@ void WFMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate,
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
if ((outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;

View File

@ -317,7 +317,7 @@ private:
CWKeyer m_cwKeyer;
static const int m_levelNbSamples;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const WFMModSettings& settings, bool force = false);
void pullAF(Complex& sample);
void calculateLevel(const Real& sample);

View File

@ -71,6 +71,7 @@ UDPSink::UDPSink(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
}
@ -87,6 +88,7 @@ UDPSink::~UDPSink()
void UDPSink::start()
{
m_udpHandler.start();
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
}
void UDPSink::stop()
@ -439,7 +441,7 @@ void UDPSink::resetReadIndex()
getInputMessageQueue()->push(cmd);
}
void UDPSink::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
void UDPSink::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force)
{
qDebug() << "UDPSink::applyChannelSettings:"
<< " basebandSampleRate: " << basebandSampleRate
@ -447,14 +449,14 @@ void UDPSink::applyChannelSettings(int basebandSampleRate, int outputSampleRate,
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
(outputSampleRate != m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if ((outputSampleRate != m_outputSampleRate) && (!m_settings.m_autoRWBalance))
if (((outputSampleRate != m_outputSampleRate) && (!m_settings.m_autoRWBalance)) || force)
{
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;

View File

@ -219,7 +219,7 @@ private:
static const int m_sampleRateAverageItems = 17;
static const int m_ssbFftLen = 1024;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset, bool force = false);
void applySettings(const UDPSinkSettings& settings, bool force = false);
void modulateSample();
void calculateLevel(Real sample);