diff --git a/plugins/channeltx/filesource/filesource.cpp b/plugins/channeltx/filesource/filesource.cpp
index 00c3164a0..5e9a3e453 100644
--- a/plugins/channeltx/filesource/filesource.cpp
+++ b/plugins/channeltx/filesource/filesource.cpp
@@ -464,7 +464,7 @@ void FileSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& respon
quint64 samplesCount = m_basebandSource->getSamplesCount();
uint32_t fileSampleRate = m_basebandSource->getFileSampleRate();
quint64 startingTimeStamp = m_basebandSource->getStartingTimeStamp();
- quint64 fileRecordLength = m_basebandSource->getRecordLength();
+ quint64 fileRecordLength = m_basebandSource->getRecordLengthMuSec() / 1000000UL;
quint32 fileSampleSize = m_basebandSource->getFileSampleSize();
if (fileSampleRate > 0)
diff --git a/plugins/channeltx/filesource/filesourcebaseband.h b/plugins/channeltx/filesource/filesourcebaseband.h
index 730fb8227..7ab3c8073 100644
--- a/plugins/channeltx/filesource/filesourcebaseband.h
+++ b/plugins/channeltx/filesource/filesourcebaseband.h
@@ -128,7 +128,7 @@ public:
uint32_t getFileSampleRate() const { return m_source.getFileSampleRate(); }
quint64 getStartingTimeStamp() const { return m_source.getStartingTimeStamp(); }
- quint64 getRecordLength() const { return m_source.getRecordLength(); }
+ quint64 getRecordLengthMuSec() const { return m_source.getRecordLengthMuSec(); }
quint32 getFileSampleSize() const { return m_source.getFileSampleSize(); }
void getMagSqLevels(double& avg, double& peak, int& nbSamples) const
diff --git a/plugins/channeltx/filesource/filesourcegui.cpp b/plugins/channeltx/filesource/filesourcegui.cpp
index 2e1957ae2..e18944b67 100644
--- a/plugins/channeltx/filesource/filesourcegui.cpp
+++ b/plugins/channeltx/filesource/filesourcegui.cpp
@@ -117,7 +117,7 @@ bool FileSourceGUI::handleMessage(const Message& message)
m_fileSampleRate = ((FileSourceReport::MsgReportFileSourceStreamData&)message).getSampleRate();
m_fileSampleSize = ((FileSourceReport::MsgReportFileSourceStreamData&)message).getSampleSize();
m_startingTimeStamp = ((FileSourceReport::MsgReportFileSourceStreamData&)message).getStartingTimeStamp();
- m_recordLength = ((FileSourceReport::MsgReportFileSourceStreamData&)message).getRecordLength();
+ m_recordLengthMuSec = ((FileSourceReport::MsgReportFileSourceStreamData&)message).getRecordLengthMuSec();
updateWithStreamData();
return true;
}
@@ -188,7 +188,7 @@ FileSourceGUI::FileSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
m_shiftFrequencyFactor(0.0),
m_fileSampleRate(0),
m_fileSampleSize(0),
- m_recordLength(0),
+ m_recordLengthMuSec(0),
m_startingTimeStamp(0),
m_samplesCount(0),
m_acquisition(false),
@@ -277,8 +277,8 @@ void FileSourceGUI::updateWithStreamData()
ui->sampleRateText->setText(tr("%1k").arg((float) m_fileSampleRate / 1000));
ui->sampleSizeText->setText(tr("%1b").arg(m_fileSampleSize));
QTime recordLength(0, 0, 0, 0);
- recordLength = recordLength.addSecs(m_recordLength);
- QString s_time = recordLength.toString("HH:mm:ss");
+ recordLength = recordLength.addMSecs(m_recordLengthMuSec/1000UL);
+ QString s_time = recordLength.toString("HH:mm:ss.zzz");
ui->recordLengthText->setText(s_time);
updateWithStreamTime();
}
@@ -309,7 +309,7 @@ void FileSourceGUI::updateWithStreamTime()
if (!m_enableNavTime)
{
- float posRatio = (float) t_sec / (float) m_recordLength;
+ float posRatio = (float) (t_sec*1000000L + t_msec*1000L) / (float) m_recordLengthMuSec;
ui->navTime->setValue((int) (posRatio * 1000.0));
}
}
diff --git a/plugins/channeltx/filesource/filesourcegui.h b/plugins/channeltx/filesource/filesourcegui.h
index ffd2820e0..909760ded 100644
--- a/plugins/channeltx/filesource/filesourcegui.h
+++ b/plugins/channeltx/filesource/filesourcegui.h
@@ -66,7 +66,7 @@ private:
QString m_fileName;
int m_fileSampleRate;
quint32 m_fileSampleSize;
- quint64 m_recordLength;
+ quint64 m_recordLengthMuSec;
quint64 m_startingTimeStamp;
quint64 m_samplesCount;
bool m_acquisition;
diff --git a/plugins/channeltx/filesource/filesourcegui.ui b/plugins/channeltx/filesource/filesourcegui.ui
index e2da8dcd1..eaaeee84a 100644
--- a/plugins/channeltx/filesource/filesourcegui.ui
+++ b/plugins/channeltx/filesource/filesourcegui.ui
@@ -641,7 +641,7 @@
- 60
+ 90
0
@@ -649,7 +649,7 @@
Total record time
- 00:00:00
+ 00:00:00.000
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
diff --git a/plugins/channeltx/filesource/filesourcereport.h b/plugins/channeltx/filesource/filesourcereport.h
index c63f2dcf3..c92a511ca 100644
--- a/plugins/channeltx/filesource/filesourcereport.h
+++ b/plugins/channeltx/filesource/filesourcereport.h
@@ -52,15 +52,15 @@ public:
quint32 getSampleSize() const { return m_sampleSize; }
quint64 getCenterFrequency() const { return m_centerFrequency; }
quint64 getStartingTimeStamp() const { return m_startingTimeStamp; }
- quint64 getRecordLength() const { return m_recordLength; }
+ quint64 getRecordLengthMuSec() const { return m_recordLengthMuSec; }
static MsgReportFileSourceStreamData* create(int sampleRate,
quint32 sampleSize,
quint64 centerFrequency,
quint64 startingTimeStamp,
- quint64 recordLength)
+ quint64 recordLengthMuSec)
{
- return new MsgReportFileSourceStreamData(sampleRate, sampleSize, centerFrequency, startingTimeStamp, recordLength);
+ return new MsgReportFileSourceStreamData(sampleRate, sampleSize, centerFrequency, startingTimeStamp, recordLengthMuSec);
}
protected:
@@ -68,19 +68,19 @@ public:
quint32 m_sampleSize;
quint64 m_centerFrequency;
quint64 m_startingTimeStamp;
- quint64 m_recordLength;
+ quint64 m_recordLengthMuSec;
MsgReportFileSourceStreamData(int sampleRate,
quint32 sampleSize,
quint64 centerFrequency,
quint64 startingTimeStamp,
- quint64 recordLength) :
+ quint64 recordLengthMuSec) :
Message(),
m_sampleRate(sampleRate),
m_sampleSize(sampleSize),
m_centerFrequency(centerFrequency),
m_startingTimeStamp(startingTimeStamp),
- m_recordLength(recordLength)
+ m_recordLengthMuSec(recordLengthMuSec)
{ }
};
diff --git a/plugins/channeltx/filesource/filesourcesource.cpp b/plugins/channeltx/filesource/filesourcesource.cpp
index 202272c74..df95dab5b 100644
--- a/plugins/channeltx/filesource/filesourcesource.cpp
+++ b/plugins/channeltx/filesource/filesourcesource.cpp
@@ -43,7 +43,7 @@ FileSourceSource::FileSourceSource() :
m_samplesCount(0),
m_sampleRate(0),
m_deviceSampleRate(0),
- m_recordLength(0),
+ m_recordLengthMuSec(0),
m_startingTimeStamp(0),
m_running(false),
m_guiMessageQueue(nullptr)
@@ -187,12 +187,12 @@ void FileSourceSource::openFileStream(const QString& fileName)
if (crcOK)
{
qDebug("FileSourceSource::openFileStream: CRC32 OK for header: %s", qPrintable(crcHex));
- m_recordLength = (fileSize - sizeof(FileRecord::Header)) / ((m_sampleSize == 24 ? 8 : 4) * m_fileSampleRate);
+ m_recordLengthMuSec = ((fileSize - sizeof(FileRecord::Header)) * 1000000UL) / ((m_sampleSize == 24 ? 8 : 4) * m_fileSampleRate);
}
else
{
qCritical("FileSourceSource::openFileStream: bad CRC32 for header: %s", qPrintable(crcHex));
- m_recordLength = 0;
+ m_recordLengthMuSec = 0;
}
if (getMessageQueueToGUI())
@@ -203,12 +203,12 @@ void FileSourceSource::openFileStream(const QString& fileName)
}
else
{
- m_recordLength = 0;
+ m_recordLengthMuSec = 0;
}
qDebug() << "FileSourceSource::openFileStream: " << m_fileName.toStdString().c_str()
<< " fileSize: " << fileSize << " bytes"
- << " length: " << m_recordLength << " seconds"
+ << " length: " << m_recordLengthMuSec << " microseconds"
<< " sample rate: " << m_fileSampleRate << " S/s"
<< " center frequency: " << m_centerFrequency << " Hz"
<< " sample size: " << m_sampleSize << " bits"
@@ -220,11 +220,11 @@ void FileSourceSource::openFileStream(const QString& fileName)
m_sampleSize,
m_centerFrequency,
m_startingTimeStamp,
- m_recordLength); // file stream data
+ m_recordLengthMuSec); // file stream data
getMessageQueueToGUI()->push(report);
}
- if (m_recordLength == 0) {
+ if (m_recordLengthMuSec == 0) {
m_ifstream.close();
}
}
@@ -233,7 +233,8 @@ void FileSourceSource::seekFileStream(int seekMillis)
{
if ((m_ifstream.is_open()) && !m_running)
{
- quint64 seekPoint = ((m_recordLength * seekMillis) / 1000) * m_fileSampleRate;
+ quint64 seekPoint = ((m_recordLengthMuSec * seekMillis) / 1000) * m_fileSampleRate;
+ seekPoint /= 1000000UL;
m_samplesCount = seekPoint;
seekPoint *= (m_sampleSize == 24 ? 8 : 4); // + sizeof(FileRecord::Header)
m_ifstream.clear();
diff --git a/plugins/channeltx/filesource/filesourcesource.h b/plugins/channeltx/filesource/filesourcesource.h
index 4ad7720ea..0ada2c395 100644
--- a/plugins/channeltx/filesource/filesourcesource.h
+++ b/plugins/channeltx/filesource/filesourcesource.h
@@ -78,7 +78,7 @@ public:
uint32_t getFileSampleRate() const { return m_fileSampleRate; }
quint64 getStartingTimeStamp() const { return m_startingTimeStamp; }
- quint64 getRecordLength() const { return m_recordLength; }
+ quint64 getRecordLengthMuSec() const { return m_recordLengthMuSec; }
quint32 getFileSampleSize() const { return m_sampleSize; }
private:
@@ -105,7 +105,7 @@ private:
quint64 m_samplesCount;
uint32_t m_sampleRate;
uint32_t m_deviceSampleRate;
- quint64 m_recordLength; //!< record length in seconds computed from file size
+ quint64 m_recordLengthMuSec; //!< record length in microseconds computed from file size
quint64 m_startingTimeStamp;
QTimer m_masterTimer;
bool m_running;