mirror of https://github.com/f4exb/sdrangel.git
SDRPlay input: moved FileRecord out of the GUI
This commit is contained in:
parent
6c25c939e7
commit
ea4f0972be
|
@ -20,7 +20,6 @@
|
||||||
#include "sdrplaygui.h"
|
#include "sdrplaygui.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include <dsp/filerecord.h>
|
|
||||||
|
|
||||||
#include "ui_sdrplaygui.h"
|
#include "ui_sdrplaygui.h"
|
||||||
#include "gui/colormapper.h"
|
#include "gui/colormapper.h"
|
||||||
|
@ -72,12 +71,6 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
|
||||||
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +183,6 @@ void SDRPlayGui::handleDSPMessages()
|
||||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
qDebug("SDRPlayGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
qDebug("SDRPlayGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
updateSampleRateAndFrequency();
|
updateSampleRateAndFrequency();
|
||||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
|
||||||
|
|
||||||
delete message;
|
delete message;
|
||||||
}
|
}
|
||||||
|
@ -464,16 +456,14 @@ void SDRPlayGui::on_startStop_toggled(bool checked)
|
||||||
|
|
||||||
void SDRPlayGui::on_record_toggled(bool checked)
|
void SDRPlayGui::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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDRPlayInput::MsgFileRecord* message = SDRPlayInput::MsgFileRecord::create(checked);
|
||||||
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
class DeviceSampleSource;
|
class DeviceSampleSource;
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FileRecord;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SDRPlayGui;
|
class SDRPlayGui;
|
||||||
|
@ -59,7 +58,6 @@ private:
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
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;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include <dsp/filerecord.h>
|
||||||
#include "sdrplaygui.h"
|
#include "sdrplaygui.h"
|
||||||
#include "sdrplayinput.h"
|
#include "sdrplayinput.h"
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgConfigureSDRPlay, Message)
|
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgConfigureSDRPlay, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlayGains, Message)
|
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlayGains, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgFileRecord, Message)
|
||||||
|
|
||||||
SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
|
SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
|
@ -41,11 +43,18 @@ SDRPlayInput::SDRPlayInput(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDRPlayInput::~SDRPlayInput()
|
SDRPlayInput::~SDRPlayInput()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +235,19 @@ bool SDRPlayInput::handleMessage(const Message& message)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgFileRecord::match(message))
|
||||||
|
{
|
||||||
|
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||||
|
qDebug() << "SDRPlayInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||||
|
|
||||||
|
if (conf.getStartStop()) {
|
||||||
|
m_fileSink->startRecording();
|
||||||
|
} else {
|
||||||
|
m_fileSink->stopRecording();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -509,6 +531,7 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool forwardCh
|
||||||
int sampleRate = getSampleRate();
|
int sampleRate = getSampleRate();
|
||||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||||
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceInputMessageQueue()->push(notif);
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class SDRPlayThread;
|
class SDRPlayThread;
|
||||||
|
class FileRecord;
|
||||||
|
|
||||||
class SDRPlayInput : public DeviceSampleSource {
|
class SDRPlayInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
|
@ -78,6 +79,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)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
SDRPlayInput(DeviceSourceAPI *deviceAPI);
|
SDRPlayInput(DeviceSourceAPI *deviceAPI);
|
||||||
virtual ~SDRPlayInput();
|
virtual ~SDRPlayInput();
|
||||||
|
|
||||||
|
@ -104,6 +124,7 @@ private:
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
int m_devNumber;
|
int m_devNumber;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */
|
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */
|
||||||
|
|
Loading…
Reference in New Issue