mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-12-08 12:03:41 -05:00
FileRecordInterface: true dynamic allocation - MIMO plugins
This commit is contained in:
parent
22a886fba9
commit
8d35747539
@ -70,6 +70,12 @@ BladeRF2MIMO::BladeRF2MIMO(DeviceAPI *deviceAPI) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<FileRecord*>::iterator it = m_fileSinks.begin();
|
||||||
|
|
||||||
|
for (; it != m_fileSinks.end(); ++it) {
|
||||||
|
*it = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
m_mimoType = MIMOHalfSynchronous;
|
m_mimoType = MIMOHalfSynchronous;
|
||||||
m_sampleMIFifo.init(2, 4096 * 64);
|
m_sampleMIFifo.init(2, 4096 * 64);
|
||||||
m_sampleMOFifo.init(2, 4096 * 64);
|
m_sampleMOFifo.init(2, 4096 * 64);
|
||||||
@ -91,10 +97,12 @@ BladeRF2MIMO::~BladeRF2MIMO()
|
|||||||
|
|
||||||
for (; it != m_fileSinks.end(); ++it, istream++)
|
for (; it != m_fileSinks.end(); ++it, istream++)
|
||||||
{
|
{
|
||||||
|
if (*it) {
|
||||||
m_deviceAPI->removeAncillarySink(*it, istream);
|
m_deviceAPI->removeAncillarySink(*it, istream);
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BladeRF2MIMO::destroy()
|
void BladeRF2MIMO::destroy()
|
||||||
{
|
{
|
||||||
@ -141,10 +149,6 @@ void BladeRF2MIMO::closeDevice()
|
|||||||
|
|
||||||
void BladeRF2MIMO::init()
|
void BladeRF2MIMO::init()
|
||||||
{
|
{
|
||||||
m_fileSinks.push_back(new FileRecord(QString("test_0_%1.sdriq").arg(m_deviceAPI->getDeviceUID())));
|
|
||||||
m_fileSinks.push_back(new FileRecord(QString("test_1_%1.sdriq").arg(m_deviceAPI->getDeviceUID())));
|
|
||||||
m_deviceAPI->addAncillarySink(m_fileSinks[0], 0);
|
|
||||||
m_deviceAPI->addAncillarySink(m_fileSinks[1], 1);
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,17 +377,26 @@ bool BladeRF2MIMO::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if (conf.getStartStop())
|
if (conf.getStartStop())
|
||||||
{
|
{
|
||||||
if (m_settings.m_fileRecordName.size() != 0) {
|
if (m_fileSinks[istream])
|
||||||
m_fileSinks[istream]->setFileName(m_settings.m_fileRecordName + "_0.sdriq");
|
{
|
||||||
} else {
|
m_deviceAPI->removeAncillarySink(m_fileSinks[istream], istream);
|
||||||
m_fileSinks[istream]->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID(), istream));
|
delete m_fileSinks[istream];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_settings.m_fileRecordName.size() != 0) {
|
||||||
|
m_fileSinks[istream] = new FileRecord(QString("%1_%2.sdriq"). arg(m_settings.m_fileRecordName).arg(istream));
|
||||||
|
} else {
|
||||||
|
m_fileSinks[istream] = new FileRecord(QString("%1.sdriq").arg(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID(), istream)));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_deviceAPI->addAncillarySink(m_fileSinks[istream], istream);
|
||||||
m_fileSinks[istream]->startRecording();
|
m_fileSinks[istream]->startRecording();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fileSinks[istream]->stopRecording();
|
m_fileSinks[istream]->stopRecording();
|
||||||
|
delete m_fileSinks[istream];
|
||||||
|
m_fileSinks[istream] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -821,9 +834,17 @@ bool BladeRF2MIMO::applySettings(const BladeRF2MIMOSettings& settings, bool forc
|
|||||||
{
|
{
|
||||||
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
int sampleRate = settings.m_devSampleRate/(1<<settings.m_log2Decim);
|
||||||
DSPSignalNotification *notifFileSink0 = new DSPSignalNotification(sampleRate, settings.m_rxCenterFrequency);
|
DSPSignalNotification *notifFileSink0 = new DSPSignalNotification(sampleRate, settings.m_rxCenterFrequency);
|
||||||
|
|
||||||
|
if (m_fileSinks[0]) {
|
||||||
m_fileSinks[0]->handleMessage(*notifFileSink0); // forward to file sinks
|
m_fileSinks[0]->handleMessage(*notifFileSink0); // forward to file sinks
|
||||||
|
}
|
||||||
|
|
||||||
DSPSignalNotification *notifFileSink1 = new DSPSignalNotification(sampleRate, settings.m_rxCenterFrequency);
|
DSPSignalNotification *notifFileSink1 = new DSPSignalNotification(sampleRate, settings.m_rxCenterFrequency);
|
||||||
|
|
||||||
|
if (m_fileSinks[1]) {
|
||||||
m_fileSinks[1]->handleMessage(*notifFileSink0); // forward to file sinks
|
m_fileSinks[1]->handleMessage(*notifFileSink0); // forward to file sinks
|
||||||
|
}
|
||||||
|
|
||||||
DSPMIMOSignalNotification *notif0 = new DSPMIMOSignalNotification(sampleRate, settings.m_rxCenterFrequency, true, 0);
|
DSPMIMOSignalNotification *notif0 = new DSPMIMOSignalNotification(sampleRate, settings.m_rxCenterFrequency, true, 0);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif0);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif0);
|
||||||
DSPMIMOSignalNotification *notif1 = new DSPMIMOSignalNotification(sampleRate, settings.m_rxCenterFrequency, true, 1);
|
DSPMIMOSignalNotification *notif1 = new DSPMIMOSignalNotification(sampleRate, settings.m_rxCenterFrequency, true, 1);
|
||||||
|
|||||||
@ -51,7 +51,13 @@ TestMI::TestMI(DeviceAPI *deviceAPI) :
|
|||||||
{
|
{
|
||||||
m_mimoType = MIMOAsynchronous;
|
m_mimoType = MIMOAsynchronous;
|
||||||
m_sampleMIFifo.init(2, 96000 * 4);
|
m_sampleMIFifo.init(2, 96000 * 4);
|
||||||
//m_sampleSinkVectors.resize(2);
|
|
||||||
|
std::vector<FileRecord*>::iterator it = m_fileSinks.begin();
|
||||||
|
|
||||||
|
for (; it != m_fileSinks.end(); ++it) {
|
||||||
|
*it = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
m_deviceAPI->setNbSourceStreams(2);
|
m_deviceAPI->setNbSourceStreams(2);
|
||||||
m_networkManager = new QNetworkAccessManager();
|
m_networkManager = new QNetworkAccessManager();
|
||||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||||
@ -70,11 +76,14 @@ TestMI::~TestMI()
|
|||||||
int istream = 0;
|
int istream = 0;
|
||||||
|
|
||||||
for (; it != m_fileSinks.end(); ++it, istream++)
|
for (; it != m_fileSinks.end(); ++it, istream++)
|
||||||
|
{
|
||||||
|
if (*it)
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeAncillarySink(*it, istream);
|
m_deviceAPI->removeAncillarySink(*it, istream);
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TestMI::destroy()
|
void TestMI::destroy()
|
||||||
{
|
{
|
||||||
@ -83,11 +92,6 @@ void TestMI::destroy()
|
|||||||
|
|
||||||
void TestMI::init()
|
void TestMI::init()
|
||||||
{
|
{
|
||||||
m_fileSinks.push_back(new FileRecord(QString("test_0_%1.sdriq").arg(m_deviceAPI->getDeviceUID())));
|
|
||||||
m_fileSinks.push_back(new FileRecord(QString("test_1_%1.sdriq").arg(m_deviceAPI->getDeviceUID())));
|
|
||||||
m_deviceAPI->addAncillarySink(m_fileSinks[0], 0);
|
|
||||||
m_deviceAPI->addAncillarySink(m_fileSinks[1], 1);
|
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,17 +241,26 @@ bool TestMI::handleMessage(const Message& message)
|
|||||||
|
|
||||||
if (conf.getStartStop())
|
if (conf.getStartStop())
|
||||||
{
|
{
|
||||||
if (m_settings.m_fileRecordName.size() != 0) {
|
if (m_fileSinks[istream])
|
||||||
m_fileSinks[istream]->setFileName(m_settings.m_fileRecordName + "_0.sdriq");
|
{
|
||||||
} else {
|
m_deviceAPI->removeAncillarySink(m_fileSinks[istream], istream);
|
||||||
m_fileSinks[istream]->setFileName(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID(), istream));
|
delete m_fileSinks[istream];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_settings.m_fileRecordName.size() != 0) {
|
||||||
|
m_fileSinks[istream] = new FileRecord(QString("%1_%2.sdriq"). arg(m_settings.m_fileRecordName).arg(istream));
|
||||||
|
} else {
|
||||||
|
m_fileSinks[istream] = new FileRecord(QString("%1.sdriq").arg(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID(), istream)));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_deviceAPI->addAncillarySink(m_fileSinks[istream], istream);
|
||||||
m_fileSinks[istream]->startRecording();
|
m_fileSinks[istream]->startRecording();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fileSinks[istream]->stopRecording();
|
m_fileSinks[istream]->stopRecording();
|
||||||
|
delete m_fileSinks[istream];
|
||||||
|
m_fileSinks[istream] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -464,7 +477,11 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
|||||||
{
|
{
|
||||||
int sampleRate = settings.m_streams[istream].m_sampleRate/(1<<settings.m_streams[istream].m_log2Decim);
|
int sampleRate = settings.m_streams[istream].m_sampleRate/(1<<settings.m_streams[istream].m_log2Decim);
|
||||||
DSPSignalNotification notif(sampleRate, settings.m_streams[istream].m_centerFrequency);
|
DSPSignalNotification notif(sampleRate, settings.m_streams[istream].m_centerFrequency);
|
||||||
|
|
||||||
|
if (m_fileSinks[istream]) {
|
||||||
m_fileSinks[istream]->handleMessage(notif); // forward to file sink
|
m_fileSinks[istream]->handleMessage(notif); // forward to file sink
|
||||||
|
}
|
||||||
|
|
||||||
DSPMIMOSignalNotification *engineNotif = new DSPMIMOSignalNotification(
|
DSPMIMOSignalNotification *engineNotif = new DSPMIMOSignalNotification(
|
||||||
sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream);
|
sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream);
|
||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user