1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -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 "ui_filesourcegui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h" #include "gui/colormapper.h"
#include "gui/glspectrum.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "filesourcegui.h" #include "filesourcegui.h"
@ -65,6 +68,8 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, QWidget* parent) :
m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindow()->getMasterTimer()); m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindow()->getMasterTimer());
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
DSPEngine::instance()->setSource(m_sampleSource); DSPEngine::instance()->setSource(m_sampleSource);
connect(m_pluginAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
} }
FileSourceGui::~FileSourceGui() 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) bool FileSourceGui::handleMessage(const Message& message)
{ {
if (FileSourceInput::MsgReportFileSourceAcquisition::match(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() void FileSourceGui::displaySettings()
{ {
} }

View File

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

View File

@ -34,6 +34,10 @@
</property> </property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item>
<layout class="QVBoxLayout" name="deviceUILayout">
<item>
<layout class="QHBoxLayout" name="deviceButtonsLayout">
<item> <item>
<widget class="ButtonSwitch" name="startStop"> <widget class="ButtonSwitch" name="startStop">
<property name="toolTip"> <property name="toolTip">
@ -49,6 +53,33 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<spacer name="freqLeftSpacer"> <spacer name="freqLeftSpacer">
<property name="orientation"> <property name="orientation">