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

AM and ATV Mods : use specific method to apply channelizer sample rate and frequency offset changes. Separate this data from settings

This commit is contained in:
f4exb 2017-12-29 11:42:33 +01:00
parent d476736487
commit 054e87c153
8 changed files with 153 additions and 119 deletions

View File

@ -43,7 +43,9 @@ const int AMMod::m_levelNbSamples = 480; // every 10ms
AMMod::AMMod(DeviceSinkAPI *deviceAPI) : AMMod::AMMod(DeviceSinkAPI *deviceAPI) :
ChannelSourceAPI(m_channelIdURI), ChannelSourceAPI(m_channelIdURI),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0), m_basebandSampleRate(48000),
m_outputSampleRate(48000),
m_inputFrequencyOffset(0),
m_movingAverage(40, 0), m_movingAverage(40, 0),
m_volumeAGC(40, 0), m_volumeAGC(40, 0),
m_audioFifo(4800), m_audioFifo(4800),
@ -138,7 +140,7 @@ void AMMod::pull(Sample& sample)
void AMMod::pullAudio(int nbSamples) void AMMod::pullAudio(int nbSamples)
{ {
// qDebug("AMMod::pullAudio: %d", nbSamples); // qDebug("AMMod::pullAudio: %d", nbSamples);
unsigned int nbAudioSamples = nbSamples * ((Real) m_settings.m_audioSampleRate / (Real) m_settings.m_basebandSampleRate); unsigned int nbAudioSamples = nbSamples * ((Real) m_settings.m_audioSampleRate / (Real) m_basebandSampleRate);
if (nbAudioSamples > m_audioBuffer.size()) if (nbAudioSamples > m_audioBuffer.size())
{ {
@ -249,7 +251,7 @@ void AMMod::calculateLevel(Real& sample)
void AMMod::start() void AMMod::start()
{ {
qDebug() << "AMMod::start: m_outputSampleRate: " << m_settings.m_outputSampleRate qDebug() << "AMMod::start: m_outputSampleRate: " << m_outputSampleRate
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset; << " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
m_audioFifo.clear(); m_audioFifo.clear();
@ -264,60 +266,34 @@ bool AMMod::handleMessage(const Message& cmd)
if (UpChannelizer::MsgChannelizerNotification::match(cmd)) if (UpChannelizer::MsgChannelizerNotification::match(cmd))
{ {
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd; UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
AMModSettings settings = m_settings;
settings.m_basebandSampleRate = notif.getBasebandSampleRate();
settings.m_outputSampleRate = notif.getSampleRate();
settings.m_inputFrequencyOffset = notif.getFrequencyOffset();
applySettings(settings);
qDebug() << "AMMod::handleMessage: MsgChannelizerNotification:" qDebug() << "AMMod::handleMessage: MsgChannelizerNotification:"
<< " m_basebandSampleRate: " << settings.m_basebandSampleRate << " basebandSampleRate: " << notif.getBasebandSampleRate()
<< " m_outputSampleRate: " << settings.m_outputSampleRate << " outputSampleRate: " << notif.getSampleRate()
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset; << " inputFrequencyOffset: " << notif.getFrequencyOffset();
applyChannelSettings(notif.getBasebandSampleRate(), notif.getSampleRate(), notif.getFrequencyOffset());
return true; return true;
} }
else if (MsgConfigureChannelizer::match(cmd)) else if (MsgConfigureChannelizer::match(cmd))
{ {
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd; MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
qDebug() << "AMMod::handleMessage: MsgConfigureChannelizer:"
<< " getSampleRate: " << cfg.getSampleRate()
<< " getCenterFrequency: " << cfg.getCenterFrequency();
m_channelizer->configure(m_channelizer->getInputMessageQueue(), m_channelizer->configure(m_channelizer->getInputMessageQueue(),
cfg.getSampleRate(), cfg.getSampleRate(),
cfg.getCenterFrequency()); cfg.getCenterFrequency());
qDebug() << "AMMod::handleMessage: MsgConfigureChannelizer:"
<< " getSampleRate: " << cfg.getSampleRate()
<< " getCenterFrequency: " << cfg.getCenterFrequency();
return true; return true;
} }
else if (MsgConfigureAMMod::match(cmd)) else if (MsgConfigureAMMod::match(cmd))
{ {
MsgConfigureAMMod& cfg = (MsgConfigureAMMod&) cmd; MsgConfigureAMMod& cfg = (MsgConfigureAMMod&) cmd;
qDebug() << "AMMod::handleMessage: MsgConfigureAMMod";
AMModSettings settings = cfg.getSettings(); applySettings(cfg.getSettings(), cfg.getForce());
// These settings are set with DownChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_basebandSampleRate = m_settings.m_basebandSampleRate;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
applySettings(settings, cfg.getForce());
qDebug() << "AMMod::handleMessage: MsgConfigureAMMod:"
<< " m_basebandSampleRate: " << settings.m_basebandSampleRate
<< " m_outputSampleRate: " << settings.m_outputSampleRate
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
<< " m_rfBandwidth: " << settings.m_rfBandwidth
<< " m_modFactor: " << settings.m_modFactor
<< " m_toneFrequency: " << settings.m_toneFrequency
<< " m_volumeFactor: " << settings.m_volumeFactor
<< " m_audioMute: " << settings.m_channelMute
<< " m_playLoop: " << settings.m_playLoop;
return true; return true;
} }
@ -400,24 +376,54 @@ void AMMod::seekFileStream(int seekPercentage)
} }
} }
void AMMod::applySettings(const AMModSettings& settings, bool force) void AMMod::applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset)
{ {
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || qDebug() << "AMMod::applyChannelSettings:"
(settings.m_outputSampleRate != m_settings.m_outputSampleRate) || force) << " basebandSampleRate: " << basebandSampleRate
<< " outputSampleRate: " << outputSampleRate
<< " inputFrequencyOffset: " << inputFrequencyOffset;
if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
(outputSampleRate != m_outputSampleRate))
{ {
m_settingsMutex.lock(); m_settingsMutex.lock();
m_carrierNco.setFreq(settings.m_inputFrequencyOffset, settings.m_outputSampleRate); m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock(); m_settingsMutex.unlock();
} }
if((settings.m_outputSampleRate != m_settings.m_outputSampleRate) || if (outputSampleRate != m_outputSampleRate)
(settings.m_rfBandwidth != m_settings.m_rfBandwidth) || {
m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0;
m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) m_settings.m_audioSampleRate / (Real) outputSampleRate;
m_interpolator.create(48, m_settings.m_audioSampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
m_settingsMutex.unlock();
}
m_basebandSampleRate = basebandSampleRate;
m_outputSampleRate = outputSampleRate;
m_inputFrequencyOffset = inputFrequencyOffset;
}
void AMMod::applySettings(const AMModSettings& settings, bool force)
{
qDebug() << "AMMod::applySettings:"
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
<< " m_rfBandwidth: " << settings.m_rfBandwidth
<< " m_modFactor: " << settings.m_modFactor
<< " m_toneFrequency: " << settings.m_toneFrequency
<< " m_volumeFactor: " << settings.m_volumeFactor
<< " m_audioMute: " << settings.m_channelMute
<< " m_playLoop: " << settings.m_playLoop;
if((settings.m_rfBandwidth != m_settings.m_rfBandwidth) ||
(settings.m_audioSampleRate != m_settings.m_audioSampleRate) || force) (settings.m_audioSampleRate != m_settings.m_audioSampleRate) || force)
{ {
m_settingsMutex.lock(); m_settingsMutex.lock();
m_interpolatorDistanceRemain = 0; m_interpolatorDistanceRemain = 0;
m_interpolatorConsumed = false; m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) settings.m_audioSampleRate / (Real) settings.m_outputSampleRate; m_interpolatorDistance = (Real) settings.m_audioSampleRate / (Real) m_outputSampleRate;
m_interpolator.create(48, settings.m_audioSampleRate, settings.m_rfBandwidth / 2.2, 3.0); m_interpolator.create(48, settings.m_audioSampleRate, settings.m_rfBandwidth / 2.2, 3.0);
m_settingsMutex.unlock(); m_settingsMutex.unlock();
} }

