mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 19:28:47 -05:00
AudioCATSISO: fixed transverter processing
This commit is contained in:
parent
956d1e6c07
commit
217c900609
@ -144,9 +144,6 @@ bool AudioCATSISO::startRx()
|
|||||||
m_inputWorker->startWork();
|
m_inputWorker->startWork();
|
||||||
m_inputWorkerThread->start();
|
m_inputWorkerThread->start();
|
||||||
|
|
||||||
qDebug("AudioCATSISO::startRx: started");
|
|
||||||
m_rxRunning = true;
|
|
||||||
|
|
||||||
qDebug() << "AudioCATSISO::startRx: start CAT";
|
qDebug() << "AudioCATSISO::startRx: start CAT";
|
||||||
|
|
||||||
m_catWorkerThread = new QThread();
|
m_catWorkerThread = new QThread();
|
||||||
@ -162,6 +159,12 @@ bool AudioCATSISO::startRx()
|
|||||||
m_catWorker->startWork();
|
m_catWorker->startWork();
|
||||||
m_catWorkerThread->start();
|
m_catWorkerThread->start();
|
||||||
|
|
||||||
|
qDebug("AudioCATSISO::startRx: started");
|
||||||
|
m_rxRunning = true;
|
||||||
|
|
||||||
|
AudioCATSISOCATWorker::MsgSetRxSampleRate *msgSetRxSampleRate = AudioCATSISOCATWorker::MsgSetRxSampleRate::create(m_rxSampleRate);
|
||||||
|
m_catWorker->getInputMessageQueue()->push(msgSetRxSampleRate);
|
||||||
|
|
||||||
AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker *msgToCAT = AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker::create(
|
AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker *msgToCAT = AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker::create(
|
||||||
m_settings, QList<QString>(), true
|
m_settings, QList<QString>(), true
|
||||||
);
|
);
|
||||||
@ -470,6 +473,8 @@ void AudioCATSISO::applySettings(const AudioCATSISOSettings& settings, const QLi
|
|||||||
{
|
{
|
||||||
audioDeviceManager->removeAudioSource(&m_inputFifo);
|
audioDeviceManager->removeAudioSource(&m_inputFifo);
|
||||||
audioDeviceManager->addAudioSource(&m_inputFifo, getInputMessageQueue(), m_rxAudioDeviceIndex);
|
audioDeviceManager->addAudioSource(&m_inputFifo, getInputMessageQueue(), m_rxAudioDeviceIndex);
|
||||||
|
AudioCATSISOCATWorker::MsgSetRxSampleRate *msgSetRxSampleRate = AudioCATSISOCATWorker::MsgSetRxSampleRate::create(m_rxSampleRate);
|
||||||
|
m_catWorker->getInputMessageQueue()->push(msgSetRxSampleRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "dsp/devicesamplesource.h"
|
||||||
#include "audiocatsisocatworker.h"
|
#include "audiocatsisocatworker.h"
|
||||||
|
|
||||||
// Compatibility with all versions of Hamlib
|
// Compatibility with all versions of Hamlib
|
||||||
@ -27,6 +28,7 @@
|
|||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker, Message)
|
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgConfigureAudioCATSISOCATWorker, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgPollTimerConnect, Message)
|
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgPollTimerConnect, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgSetRxSampleRate, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgReportFrequency, Message)
|
MESSAGE_CLASS_DEFINITION(AudioCATSISOCATWorker::MsgReportFrequency, Message)
|
||||||
|
|
||||||
AudioCATSISOCATWorker::AudioCATSISOCATWorker(QObject* parent) :
|
AudioCATSISOCATWorker::AudioCATSISOCATWorker(QObject* parent) :
|
||||||
@ -77,17 +79,38 @@ void AudioCATSISOCATWorker::applySettings(const AudioCATSISOSettings& settings,
|
|||||||
<< " force:" << force
|
<< " force:" << force
|
||||||
<< settings.getDebugString(settingsKeys, force);
|
<< settings.getDebugString(settingsKeys, force);
|
||||||
|
|
||||||
if (settingsKeys.contains("rxCenterFrequency") || force)
|
qint64 rxXlatedDeviceCenterFrequency = settings.m_rxCenterFrequency;
|
||||||
|
rxXlatedDeviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||||
|
rxXlatedDeviceCenterFrequency = rxXlatedDeviceCenterFrequency < 0 ? 0 : rxXlatedDeviceCenterFrequency;
|
||||||
|
|
||||||
|
qint64 txXlatedDeviceCenterFrequency = settings.m_txCenterFrequency;
|
||||||
|
txXlatedDeviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||||
|
txXlatedDeviceCenterFrequency = txXlatedDeviceCenterFrequency < 0 ? 0 : txXlatedDeviceCenterFrequency;
|
||||||
|
|
||||||
|
if (settingsKeys.contains("rxCenterFrequency") ||
|
||||||
|
settingsKeys.contains("transverterMode") ||
|
||||||
|
settingsKeys.contains("transverterDeltaFrequency") || force)
|
||||||
{
|
{
|
||||||
if (!m_ptt) {
|
if (!m_ptt)
|
||||||
catSetFrequency(settings.m_rxCenterFrequency);
|
{
|
||||||
|
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
|
||||||
|
rxXlatedDeviceCenterFrequency,
|
||||||
|
0,
|
||||||
|
settings.m_log2Decim,
|
||||||
|
(DeviceSampleSource::fcPos_t) settings.m_fcPosRx,
|
||||||
|
m_rxSampleRate,
|
||||||
|
DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD,
|
||||||
|
false);
|
||||||
|
catSetFrequency(deviceCenterFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("txCenterFrequency") || force)
|
if (settingsKeys.contains("txCenterFrequency") ||
|
||||||
|
settingsKeys.contains("transverterMode") ||
|
||||||
|
settingsKeys.contains("transverterDeltaFrequency") || force)
|
||||||
{
|
{
|
||||||
if (m_ptt) {
|
if (m_ptt) {
|
||||||
catSetFrequency(settings.m_txCenterFrequency);
|
catSetFrequency(txXlatedDeviceCenterFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +166,30 @@ bool AudioCATSISOCATWorker::handleMessage(const Message& message)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgSetRxSampleRate::match(message))
|
||||||
|
{
|
||||||
|
MsgSetRxSampleRate& cmd = (MsgSetRxSampleRate&) message;
|
||||||
|
m_rxSampleRate = cmd.getSampleRate();
|
||||||
|
qDebug("AudioCATSISOCATWorker::handleMessage: MsgSetRxSampleRate: %d", m_rxSampleRate);
|
||||||
|
|
||||||
|
if (m_settings.m_transverterMode && !m_ptt)
|
||||||
|
{
|
||||||
|
qint64 rxXlatedDeviceCenterFrequency = m_settings.m_rxCenterFrequency;
|
||||||
|
rxXlatedDeviceCenterFrequency -= m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency : 0;
|
||||||
|
rxXlatedDeviceCenterFrequency = rxXlatedDeviceCenterFrequency < 0 ? 0 : rxXlatedDeviceCenterFrequency;
|
||||||
|
qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
|
||||||
|
rxXlatedDeviceCenterFrequency,
|
||||||
|
0,
|
||||||
|
m_settings.m_log2Decim,
|
||||||
|
(DeviceSampleSource::fcPos_t) m_settings.m_fcPosRx,
|
||||||
|
m_rxSampleRate,
|
||||||
|
DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD,
|
||||||
|
false);
|
||||||
|
catSetFrequency(deviceCenterFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -296,6 +343,10 @@ void AudioCATSISOCATWorker::pollingTick()
|
|||||||
freq_t freq; // double
|
freq_t freq; // double
|
||||||
int retcode = rig_get_freq(m_rig, RIG_VFO_CURR, &freq);
|
int retcode = rig_get_freq(m_rig, RIG_VFO_CURR, &freq);
|
||||||
|
|
||||||
|
if (m_settings.m_transverterMode) {
|
||||||
|
freq += m_settings.m_transverterDeltaFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
if (retcode == RIG_OK)
|
if (retcode == RIG_OK)
|
||||||
{
|
{
|
||||||
// qDebug("AudioCATSISOCATWorker::pollingTick: %f %lu", freq, m_frequency);
|
// qDebug("AudioCATSISOCATWorker::pollingTick: %f %lu", freq, m_frequency);
|
||||||
|
@ -71,6 +71,25 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgSetRxSampleRate : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
int getSampleRate() const { return m_sampleRate; }
|
||||||
|
|
||||||
|
static MsgSetRxSampleRate* create(int sampleRate) {
|
||||||
|
return new MsgSetRxSampleRate(sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_sampleRate;
|
||||||
|
|
||||||
|
MsgSetRxSampleRate(int sampleRate) :
|
||||||
|
Message(),
|
||||||
|
m_sampleRate(sampleRate)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
class MsgReportFrequency : public Message {
|
class MsgReportFrequency : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
@ -117,6 +136,7 @@ private:
|
|||||||
QTimer *m_pollTimer;
|
QTimer *m_pollTimer;
|
||||||
bool m_ptt;
|
bool m_ptt;
|
||||||
uint64_t m_frequency;
|
uint64_t m_frequency;
|
||||||
|
int m_rxSampleRate;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
@ -424,6 +424,9 @@ void AudioCATSISOGUI::displaySettings()
|
|||||||
{
|
{
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
|
|
||||||
|
ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
|
||||||
|
ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
|
||||||
|
ui->transverter->setIQOrder(m_settings.m_iqOrder);
|
||||||
ui->rxDeviceLabel->setText(m_settings.m_rxDeviceName);
|
ui->rxDeviceLabel->setText(m_settings.m_rxDeviceName);
|
||||||
ui->txDeviceLabel->setText(m_settings.m_txDeviceName);
|
ui->txDeviceLabel->setText(m_settings.m_txDeviceName);
|
||||||
ui->dcBlock->setChecked(m_settings.m_dcBlock);
|
ui->dcBlock->setChecked(m_settings.m_dcBlock);
|
||||||
|
@ -73,6 +73,8 @@ void AudioCATSISOSettings::resetToDefaults()
|
|||||||
m_pttSpectrumLink = true;
|
m_pttSpectrumLink = true;
|
||||||
m_rxCenterFrequency = 14200000;
|
m_rxCenterFrequency = 14200000;
|
||||||
m_txCenterFrequency = 14200000;
|
m_txCenterFrequency = 14200000;
|
||||||
|
m_transverterMode = false;
|
||||||
|
m_transverterDeltaFrequency = 0;
|
||||||
m_rxDeviceName = "";
|
m_rxDeviceName = "";
|
||||||
m_rxVolume = 1.0f;
|
m_rxVolume = 1.0f;
|
||||||
m_log2Decim = 0;
|
m_log2Decim = 0;
|
||||||
@ -106,6 +108,8 @@ AudioCATSISOSettings::AudioCATSISOSettings(const AudioCATSISOSettings& other)
|
|||||||
m_pttSpectrumLink = other.m_pttSpectrumLink;
|
m_pttSpectrumLink = other.m_pttSpectrumLink;
|
||||||
m_rxCenterFrequency = other.m_rxCenterFrequency;
|
m_rxCenterFrequency = other.m_rxCenterFrequency;
|
||||||
m_txCenterFrequency = other.m_txCenterFrequency;
|
m_txCenterFrequency = other.m_txCenterFrequency;
|
||||||
|
m_transverterMode = other.m_transverterMode;
|
||||||
|
m_transverterDeltaFrequency = other.m_transverterDeltaFrequency;
|
||||||
m_rxDeviceName = other.m_rxDeviceName;
|
m_rxDeviceName = other.m_rxDeviceName;
|
||||||
m_rxVolume = other.m_rxVolume;
|
m_rxVolume = other.m_rxVolume;
|
||||||
m_log2Decim = other.m_log2Decim;
|
m_log2Decim = other.m_log2Decim;
|
||||||
@ -144,6 +148,8 @@ QByteArray AudioCATSISOSettings::serialize() const
|
|||||||
s.writeBool(6, m_dcBlock);
|
s.writeBool(6, m_dcBlock);
|
||||||
s.writeBool(7, m_iqCorrection);
|
s.writeBool(7, m_iqCorrection);
|
||||||
s.writeS32(8, (int) m_fcPosRx);
|
s.writeS32(8, (int) m_fcPosRx);
|
||||||
|
s.writeBool(9, m_transverterMode);
|
||||||
|
s.writeS64(10, m_transverterDeltaFrequency);
|
||||||
|
|
||||||
s.writeString(21, m_txDeviceName);
|
s.writeString(21, m_txDeviceName);
|
||||||
s.writeU64(22, m_txCenterFrequency);
|
s.writeU64(22, m_txCenterFrequency);
|
||||||
@ -195,6 +201,8 @@ bool AudioCATSISOSettings::deserialize(const QByteArray& data)
|
|||||||
d.readBool(7, &m_iqCorrection, false);
|
d.readBool(7, &m_iqCorrection, false);
|
||||||
d.readS32(8, &intval, 2);
|
d.readS32(8, &intval, 2);
|
||||||
m_fcPosRx = (fcPos_t) intval;
|
m_fcPosRx = (fcPos_t) intval;
|
||||||
|
d.readBool(9, &m_transverterMode, false);
|
||||||
|
d.readS64(10, &m_transverterDeltaFrequency, 0);
|
||||||
|
|
||||||
d.readString(21, &m_txDeviceName, "");
|
d.readString(21, &m_txDeviceName, "");
|
||||||
d.readU64(22, &m_txCenterFrequency, 14200000);
|
d.readU64(22, &m_txCenterFrequency, 14200000);
|
||||||
@ -239,6 +247,13 @@ bool AudioCATSISOSettings::deserialize(const QByteArray& data)
|
|||||||
|
|
||||||
void AudioCATSISOSettings::applySettings(const QStringList& settingsKeys, const AudioCATSISOSettings& settings)
|
void AudioCATSISOSettings::applySettings(const QStringList& settingsKeys, const AudioCATSISOSettings& settings)
|
||||||
{
|
{
|
||||||
|
if (settingsKeys.contains("transverterMode")) {
|
||||||
|
m_transverterMode = settings.m_transverterMode;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||||
|
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("rxDeviceName")) {
|
if (settingsKeys.contains("rxDeviceName")) {
|
||||||
m_rxDeviceName = settings.m_rxDeviceName;
|
m_rxDeviceName = settings.m_rxDeviceName;
|
||||||
}
|
}
|
||||||
@ -332,6 +347,13 @@ QString AudioCATSISOSettings::getDebugString(const QStringList& settingsKeys, bo
|
|||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
|
||||||
|
if (settingsKeys.contains("transverterMode") || force) {
|
||||||
|
ostr << " m_transverterMode: " << m_transverterMode;
|
||||||
|
}
|
||||||
|
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||||
|
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
if (settingsKeys.contains("rxDeviceName") || force) {
|
if (settingsKeys.contains("rxDeviceName") || force) {
|
||||||
ostr << " m_rxDeviceName: " << m_rxDeviceName.toStdString();
|
ostr << " m_rxDeviceName: " << m_rxDeviceName.toStdString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user