mirror of https://github.com/f4exb/sdrangel.git
FCDPro+ input: moved FileRecord out of the GUI
This commit is contained in:
parent
622ac93250
commit
fc303cc218
|
@ -25,7 +25,6 @@
|
||||||
#include "fcdproplusgui.h"
|
#include "fcdproplusgui.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include <dsp/filerecord.h>
|
|
||||||
#include "fcdproplusconst.h"
|
#include "fcdproplusconst.h"
|
||||||
|
|
||||||
FCDProPlusGui::FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
FCDProPlusGui::FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||||
|
@ -62,18 +61,11 @@ FCDProPlusGui::FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
|
||||||
char recFileNameCStr[30];
|
|
||||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
|
||||||
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
|
||||||
m_deviceAPI->addSink(m_fileSink);
|
|
||||||
|
|
||||||
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCDProPlusGui::~FCDProPlusGui()
|
FCDProPlusGui::~FCDProPlusGui()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
|
||||||
delete m_fileSink;
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +143,6 @@ void FCDProPlusGui::handleDSPMessages()
|
||||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
qDebug("RTLSDRGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
qDebug("RTLSDRGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
updateSampleRateAndFrequency();
|
updateSampleRateAndFrequency();
|
||||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
|
||||||
|
|
||||||
delete message;
|
delete message;
|
||||||
}
|
}
|
||||||
|
@ -304,14 +295,12 @@ void FCDProPlusGui::on_startStop_toggled(bool checked)
|
||||||
|
|
||||||
void FCDProPlusGui::on_record_toggled(bool checked)
|
void FCDProPlusGui::on_record_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked) {
|
||||||
{
|
|
||||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||||
m_fileSink->startRecording();
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
m_fileSink->stopRecording();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FCDProPlusInput::MsgFileRecord* message = FCDProPlusInput::MsgFileRecord::create(checked);
|
||||||
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "fcdproplusinput.h"
|
#include "fcdproplusinput.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FileRecord;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class FCDProPlusGui;
|
class FCDProPlusGui;
|
||||||
|
@ -58,7 +57,6 @@ private:
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<int> m_gains;
|
std::vector<int> m_gains;
|
||||||
DeviceSampleSource* m_sampleSource;
|
DeviceSampleSource* m_sampleSource;
|
||||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||||
int m_lastEngineState;
|
int m_lastEngineState;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include <dsp/filerecord.h>
|
||||||
#include "fcdproplusinput.h"
|
#include "fcdproplusinput.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
#include "fcdproplusconst.h"
|
#include "fcdproplusconst.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(FCDProPlusInput::MsgConfigureFCD, Message)
|
MESSAGE_CLASS_DEFINITION(FCDProPlusInput::MsgConfigureFCD, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(FCDProPlusInput::MsgFileRecord, Message)
|
||||||
|
|
||||||
FCDProPlusInput::FCDProPlusInput(DeviceSourceAPI *deviceAPI) :
|
FCDProPlusInput::FCDProPlusInput(DeviceSourceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
|
@ -42,11 +44,18 @@ FCDProPlusInput::FCDProPlusInput(DeviceSourceAPI *deviceAPI) :
|
||||||
m_running(false)
|
m_running(false)
|
||||||
{
|
{
|
||||||
openDevice();
|
openDevice();
|
||||||
|
|
||||||
|
char recFileNameCStr[30];
|
||||||
|
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||||
|
m_fileSink = new FileRecord(std::string(recFileNameCStr));
|
||||||
|
m_deviceAPI->addSink(m_fileSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCDProPlusInput::~FCDProPlusInput()
|
FCDProPlusInput::~FCDProPlusInput()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +167,19 @@ bool FCDProPlusInput::handleMessage(const Message& message)
|
||||||
applySettings(conf.getSettings(), false);
|
applySettings(conf.getSettings(), false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgFileRecord::match(message))
|
||||||
|
{
|
||||||
|
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||||
|
qDebug() << "FCDProPlusInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||||
|
|
||||||
|
if (conf.getStartStop()) {
|
||||||
|
m_fileSink->startRecording();
|
||||||
|
} else {
|
||||||
|
m_fileSink->stopRecording();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -267,6 +289,7 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for
|
||||||
{
|
{
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<ProPlus>::sampleRate, m_settings.m_centerFrequency);
|
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<ProPlus>::sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct fcd_buffer {
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FCDProPlusThread;
|
class FCDProPlusThread;
|
||||||
|
class FileRecord;
|
||||||
|
|
||||||
class FCDProPlusInput : public DeviceSampleSource {
|
class FCDProPlusInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
|
@ -54,6 +55,25 @@ public:
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgFileRecord : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool getStartStop() const { return m_startStop; }
|
||||||
|
|
||||||
|
static MsgFileRecord* create(bool startStop) {
|
||||||
|
return new MsgFileRecord(startStop);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool m_startStop;
|
||||||
|
|
||||||
|
MsgFileRecord(bool startStop) :
|
||||||
|
Message(),
|
||||||
|
m_startStop(startStop)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
FCDProPlusInput(DeviceSourceAPI *deviceAPI);
|
FCDProPlusInput(DeviceSourceAPI *deviceAPI);
|
||||||
virtual ~FCDProPlusInput();
|
virtual ~FCDProPlusInput();
|
||||||
|
|
||||||
|
@ -87,6 +107,7 @@ private:
|
||||||
FCDProPlusThread* m_FCDThread;
|
FCDProPlusThread* m_FCDThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FCD_H
|
#endif // INCLUDE_FCD_H
|
||||||
|
|
Loading…
Reference in New Issue