View File

@ -272,8 +272,10 @@ private:
ThreadedBasebandSampleSource* m_threadedChannelizer; ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer; UpChannelizer* m_channelizer;
int m_basebandSampleRate;
int m_outputSampleRate;
int m_inputFrequencyOffset;
AMModSettings m_settings; AMModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco; NCO m_carrierNco;
NCOF m_toneNco; NCOF m_toneNco;
@ -308,6 +310,7 @@ private:
static const int m_levelNbSamples; static const int m_levelNbSamples;
void applyChannelSettings(int basebandSampleRate, int outputSampleRate, int inputFrequencyOffset);
void applySettings(const AMModSettings& settings, bool force = false); void applySettings(const AMModSettings& settings, bool force = false);
void pullAF(Real& sample); void pullAF(Real& sample);
void calculateLevel(Real& sample); void calculateLevel(Real& sample);

View File

@ -30,8 +30,6 @@ AMModSettings::AMModSettings() :
void AMModSettings::resetToDefaults() void AMModSettings::resetToDefaults()
{ {
m_basebandSampleRate = 48000;
m_outputSampleRate = 48000;
m_inputFrequencyOffset = 0; m_inputFrequencyOffset = 0;
m_rfBandwidth = 12500.0; m_rfBandwidth = 12500.0;
m_modFactor = 0.2f; m_modFactor = 0.2f;

View File

@ -23,8 +23,6 @@ class Serializable;
struct AMModSettings struct AMModSettings
{ {
int m_basebandSampleRate;
int m_outputSampleRate;
qint64 m_inputFrequencyOffset; qint64 m_inputFrequencyOffset;
Real m_rfBandwidth; Real m_rfBandwidth;
float m_modFactor; float m_modFactor;

View File

@ -52,7 +52,8 @@ const int ATVMod::m_ssbFftLen = 1024;
ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) : ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
ChannelSourceAPI(m_channelIdURI), ChannelSourceAPI(m_channelIdURI),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0), m_outputSampleRate(1000000),
m_inputFrequencyOffset(0),
m_modPhasor(0.0f), m_modPhasor(0.0f),
m_tvSampleRate(1000000), m_tvSampleRate(1000000),
m_evenImage(true), m_evenImage(true),
@ -78,11 +79,11 @@ ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
setObjectName(m_channelId); setObjectName(m_channelId);
scanCameras(); scanCameras();
m_SSBFilter = new fftfilt(0, m_settings.m_rfBandwidth / m_settings.m_outputSampleRate, m_ssbFftLen); m_SSBFilter = new fftfilt(0, m_settings.m_rfBandwidth / m_outputSampleRate, m_ssbFftLen);
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1)); memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
m_DSBFilter = new fftfilt((2.0f * m_settings.m_rfBandwidth) / m_settings.m_outputSampleRate, 2 * m_ssbFftLen); m_DSBFilter = new fftfilt((2.0f * m_settings.m_rfBandwidth) / m_outputSampleRate, 2 * m_ssbFftLen);
m_DSBFilterBuffer = new Complex[m_ssbFftLen]; m_DSBFilterBuffer = new Complex[m_ssbFftLen];
memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen)); memset(m_DSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen));
@ -126,7 +127,7 @@ void ATVMod::pull(Sample& sample)
m_settingsMutex.lock(); m_settingsMutex.lock();
if ((m_tvSampleRate == m_settings.m_outputSampleRate) && (!m_settings.m_forceDecimator)) // no interpolation nor decimation if ((m_tvSampleRate == m_outputSampleRate) && (!m_settings.m_forceDecimator)) // no interpolation nor decimation
{ {
modulateSample(); modulateSample();
pullFinalize(m_modSample, sample); pullFinalize(m_modSample, sample);
@ -486,7 +487,7 @@ void ATVMod::calculateLevel(Real& sample)
void ATVMod::start() void ATVMod::start()
{ {
qDebug() << "ATVMod::start: m_outputSampleRate: " << m_settings.m_outputSampleRate qDebug() << "ATVMod::start: m_outputSampleRate: " << m_outputSampleRate
<< " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset; << " m_inputFrequencyOffset: " << m_settings.m_inputFrequencyOffset;
} }
@ -499,63 +500,32 @@ bool ATVMod::handleMessage(const Message& cmd)
if (UpChannelizer::MsgChannelizerNotification::match(cmd)) if (UpChannelizer::MsgChannelizerNotification::match(cmd))
{ {
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd; UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
ATVModSettings settings = m_settings;
settings.m_outputSampleRate = notif.getSampleRate();
settings.m_inputFrequencyOffset = notif.getFrequencyOffset();
applySettings(settings);
qDebug() << "ATVMod::handleMessage: MsgChannelizerNotification:" qDebug() << "ATVMod::handleMessage: MsgChannelizerNotification:"
<< " m_outputSampleRate: " << settings.m_outputSampleRate << " outputSampleRate: " << notif.getSampleRate()
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset; << " inputFrequencyOffset: " << notif.getFrequencyOffset();
applyChannelSettings(notif.getSampleRate(), notif.getFrequencyOffset());
return true; return true;
} }
else if (MsgConfigureChannelizer::match(cmd)) else if (MsgConfigureChannelizer::match(cmd))
{ {
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd; MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
qDebug() << "SSBMod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getOutputSampleRate()
<< " centerFrequency: " << cfg.getCenterFrequency();
m_channelizer->configure(m_channelizer->getInputMessageQueue(), m_channelizer->configure(m_channelizer->getInputMessageQueue(),
m_channelizer->getOutputSampleRate(), m_channelizer->getOutputSampleRate(),
cfg.getCenterFrequency()); cfg.getCenterFrequency());
qDebug() << "SSBMod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getOutputSampleRate()
<< " centerFrequency: " << cfg.getCenterFrequency();
return true; return true;
} }
else if (MsgConfigureATVMod::match(cmd)) else if (MsgConfigureATVMod::match(cmd))
{ {
MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd; MsgConfigureATVMod& cfg = (MsgConfigureATVMod&) cmd;
qDebug() << "ATVMod::handleMessage: MsgConfigureATVMod";
ATVModSettings settings = cfg.getSettings(); applySettings(cfg.getSettings(), cfg.getForce());
// These settings are set with UpChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
applySettings(settings, cfg.getForce());
qDebug() << "ATVMod::handleMessage: MsgConfigureATVMod:"
<< " m_rfBandwidth: " << settings.m_rfBandwidth
<< " m_rfOppBandwidth: " << settings.m_rfOppBandwidth
<< " m_atvStd: " << (int) settings.m_atvStd
<< " m_nbLines: " << settings.m_nbLines
<< " m_fps: " << settings.m_fps
<< " m_atvModInput: " << (int) settings.m_atvModInput
<< " m_uniformLevel: " << settings.m_uniformLevel
<< " m_atvModulation: " << (int) settings.m_atvModulation
<< " m_videoPlayLoop: " << settings.m_videoPlayLoop
<< " m_videoPlay: " << settings.m_videoPlay
<< " m_cameraPlay: " << settings.m_cameraPlay
<< " m_channelMute: " << settings.m_channelMute
<< " m_invertedVideo: " << settings.m_invertedVideo
<< " m_rfScalingFactor: " << settings.m_rfScalingFactor
<< " m_fmExcursion: " << settings.m_fmExcursion
<< " m_forceDecimator: " << settings.m_forceDecimator
<< " force: " << cfg.getForce();
return true; return true;
} }
@ -1054,31 +1024,99 @@ 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); cv::putText(image, m_overlayText, textOrg, fontFace, fontScale, cv::Scalar::all(255*m_settings.m_uniformLevel), thickness, CV_AA);
} }
void ATVMod::applySettings(const ATVModSettings& settings, bool force) void ATVMod::applyChannelSettings(int outputSampleRate, int inputFrequencyOffset)
{ {
if ((settings.m_outputSampleRate != m_settings.m_outputSampleRate) qDebug() << "AMMod::applyChannelSettings:"
|| (settings.m_atvStd != m_settings.m_atvStd) << " outputSampleRate: " << outputSampleRate
|| (settings.m_nbLines != m_settings.m_nbLines) << " inputFrequencyOffset: " << inputFrequencyOffset;
|| (settings.m_fps != m_settings.m_fps)
|| (settings.m_rfBandwidth != m_settings.m_rfBandwidth) if ((inputFrequencyOffset != m_inputFrequencyOffset) ||
|| (settings.m_atvModulation != m_settings.m_atvModulation) || force) (outputSampleRate != m_outputSampleRate))
{ {
getBaseValues(settings.m_outputSampleRate, settings.m_nbLines * settings.m_fps, m_tvSampleRate, m_pointsPerLine); m_settingsMutex.lock();
m_carrierNco.setFreq(inputFrequencyOffset, outputSampleRate);
m_settingsMutex.unlock();
}
if (outputSampleRate != m_outputSampleRate)
{
getBaseValues(outputSampleRate, m_settings.m_nbLines * m_settings.m_fps, m_tvSampleRate, m_pointsPerLine);
m_settingsMutex.lock(); m_settingsMutex.lock();
if (m_tvSampleRate > 0) if (m_tvSampleRate > 0)
{ {
m_interpolatorDistanceRemain = 0; m_interpolatorDistanceRemain = 0;
m_interpolatorDistance = (Real) m_tvSampleRate / (Real) settings.m_outputSampleRate; m_interpolatorDistance = (Real) m_tvSampleRate / (Real) outputSampleRate;
m_interpolator.create(32, m_interpolator.create(32,
m_tvSampleRate, m_tvSampleRate,
settings.m_rfBandwidth / getRFBandwidthDivisor(settings.m_atvModulation), m_settings.m_rfBandwidth / getRFBandwidthDivisor(m_settings.m_atvModulation),
3.0); 3.0);
} }
else else
{ {
m_tvSampleRate = settings.m_outputSampleRate; m_tvSampleRate = outputSampleRate;
}
m_SSBFilter->create_filter(0, m_settings.m_rfBandwidth / m_tvSampleRate);
memset(m_SSBFilterBuffer, 0, sizeof(Complex)*(m_ssbFftLen>>1));
m_SSBFilterBufferIndex = 0;
applyStandard(); // set all timings
m_settingsMutex.unlock();
if (getMessageQueueToGUI())
{
MsgReportEffectiveSampleRate *report;
report = MsgReportEffectiveSampleRate::create(m_tvSampleRate, m_pointsPerLine);
getMessageQueueToGUI()->push(report);
}
}
m_outputSampleRate = outputSampleRate;
m_inputFrequencyOffset = inputFrequencyOffset;
}
void ATVMod::applySettings(const ATVModSettings& settings, bool force)
{
qDebug() << "ATVMod::applySettings:"
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
<< " m_rfBandwidth: " << settings.m_rfBandwidth
<< " m_rfOppBandwidth: " << settings.m_rfOppBandwidth
<< " m_atvStd: " << (int) settings.m_atvStd
<< " m_nbLines: " << settings.m_nbLines
<< " m_fps: " << settings.m_fps
<< " m_atvModInput: " << (int) settings.m_atvModInput
<< " m_uniformLevel: " << settings.m_uniformLevel
<< " m_atvModulation: " << (int) settings.m_atvModulation
<< " m_videoPlayLoop: " << settings.m_videoPlayLoop
<< " m_videoPlay: " << settings.m_videoPlay
<< " m_cameraPlay: " << settings.m_cameraPlay
<< " m_channelMute: " << settings.m_channelMute
<< " m_invertedVideo: " << settings.m_invertedVideo
<< " m_rfScalingFactor: " << settings.m_rfScalingFactor
<< " m_fmExcursion: " << settings.m_fmExcursion
<< " m_forceDecimator: " << settings.m_forceDecimator
<< " force: " << force;
if ((settings.m_atvStd != m_settings.m_atvStd)
|| (settings.m_nbLines != m_settings.m_nbLines)
|| (settings.m_fps != m_settings.m_fps)
|| (settings.m_rfBandwidth != m_settings.m_rfBandwidth)
|| (settings.m_atvModulation != m_settings.m_atvModulation) || force)
{
getBaseValues(m_outputSampleRate, settings.m_nbLines * settings.m_fps, m_tvSampleRate, m_pointsPerLine);
m_settingsMutex.lock();
if (m_tvSampleRate > 0)
{
m_interpolatorDistanceRemain = 0;
m_interpolatorDistance = (Real) m_tvSampleRate / (Real) m_outputSampleRate;
m_interpolator.create(32,
m_tvSampleRate,
settings.m_rfBandwidth / getRFBandwidthDivisor(settings.m_atvModulation),
3.0);
} }
m_SSBFilter->create_filter(0, settings.m_rfBandwidth / m_tvSampleRate); m_SSBFilter->create_filter(0, settings.m_rfBandwidth / m_tvSampleRate);
@ -1096,8 +1134,7 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
} }
} }
if ((settings.m_outputSampleRate != m_settings.m_outputSampleRate) if ((settings.m_rfOppBandwidth != m_settings.m_rfOppBandwidth)
|| (settings.m_rfOppBandwidth != m_settings.m_rfOppBandwidth)
|| (settings.m_rfBandwidth != m_settings.m_rfBandwidth) || (settings.m_rfBandwidth != m_settings.m_rfBandwidth)
|| (settings.m_nbLines != m_settings.m_nbLines) // difference in line period may have changed TV sample rate || (settings.m_nbLines != m_settings.m_nbLines) // difference in line period may have changed TV sample rate
|| (settings.m_fps != m_settings.m_fps) // || (settings.m_fps != m_settings.m_fps) //
@ -1112,14 +1149,6 @@ void ATVMod::applySettings(const ATVModSettings& settings, bool force)
m_settingsMutex.unlock(); m_settingsMutex.unlock();
} }
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) ||
(settings.m_outputSampleRate != m_settings.m_outputSampleRate) || force)
{
m_settingsMutex.lock();
m_carrierNco.setFreq(settings.m_inputFrequencyOffset, settings.m_outputSampleRate);
m_settingsMutex.unlock();
}
m_settings = settings; m_settings = settings;
} }

