File Input and record: 16/24 bit DSP compatibility: bug fixes

pull/136/head
f4exb 2018-01-25 23:52:36 +01:00
rodzic 12a97b9644
commit cc1033b3c5
6 zmienionych plików z 55 dodań i 5 usunięć

Wyświetl plik

@ -175,6 +175,7 @@ bool FileSourceGui::handleMessage(const Message& message)
else if (FileSourceInput::MsgReportFileSourceStreamData::match(message))
{
m_sampleRate = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getSampleRate();
m_sampleSize = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getSampleSize();
m_centerFrequency = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getCenterFrequency();
m_startingTimeStamp = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getStartingTimeStamp();
m_recordLength = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getRecordLength();
@ -312,6 +313,7 @@ void FileSourceGui::updateWithStreamData()
{
ui->centerFrequency->setValue(m_centerFrequency/1000);
ui->sampleRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
ui->sampleSizeText->setText(tr("%1b").arg(m_sampleSize));
ui->play->setEnabled(m_acquisition);
QTime recordLength(0, 0, 0, 0);
recordLength = recordLength.addSecs(m_recordLength);

Wyświetl plik

@ -63,6 +63,7 @@ private:
bool m_acquisition;
QString m_fileName;
int m_sampleRate;
quint32 m_sampleSize;
quint64 m_centerFrequency;
quint32 m_recordLength;
std::time_t m_startingTimeStamp;

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>246</width>
<width>300</width>
<height>190</height>
</rect>
</property>
@ -231,16 +231,56 @@
<layout class="QHBoxLayout" name="rateTimeLayout">
<item>
<widget class="QLabel" name="sampleRateText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>Record sample rate</string>
<string>Record sample rate (kS/s)</string>
</property>
<property name="text">
<string>0k</string>
<string>00000k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sampleSizeText">
<property name="minimumSize">
<size>
<width>22</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>Record sample size (bits)</string>
</property>
<property name="text">
<string>00b</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>

Wyświetl plik

@ -99,6 +99,7 @@ void FileSourceInput::openFileStream()
<< " length: " << m_recordLength << " seconds";
MsgReportFileSourceStreamData *report = MsgReportFileSourceStreamData::create(m_sampleRate,
m_sampleSize,
m_centerFrequency,
m_startingTimeStamp,
m_recordLength); // file stream data

Wyświetl plik

@ -173,30 +173,35 @@ public:
public:
int getSampleRate() const { return m_sampleRate; }
quint32 getSampleSize() const { return m_sampleSize; }
quint64 getCenterFrequency() const { return m_centerFrequency; }
std::time_t getStartingTimeStamp() const { return m_startingTimeStamp; }
quint32 getRecordLength() const { return m_recordLength; }
static MsgReportFileSourceStreamData* create(int sampleRate,
quint32 sampleSize,
quint64 centerFrequency,
std::time_t startingTimeStamp,
quint32 recordLength)
{
return new MsgReportFileSourceStreamData(sampleRate, centerFrequency, startingTimeStamp, recordLength);
return new MsgReportFileSourceStreamData(sampleRate, sampleSize, centerFrequency, startingTimeStamp, recordLength);
}
protected:
int m_sampleRate;
quint32 m_sampleSize;
quint64 m_centerFrequency;
std::time_t m_startingTimeStamp;
quint32 m_recordLength;
MsgReportFileSourceStreamData(int sampleRate,
quint32 sampleSize,
quint64 centerFrequency,
std::time_t startingTimeStamp,
quint32 recordLength) :
Message(),
m_sampleRate(sampleRate),
m_sampleSize(sampleSize),
m_centerFrequency(centerFrequency),
m_startingTimeStamp(startingTimeStamp),
m_recordLength(recordLength)

Wyświetl plik

@ -136,7 +136,8 @@ void FileRecord::readHeader(std::ifstream& sampleFile, Header& header)
sampleFile.read((char *) &(header.centerFrequency), sizeof(quint64));
sampleFile.read((char *) &(header.startTimeStamp), sizeof(std::time_t));
sampleFile.read((char *) &(header.sampleSize), sizeof(quint32));
if ((header.sampleSize != 16) || (header.sampleSize != 24)) { // assume 16 bits if garbage (old I/Q file)
if ((header.sampleSize != 16) && (header.sampleSize != 24)) { // assume 16 bits if garbage (old I/Q file)
header.sampleSize = 16;
}
qDebug("FileRecord::readHeader: sampleSize: %u", header.sampleSize);
}