1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

Multi device support: Changed aligned FileSource

This commit is contained in:
f4exb 2016-05-12 12:29:12 +02:00
parent cd9532a5e2
commit b399cc0dd4
3 changed files with 81 additions and 13 deletions

View File

@ -25,7 +25,10 @@
#include "ui_filesourcegui.h"
#include "plugin/pluginapi.h"
#include "gui/colormapper.h"
#include "gui/glspectrum.h"
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
#include "mainwindow.h"
#include "filesourcegui.h"
@ -65,6 +68,8 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindow()->getMasterTimer());
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
DSPEngine::instance()->setSource(m_sampleSource);
connect(m_pluginAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
}
FileSourceGui::~FileSourceGui()
@ -123,6 +128,27 @@ bool FileSourceGui::deserialize(const QByteArray& data)
}
}
void FileSourceGui::handleDSPMessages()
{
Message* message;
while ((message = m_pluginAPI->getDeviceOutputMessageQueue()->pop()) != 0)
{
qDebug("FileSourceGui::handleDSPMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_deviceSampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("FileSourceGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
}
}
bool FileSourceGui::handleMessage(const Message& message)
{
if (FileSourceInput::MsgReportFileSourceAcquisition::match(message))
@ -167,6 +193,13 @@ void FileSourceGui::handleSourceMessages()
}
}
void FileSourceGui::updateSampleRateAndFrequency()
{
m_pluginAPI->getSpectrum()->setSampleRate(m_sampleRate);
m_pluginAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
}
void FileSourceGui::displaySettings()
{
}

View File

@ -63,17 +63,21 @@ private:
int m_samplesCount;
std::size_t m_tickCount;
bool m_enableNavTime;
int m_deviceSampleRate;
quint64 m_deviceCenterFrequency; //!< Center frequency in device
int m_lastEngineState;
void displaySettings();
void displayTime();
void sendSettings();
void updateSampleRateAndFrequency();
void configureFileName();
void updateWithAcquisition();
void updateWithStreamData();
void updateWithStreamTime();
private slots:
void handleDSPMessages();
void handleSourceMessages();
void on_startStop_toggled(bool checked);
void on_playLoop_toggled(bool checked);

View File

@ -35,19 +35,50 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_freq">
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>start/stop acquisition</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
<layout class="QVBoxLayout" name="deviceUILayout">
<item>
<layout class="QHBoxLayout" name="deviceButtonsLayout">
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>start/stop acquisition</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="deviceRateLayout">
<item>
<widget class="QLabel" name="deviceRateText">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>I/Q sample rate kS/s</string>
</property>
<property name="text">
<string>00000k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="freqLeftSpacer">