mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-04-20 06:26:21 -04:00
SigMF file sink: show number of tracks in GUI
This commit is contained in:
parent
ed3a300829
commit
1187726582
@ -254,6 +254,33 @@ void SigMFFileSink::record(bool record)
|
||||
m_basebandSink->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
uint64_t SigMFFileSink::getMsCount() const
|
||||
{
|
||||
if (m_basebandSink) {
|
||||
return m_basebandSink->getMsCount();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t SigMFFileSink::getByteCount() const
|
||||
{
|
||||
if (m_basebandSink) {
|
||||
return m_basebandSink->getByteCount();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SigMFFileSink::getNbTracks() const
|
||||
{
|
||||
if (m_basebandSink) {
|
||||
return m_basebandSink->getNbTracks();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int SigMFFileSink::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage)
|
||||
|
||||
@ -109,6 +109,9 @@ public:
|
||||
void getLocalDevices(std::vector<uint32_t>& indexes);
|
||||
uint32_t getNumberOfDeviceStreams() const;
|
||||
void record(bool record);
|
||||
uint64_t getMsCount() const;
|
||||
uint64_t getByteCount() const;
|
||||
unsigned int getNbTracks() const;
|
||||
|
||||
static const QString m_channelIdURI;
|
||||
static const QString m_channelId;
|
||||
|
||||
@ -88,6 +88,9 @@ public:
|
||||
int getChannelSampleRate() const;
|
||||
void setBasebandSampleRate(int sampleRate);
|
||||
bool isRunning() const { return m_running; }
|
||||
uint64_t getMsCount() const { return m_sink.getMsCount(); }
|
||||
uint64_t getByteCount() const { return m_sink.getByteCount(); }
|
||||
unsigned int getNbTracks() const { return m_sink.getNbTracks(); }
|
||||
|
||||
private:
|
||||
SampleSinkFifo m_sampleFifo;
|
||||
|
||||
@ -17,8 +17,10 @@
|
||||
|
||||
#include <QLocale>
|
||||
#include <QFileDialog>
|
||||
#include <QTime>
|
||||
|
||||
#include "device/deviceuiset.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "gui/basicchannelsettingsdialog.h"
|
||||
#include "gui/devicestreamselectiondialog.h"
|
||||
#include "dsp/hbfilterchainconverter.h"
|
||||
@ -143,6 +145,7 @@ SigMFFileSinkGUI::SigMFFileSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISe
|
||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->deltaFrequency->setValueRange(false, 8, -99999999, 99999999);
|
||||
ui->position->setEnabled(m_fixedPosition);
|
||||
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor);
|
||||
@ -161,6 +164,7 @@ SigMFFileSinkGUI::SigMFFileSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISe
|
||||
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
|
||||
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
connect(&(m_deviceUISet->m_deviceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
@ -440,16 +444,41 @@ void SigMFFileSinkGUI::setPosFromFrequency()
|
||||
displayPos();
|
||||
}
|
||||
|
||||
void SigMFFileSinkGUI::tick()
|
||||
{
|
||||
if (++m_tickCount == 20) { // once per second
|
||||
m_tickCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileSinkGUI::applyDecimation()
|
||||
{
|
||||
ui->position->setMaximum(SigMFFileSinkSettings::getNbFixedShiftIndexes(m_settings.m_log2Decim)-1);
|
||||
ui->position->setValue(m_fixedShiftIndex);
|
||||
m_fixedShiftIndex = ui->position->value();
|
||||
}
|
||||
|
||||
void SigMFFileSinkGUI::tick()
|
||||
{
|
||||
if (++m_tickCount == 20) // once per second
|
||||
{
|
||||
uint64_t msTime = m_sigMFFileSink->getMsCount();
|
||||
uint64_t bytes = m_sigMFFileSink->getByteCount();
|
||||
unsigned int nbTracks = m_sigMFFileSink->getNbTracks();
|
||||
QTime recordLength(0, 0, 0, 0);
|
||||
recordLength = recordLength.addSecs(msTime / 1000);
|
||||
recordLength = recordLength.addMSecs(msTime % 1000);
|
||||
QString s_time = recordLength.toString("HH:mm:ss");
|
||||
ui->recordTimeText->setText(s_time);
|
||||
ui->recordSizeText->setText(displayScaled(bytes, 2));
|
||||
ui->recordNbTracks->setText(tr("#%1").arg(nbTracks));
|
||||
m_tickCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QString SigMFFileSinkGUI::displayScaled(uint64_t value, int precision)
|
||||
{
|
||||
if (value < 1000) {
|
||||
return tr("%1").arg(QString::number(value, 'f', precision));
|
||||
} else if (value < 1000000) {
|
||||
return tr("%1k").arg(QString::number(value / 1000.0, 'f', precision));
|
||||
} else if (value < 1000000000) {
|
||||
return tr("%1M").arg(QString::number(value / 1000000.0, 'f', precision));
|
||||
} else if (value < 1000000000000) {
|
||||
return tr("%1G").arg(QString::number(value / 1000000000.0, 'f', precision));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ private:
|
||||
void displayPos();
|
||||
void setFrequencyFromPos();
|
||||
void setPosFromFrequency();
|
||||
QString displayScaled(uint64_t value, int precision);
|
||||
|
||||
void leaveEvent(QEvent*);
|
||||
void enterEvent(QEvent*);
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>494</width>
|
||||
<width>522</width>
|
||||
<height>102</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>494</width>
|
||||
<width>522</width>
|
||||
<height>102</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -33,13 +33,13 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>492</width>
|
||||
<width>520</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>492</width>
|
||||
<width>520</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -202,7 +202,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Effective channel rate (kS/s)</string>
|
||||
<string>Sink rate (kS/s)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0000k</string>
|
||||
@ -212,6 +212,60 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="recordNbTracks">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of captures (tracks) in record updated at end of track</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>#000</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="recordTimeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>52</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record time (HH:MM:SS)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00:00:00</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="recordSizeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>52</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Data file size (k: kB, M: MB, G: GB)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>999.99M</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -24,7 +24,9 @@
|
||||
|
||||
SigMFFileSinkSink::SigMFFileSinkSink() :
|
||||
m_recordEnabled(false),
|
||||
m_record(false)
|
||||
m_record(false),
|
||||
m_msCount(0),
|
||||
m_byteCount(0)
|
||||
{}
|
||||
|
||||
SigMFFileSinkSink::~SigMFFileSinkSink()
|
||||
@ -68,8 +70,15 @@ void SigMFFileSinkSink::feed(const SampleVector::const_iterator& begin, const Sa
|
||||
}
|
||||
}
|
||||
|
||||
if (m_record) {
|
||||
if (m_record)
|
||||
{
|
||||
m_fileSink.feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true);
|
||||
int nbSamples = m_sampleBuffer.end() - m_sampleBuffer.begin();
|
||||
m_byteCount += nbSamples * sizeof(Sample);
|
||||
|
||||
if (m_sinkSampleRate > 0) {
|
||||
m_msCount += (nbSamples * 1000) / m_sinkSampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
m_sampleBuffer.clear();
|
||||
@ -133,6 +142,8 @@ void SigMFFileSinkSink::applySettings(const SigMFFileSinkSettings& settings, boo
|
||||
if (recordType == FileRecordInterface::RecordTypeSigMF)
|
||||
{
|
||||
m_fileSink.setFileName(fileBase);
|
||||
m_msCount = 0;
|
||||
m_byteCount = 0;
|
||||
m_recordEnabled = true;
|
||||
}
|
||||
else
|
||||
@ -148,4 +159,4 @@ void SigMFFileSinkSink::applySettings(const SigMFFileSinkSettings& settings, boo
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,6 +46,9 @@ public:
|
||||
int64_t centerFrequency,
|
||||
bool force = false);
|
||||
void applySettings(const SigMFFileSinkSettings& settings, bool force = false);
|
||||
uint64_t getMsCount() const { return m_msCount; }
|
||||
uint64_t getByteCount() const { return m_byteCount; }
|
||||
unsigned int getNbTracks() const { return m_fileSink.getNbCaptures(); }
|
||||
|
||||
private:
|
||||
int m_channelSampleRate;
|
||||
@ -63,6 +66,8 @@ private:
|
||||
bool m_record;
|
||||
QString m_deviceHwId;
|
||||
int m_deviceUId;
|
||||
uint64_t m_msCount;
|
||||
uint64_t m_byteCount;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SIFMFFILESINKSINK_H_
|
||||
|
||||
@ -101,6 +101,11 @@ void SigMFFileRecord::setFileName(const QString& fileName)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int SigMFFileRecord::getNbCaptures() const
|
||||
{
|
||||
return m_metaRecord->captures.size();
|
||||
}
|
||||
|
||||
void SigMFFileRecord::startRecording()
|
||||
{
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ public:
|
||||
virtual bool isRecording() const { return m_recordOn; }
|
||||
|
||||
void setHardwareId(const QString& hardwareId) { m_hardwareId = hardwareId; }
|
||||
unsigned int getNbCaptures() const;
|
||||
|
||||
private:
|
||||
QString m_hardwareId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user