View File

@ -469,8 +469,9 @@ private:
ThreadedBasebandSampleSource* m_threadedChannelizer; ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer; UpChannelizer* m_channelizer;
int m_outputSampleRate;
int m_inputFrequencyOffset;
ATVModSettings m_settings; ATVModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco; NCO m_carrierNco;
Complex m_modSample; Complex m_modSample;
@ -560,6 +561,7 @@ private:
static const int m_nbBars; //!< number of bars in bar or chessboard patterns 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 static const int m_cameraFPSTestNbFrames; //!< number of frames for camera FPS test
void applyChannelSettings(int outputSampleRate, int inputFrequencyOffset);
void applySettings(const ATVModSettings& settings, bool force = false); void applySettings(const ATVModSettings& settings, bool force = false);
void pullFinalize(Complex& ci, Sample& sample); void pullFinalize(Complex& ci, Sample& sample);
void pullVideo(Real& sample); void pullVideo(Real& sample);

View File

@ -29,7 +29,6 @@ ATVModSettings::ATVModSettings() :
void ATVModSettings::resetToDefaults() void ATVModSettings::resetToDefaults()
{ {
m_outputSampleRate = 1000000;
m_inputFrequencyOffset = 0; m_inputFrequencyOffset = 0;
m_rfBandwidth = 1000000; m_rfBandwidth = 1000000;
m_rfOppBandwidth = 0; m_rfOppBandwidth = 0;

View File

@ -58,7 +58,6 @@ struct ATVModSettings
ATVModulationVestigialLSB ATVModulationVestigialLSB
} ATVModulation; } ATVModulation;
int m_outputSampleRate; //!< sample rate from channelizer
qint64 m_inputFrequencyOffset; //!< offset from baseband center frequency qint64 m_inputFrequencyOffset; //!< offset from baseband center frequency
Real m_rfBandwidth; //!< Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB Real m_rfBandwidth; //!< Bandwidth of modulated signal or direct sideband for SSB / vestigial SSB
Real m_rfOppBandwidth; //!< Bandwidth of opposite sideband for vestigial SSB Real m_rfOppBandwidth; //!< Bandwidth of opposite sideband for vestigial SSB