mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-16 12:42:26 -04:00
Airspy: use transfer->ctx to pass this object address
This commit is contained in:
parent
e037aa61a2
commit
17afe4fa65
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
|
|
||||||
AirspyWorker *AirspyWorker::m_this = 0;
|
|
||||||
|
|
||||||
AirspyWorker::AirspyWorker(struct airspy_device* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
AirspyWorker::AirspyWorker(struct airspy_device* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
@ -36,21 +34,19 @@ AirspyWorker::AirspyWorker(struct airspy_device* dev, SampleSinkFifo* sampleFifo
|
|||||||
m_fcPos(0),
|
m_fcPos(0),
|
||||||
m_iqOrder(true)
|
m_iqOrder(true)
|
||||||
{
|
{
|
||||||
m_this = this;
|
|
||||||
std::fill(m_buf, m_buf + 2*AIRSPY_BLOCKSIZE, 0);
|
std::fill(m_buf, m_buf + 2*AIRSPY_BLOCKSIZE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyWorker::~AirspyWorker()
|
AirspyWorker::~AirspyWorker()
|
||||||
{
|
{
|
||||||
stopWork();
|
stopWork();
|
||||||
m_this = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyWorker::startWork()
|
bool AirspyWorker::startWork()
|
||||||
{
|
{
|
||||||
airspy_error rc;
|
airspy_error rc;
|
||||||
|
|
||||||
rc = (airspy_error) airspy_start_rx(m_dev, rx_callback, NULL);
|
rc = (airspy_error) airspy_start_rx(m_dev, rx_callback, this);
|
||||||
|
|
||||||
if (rc == AIRSPY_SUCCESS)
|
if (rc == AIRSPY_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -282,12 +278,13 @@ void AirspyWorker::callbackQI(const qint16* buf, qint32 len)
|
|||||||
|
|
||||||
int AirspyWorker::rx_callback(airspy_transfer_t* transfer)
|
int AirspyWorker::rx_callback(airspy_transfer_t* transfer)
|
||||||
{
|
{
|
||||||
|
AirspyWorker *worker = (AirspyWorker*) transfer->ctx;
|
||||||
qint32 bytes_to_write = transfer->sample_count * sizeof(qint16);
|
qint32 bytes_to_write = transfer->sample_count * sizeof(qint16);
|
||||||
|
|
||||||
if (m_this->m_iqOrder) {
|
if (worker->m_iqOrder) {
|
||||||
m_this->callbackIQ((qint16 *) transfer->samples, bytes_to_write);
|
worker->callbackIQ((qint16 *) transfer->samples, bytes_to_write);
|
||||||
} else {
|
} else {
|
||||||
m_this->callbackQI((qint16 *) transfer->samples, bytes_to_write);
|
worker->callbackQI((qint16 *) transfer->samples, bytes_to_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -52,7 +52,6 @@ private:
|
|||||||
unsigned int m_log2Decim;
|
unsigned int m_log2Decim;
|
||||||
int m_fcPos;
|
int m_fcPos;
|
||||||
bool m_iqOrder;
|
bool m_iqOrder;
|
||||||
static AirspyWorker *m_this;
|
|
||||||
|
|
||||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, true> m_decimatorsIQ;
|
||||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12, false> m_decimatorsQI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user