mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-07 08:24:43 -04:00
MIMO: add channel to testMI (2)
This commit is contained in:
@@ -51,9 +51,9 @@ TestMI::TestMI(DeviceAPI *deviceAPI) :
|
||||
{
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->setNbSourceStreams(2);
|
||||
m_deviceAPI->addSourceStream(); // Add a new source stream data set in the engine
|
||||
m_deviceAPI->addSourceStream(); // Add a new source stream data set in the engine
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
m_deviceAPI->addSourceStream(true); // Add a new source stream data set in the engine - asynchronous handling of FIFOs
|
||||
m_deviceAPI->addSourceStream(true); // Add a new source stream data set in the engine - asynchronous handling of FIFOs
|
||||
//m_deviceAPI->addAncillarySink(m_fileSink); TODO: implement when active
|
||||
m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4));
|
||||
m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4));
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
@@ -87,15 +87,18 @@ void TestMI::init()
|
||||
|
||||
bool TestMI::start()
|
||||
{
|
||||
qDebug("TestMI::start");
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_running) stop();
|
||||
if (m_running) {
|
||||
stop();
|
||||
}
|
||||
|
||||
m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[0]));
|
||||
m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[0], 0));
|
||||
m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[0].m_sampleRate);
|
||||
m_testSourceThreads.back()->startStop(true);
|
||||
|
||||
m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[1]));
|
||||
m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[1], 1));
|
||||
m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[1].m_sampleRate);
|
||||
m_testSourceThreads.back()->startStop(true);
|
||||
|
||||
@@ -109,6 +112,7 @@ bool TestMI::start()
|
||||
|
||||
void TestMI::stop()
|
||||
{
|
||||
qDebug("TestMI::stop");
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
std::vector<TestMIThread*>::iterator it = m_testSourceThreads.begin();
|
||||
@@ -263,12 +267,10 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
{
|
||||
DeviceSettingsKeys deviceSettingsKeys;
|
||||
|
||||
QList<QList<QString>> streamReverseAPIKeys; // FIXME: one set of keys per streams
|
||||
|
||||
for (unsigned int istream = 0; istream < m_settings.m_streams.size(); istream++)
|
||||
{
|
||||
deviceSettingsKeys.m_streamsSettingsKeys.push_back(QList<QString>());
|
||||
QList<QString>& reverseAPIKeys = streamReverseAPIKeys.back();
|
||||
QList<QString>& reverseAPIKeys = deviceSettingsKeys.m_streamsSettingsKeys.back();
|
||||
|
||||
if ((m_settings.m_streams[istream].m_autoCorrOptions != settings.m_streams[istream].m_autoCorrOptions) || force)
|
||||
{
|
||||
@@ -296,7 +298,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream]))
|
||||
{
|
||||
m_testSourceThreads[istream]->setSamplerate(settings.m_streams[istream].m_sampleRate);
|
||||
qDebug("TestMI::applySettings: sample rate set to %d", settings.m_streams[istream].m_sampleRate);
|
||||
qDebug("TestMI::applySettings: thread on stream: %u sample rate set to %d",
|
||||
istream, settings.m_streams[istream].m_sampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +310,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream]))
|
||||
{
|
||||
m_testSourceThreads[istream]->setLog2Decimation(settings.m_streams[istream].m_log2Decim);
|
||||
qDebug() << "TestMI::applySettings: set decimation to " << (1<<settings.m_streams[istream].m_log2Decim);
|
||||
qDebug("TestMI::applySettings: thread on stream: %u set decimation to %d",
|
||||
istream, (1<<settings.m_streams[istream].m_log2Decim));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +351,7 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
m_testSourceThreads[istream]->setFcPos((int) settings.m_streams[istream].m_fcPos);
|
||||
m_testSourceThreads[istream]->setFrequencyShift(frequencyShift);
|
||||
qDebug() << "TestMI::applySettings:"
|
||||
<< " istream: " << istream
|
||||
<< " thread on istream: " << istream
|
||||
<< " center freq: " << settings.m_streams[istream].m_centerFrequency << " Hz"
|
||||
<< " device center freq: " << deviceCenterFrequency << " Hz"
|
||||
<< " device sample rate: " << devSampleRate << "Hz"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(TestMIThread::MsgStartStop, Message)
|
||||
|
||||
TestMIThread::TestMIThread(SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||
TestMIThread::TestMIThread(SampleSinkFifo* sampleFifo, int streamIndex, QObject* parent) :
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_buf(0),
|
||||
@@ -36,6 +36,7 @@ TestMIThread::TestMIThread(SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||
m_chunksize(0),
|
||||
m_convertBuffer(TESTMI_BLOCKSIZE),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_streamIndex(streamIndex),
|
||||
m_frequencyShift(0),
|
||||
m_toneFrequency(440),
|
||||
m_modulation(TestMIStreamSettings::ModulationNone),
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
TestMIThread(SampleSinkFifo* sampleFifo, QObject* parent = 0);
|
||||
TestMIThread(SampleSinkFifo* sampleFifo, int streamIndex, QObject* parent = 0);
|
||||
~TestMIThread();
|
||||
|
||||
void startStop(bool start);
|
||||
@@ -90,6 +90,7 @@ private:
|
||||
quint32 m_chunksize;
|
||||
SampleVector m_convertBuffer;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
int m_streamIndex;
|
||||
NCOF m_nco;
|
||||
NCOF m_toneNco;
|
||||
int m_frequencyShift;
|
||||
|
||||
Reference in New Issue
Block a user