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

ATV Demodulator: pass sync top time as float from GUI

This commit is contained in:
f4exb 2017-03-16 23:29:22 +01:00
parent df32ccef2f
commit 5df5ee5a5d
3 changed files with 29 additions and 30 deletions

View File

@ -83,9 +83,9 @@ void ATVDemod::configure(MessageQueue* objMessageQueue, int intLineDurationUs, i
}
void ATVDemod::InitATVParameters(
int intMsps,
int intSampleRate,
float fltLineDurationUs,
int intTopDurationUs,
float fltTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
float fltVoltLevelSynchroTop,
@ -94,7 +94,6 @@ void ATVDemod::InitATVParameters(
bool blnHSync,
bool blnVSync)
{
float fltLineSynchroTop = (float) intTopDurationUs;
float fltImagesPerSeconds = (float) intFramePerS;
int intNumberSamplePerLine;
int intNumberOfLines;
@ -105,7 +104,7 @@ void ATVDemod::InitATVParameters(
m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop;
m_fltVoltLevelSynchroBlack = fltVoltLevelSynchroBlack;
intNumberSamplePerLine = (int) ((fltLineDurationUs * intMsps) / m_fltSecondToUs);
intNumberSamplePerLine = (int) ((fltLineDurationUs * intSampleRate) / m_fltSecondToUs);
intNumberOfLines = (int) ((m_fltSecondToUs/fltImagesPerSeconds) /round(fltLineDurationUs));
if((intNumberSamplePerLine != m_intNumberSamplePerLine)
@ -115,9 +114,9 @@ void ATVDemod::InitATVParameters(
}
m_intNumberSamplePerLine= intNumberSamplePerLine;
m_intNumberSamplePerTop=(int)((fltLineSynchroTop * intMsps) / m_fltSecondToUs);
m_intNumberSamplePerTop=(int)((fltTopDurationUs * intSampleRate) / m_fltSecondToUs);
m_intNumberOfLines = intNumberOfLines;
m_intNumberOfRowsToDisplay = (int)((((float)intPercentOfRowsToDisplay) * fltLineDurationUs * intMsps) / (m_fltSecondToUs*100.0f));
m_intNumberOfRowsToDisplay = (int)((((float)intPercentOfRowsToDisplay) * fltLineDurationUs * intSampleRate) / (m_fltSecondToUs*100.0f));
m_intRowsLimit = m_intNumberOfLines-1;
m_intImageIndex = 0;
@ -138,8 +137,8 @@ void ATVDemod::InitATVParameters(
m_objRunning.m_fltVoltLevelSynchroTop = m_fltVoltLevelSynchroTop;
m_objRunning.m_intFramePerS = intFramePerS;
m_objRunning.m_fltLineDurationUs = fltLineDurationUs;
m_objRunning.m_intTopDurationUs = intTopDurationUs;
m_objRunning.m_intMsps = intMsps;
m_objRunning.m_fltTopDurationUs = fltTopDurationUs;
m_objRunning.m_intSampleRate = intSampleRate;
m_objRunning.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay;
m_objRunning.m_blnHSync = blnHSync;
m_objRunning.m_blnVSync = blnVSync;
@ -147,9 +146,9 @@ void ATVDemod::InitATVParameters(
m_objSettingsMutex.unlock();
qDebug() << "ATVDemod::InitATVParameters:"
<< " - Msps: " << intMsps
<< " - Sample rate S/s: " << intSampleRate
<< " - Line us: " << fltLineDurationUs
<< " - Top us: " << intTopDurationUs
<< " - Top us: " << fltTopDurationUs
<< " - Frame/s: " << intFramePerS
<< " <=> "
<< " - Samples per Line: " << m_intNumberSamplePerLine
@ -530,14 +529,14 @@ bool ATVDemod::handleMessage(const Message& cmd)
{
DownChannelizer::MsgChannelizerNotification& objNotif = (DownChannelizer::MsgChannelizerNotification&) cmd;
if(m_objRunning.m_intMsps!=objNotif.getSampleRate())
if(m_objRunning.m_intSampleRate!=objNotif.getSampleRate())
{
m_objRunning.m_intMsps = objNotif.getSampleRate();
m_objRunning.m_intSampleRate = objNotif.getSampleRate();
ApplySettings();
}
qDebug() << "ATVDemod::handleMessage: MsgChannelizerNotification:"
<< " m_intMsps: " << m_objRunning.m_intMsps;
<< " m_intMsps: " << m_objRunning.m_intSampleRate;
return true;
}
@ -551,7 +550,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
m_objConfig.m_intFramePerS = objCfg.m_objMsgConfig.m_intFramePerS;
m_objConfig.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs;
m_objConfig.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay;
m_objConfig.m_intTopDurationUs = objCfg.m_objMsgConfig.m_intTopDurationUs;
m_objConfig.m_fltTopDurationUs = objCfg.m_objMsgConfig.m_fltTopDurationUs;
m_objConfig.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync;
m_objConfig.m_blnVSync = objCfg.m_objMsgConfig.m_blnVSync;
@ -561,7 +560,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
|| (objCfg.m_objMsgConfig.m_intFramePerS != m_objRunning.m_intFramePerS)
|| (objCfg.m_objMsgConfig.m_fltLineDurationUs != m_objRunning.m_fltLineDurationUs)
|| (objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay != m_objRunning.m_intPercentOfRowsToDisplay)
|| (objCfg.m_objMsgConfig.m_intTopDurationUs != m_objRunning.m_intTopDurationUs)
|| (objCfg.m_objMsgConfig.m_fltTopDurationUs != m_objRunning.m_fltTopDurationUs)
|| (objCfg.m_objMsgConfig.m_blnHSync != m_objRunning.m_blnHSync)
|| (objCfg.m_objMsgConfig.m_blnVSync != m_objRunning.m_blnVSync))
{
@ -571,7 +570,7 @@ bool ATVDemod::handleMessage(const Message& cmd)
m_objRunning.m_intFramePerS = objCfg.m_objMsgConfig.m_intFramePerS;
m_objRunning.m_fltLineDurationUs = objCfg.m_objMsgConfig.m_fltLineDurationUs;
m_objRunning.m_intPercentOfRowsToDisplay = objCfg.m_objMsgConfig.m_intPercentOfRowsToDisplay;
m_objRunning.m_intTopDurationUs = objCfg.m_objMsgConfig.m_intTopDurationUs;
m_objRunning.m_fltTopDurationUs = objCfg.m_objMsgConfig.m_fltTopDurationUs;
m_objRunning.m_blnHSync = objCfg.m_objMsgConfig.m_blnHSync;
m_objRunning.m_blnVSync = objCfg.m_objMsgConfig.m_blnVSync;
@ -589,16 +588,16 @@ bool ATVDemod::handleMessage(const Message& cmd)
void ATVDemod::ApplySettings()
{
if(m_objRunning.m_intMsps==0)
if(m_objRunning.m_intSampleRate==0)
{
return;
}
InitATVParameters(
m_objRunning.m_intMsps,
m_objRunning.m_intSampleRate,
m_objRunning.m_fltLineDurationUs,
m_objRunning.m_intTopDurationUs,
m_objRunning.m_fltTopDurationUs,
m_objRunning.m_intFramePerS,
m_objRunning.m_intPercentOfRowsToDisplay,
m_objRunning.m_fltVoltLevelSynchroTop,
@ -610,6 +609,6 @@ void ATVDemod::ApplySettings()
int ATVDemod::GetSampleRate()
{
return m_objRunning.m_intMsps;
return m_objRunning.m_intSampleRate;
}

View File

@ -48,9 +48,9 @@ public:
struct ATVConfig
{
int m_intMsps;
int m_intSampleRate;
float m_fltLineDurationUs;
int m_intTopDurationUs;
float m_fltTopDurationUs;
int m_intFramePerS;
int m_intPercentOfRowsToDisplay;
float m_fltVoltLevelSynchroTop;
@ -60,9 +60,9 @@ public:
bool m_blnVSync;
ATVConfig() :
m_intMsps(0),
m_intSampleRate(0),
m_fltLineDurationUs(0.0f),
m_intTopDurationUs(0),
m_fltTopDurationUs(0.0f),
m_intFramePerS(0),
m_intPercentOfRowsToDisplay(0),
m_fltVoltLevelSynchroTop(0),
@ -96,7 +96,7 @@ public:
bool SetATVScreen(ATVScreen *objScreen);
void InitATVParameters(int intMsps,
float fltLineDurationUs,
int intTopDurationUs,
float fltTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
float fltVoltLevelSynchroTop,
@ -115,7 +115,7 @@ private:
public:
static MsgConfigureATVDemod* create(float fltLineDurationUs,
int intTopDurationUs,
float fltTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
float fltVoltLevelSynchroTop,
@ -125,7 +125,7 @@ private:
bool blnVSync)
{
return new MsgConfigureATVDemod(fltLineDurationUs,
intTopDurationUs,
fltTopDurationUs,
intFramePerS,
intPercentOfRowsToDisplay,
fltVoltLevelSynchroTop,
@ -139,7 +139,7 @@ private:
private:
MsgConfigureATVDemod(float fltLineDurationUs,
int intTopDurationUs,
float fltTopDurationUs,
int intFramePerS,
int intPercentOfRowsToDisplay,
float fltVoltLevelSynchroTop,
@ -154,7 +154,7 @@ private:
m_objMsgConfig.m_fltVoltLevelSynchroTop = fltVoltLevelSynchroTop;
m_objMsgConfig.m_intFramePerS = intFramePerS;
m_objMsgConfig.m_fltLineDurationUs = fltLineDurationUs;
m_objMsgConfig.m_intTopDurationUs = intTopDurationUs;
m_objMsgConfig.m_fltTopDurationUs = fltTopDurationUs;
m_objMsgConfig.m_intPercentOfRowsToDisplay = intPercentOfRowsToDisplay;
m_objMsgConfig.m_blnHSync = blnHSync;
m_objMsgConfig.m_blnVSync = blnVSync;

View File

@ -278,7 +278,7 @@ void ATVDemodGUI::applySettings()
m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(),
ui->lineTime->value() / 10.0f,
ui->topTime->value(),
ui->topTime->value() * 1.0f,
(ui->fps->currentIndex() == 0) ? 25 : 30,
(ui->halfImage->checkState() == Qt::Checked) ? 50 : 100,
((float) (ui->synchLevel->value())) / 1000.0f,