mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 12:22:00 -05:00
NFM Modulator: added CW keyer
This commit is contained in:
parent
e4e2eea9d5
commit
cfce93c498
@ -67,8 +67,7 @@ AMMod::AMMod() :
|
|||||||
m_toneNco.setFreq(1000.0, m_config.m_audioSampleRate);
|
m_toneNco.setFreq(1000.0, m_config.m_audioSampleRate);
|
||||||
DSPEngine::instance()->addAudioSource(&m_audioFifo);
|
DSPEngine::instance()->addAudioSource(&m_audioFifo);
|
||||||
|
|
||||||
// test CW keyer
|
// CW keyer
|
||||||
// TODO: link to CW keyer GUI
|
|
||||||
m_cwKeyer.setSampleRate(m_config.m_audioSampleRate);
|
m_cwKeyer.setSampleRate(m_config.m_audioSampleRate);
|
||||||
m_cwKeyer.setWPM(13);
|
m_cwKeyer.setWPM(13);
|
||||||
m_cwKeyer.setMode(CWKeyer::CWNone);
|
m_cwKeyer.setMode(CWKeyer::CWNone);
|
||||||
|
@ -270,13 +270,6 @@ void AMModGUI::on_morseKeyer_toggled(bool checked)
|
|||||||
ui->play->setEnabled(!checked); // release other source inputs
|
ui->play->setEnabled(!checked); // release other source inputs
|
||||||
ui->tone->setEnabled(!checked); // release other source inputs
|
ui->tone->setEnabled(!checked); // release other source inputs
|
||||||
ui->mic->setEnabled(!checked);
|
ui->mic->setEnabled(!checked);
|
||||||
|
|
||||||
if (checked) {
|
|
||||||
ui->cwKeyerGUI->grabKeyboard();
|
|
||||||
} else {
|
|
||||||
ui->cwKeyerGUI->releaseKeyboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_modAFInput = checked ? AMMod::AMModInputCWTone : AMMod::AMModInputNone;
|
m_modAFInput = checked ? AMMod::AMModInputCWTone : AMMod::AMModInputNone;
|
||||||
AMMod::MsgConfigureAFInput* message = AMMod::MsgConfigureAFInput::create(m_modAFInput);
|
AMMod::MsgConfigureAFInput* message = AMMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||||
m_amMod->getInputMessageQueue()->push(message);
|
m_amMod->getInputMessageQueue()->push(message);
|
||||||
|
@ -68,6 +68,11 @@ NFMMod::NFMMod() :
|
|||||||
|
|
||||||
m_toneNco.setFreq(1000.0, m_config.m_audioSampleRate);
|
m_toneNco.setFreq(1000.0, m_config.m_audioSampleRate);
|
||||||
DSPEngine::instance()->addAudioSource(&m_audioFifo);
|
DSPEngine::instance()->addAudioSource(&m_audioFifo);
|
||||||
|
|
||||||
|
// CW keyer
|
||||||
|
m_cwKeyer.setSampleRate(m_config.m_audioSampleRate);
|
||||||
|
m_cwKeyer.setWPM(13);
|
||||||
|
m_cwKeyer.setMode(CWKeyer::CWNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
NFMMod::~NFMMod()
|
NFMMod::~NFMMod()
|
||||||
@ -182,6 +187,17 @@ void NFMMod::pullAF(Real& sample)
|
|||||||
m_audioFifo.read(reinterpret_cast<quint8*>(audioSample), 1, 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(audioSample), 1, 10);
|
||||||
sample = ((audioSample[0] + audioSample[1]) / 65536.0f) * m_running.m_volumeFactor;
|
sample = ((audioSample[0] + audioSample[1]) / 65536.0f) * m_running.m_volumeFactor;
|
||||||
break;
|
break;
|
||||||
|
case NFMModInputCWTone:
|
||||||
|
if (m_cwKeyer.getSample())
|
||||||
|
{
|
||||||
|
sample = m_toneNco.next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sample = 0.0f;
|
||||||
|
m_toneNco.setPhase(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case NFMModInputNone:
|
case NFMModInputNone:
|
||||||
default:
|
default:
|
||||||
sample = 0.0f;
|
sample = 0.0f;
|
||||||
@ -347,6 +363,11 @@ void NFMMod::apply()
|
|||||||
m_settingsMutex.unlock();
|
m_settingsMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_config.m_audioSampleRate != m_running.m_audioSampleRate)
|
||||||
|
{
|
||||||
|
m_cwKeyer.setSampleRate(m_config.m_audioSampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
m_running.m_outputSampleRate = m_config.m_outputSampleRate;
|
m_running.m_outputSampleRate = m_config.m_outputSampleRate;
|
||||||
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
|
m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
|
||||||
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
|
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "dsp/bandpass.h"
|
#include "dsp/bandpass.h"
|
||||||
#include "dsp/movingaverage.h"
|
#include "dsp/movingaverage.h"
|
||||||
#include "dsp/agc.h"
|
#include "dsp/agc.h"
|
||||||
|
#include "dsp/cwkeyer.h"
|
||||||
#include "audio/audiofifo.h"
|
#include "audio/audiofifo.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
|
||||||
@ -41,7 +42,8 @@ public:
|
|||||||
NFMModInputNone,
|
NFMModInputNone,
|
||||||
NFMModInputTone,
|
NFMModInputTone,
|
||||||
NFMModInputFile,
|
NFMModInputFile,
|
||||||
NFMModInputAudio
|
NFMModInputAudio,
|
||||||
|
NFMModInputCWTone
|
||||||
} NFMModInputAF;
|
} NFMModInputAF;
|
||||||
|
|
||||||
class MsgConfigureFileSourceName : public Message
|
class MsgConfigureFileSourceName : public Message
|
||||||
@ -191,6 +193,8 @@ public:
|
|||||||
|
|
||||||
Real getMagSq() const { return m_magsq; }
|
Real getMagSq() const { return m_magsq; }
|
||||||
|
|
||||||
|
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* Level changed
|
* Level changed
|
||||||
@ -317,6 +321,7 @@ private:
|
|||||||
quint32 m_levelCalcCount;
|
quint32 m_levelCalcCount;
|
||||||
Real m_peakLevel;
|
Real m_peakLevel;
|
||||||
Real m_levelSum;
|
Real m_levelSum;
|
||||||
|
CWKeyer m_cwKeyer;
|
||||||
static const int m_levelNbSamples;
|
static const int m_levelNbSamples;
|
||||||
|
|
||||||
void apply();
|
void apply();
|
||||||
|
@ -253,6 +253,7 @@ void NFMModGUI::on_play_toggled(bool checked)
|
|||||||
{
|
{
|
||||||
ui->tone->setEnabled(!checked); // release other source inputs
|
ui->tone->setEnabled(!checked); // release other source inputs
|
||||||
ui->mic->setEnabled(!checked);
|
ui->mic->setEnabled(!checked);
|
||||||
|
ui->morseKeyer->setEnabled(!checked);
|
||||||
m_modAFInput = checked ? NFMMod::NFMModInputFile : NFMMod::NFMModInputNone;
|
m_modAFInput = checked ? NFMMod::NFMModInputFile : NFMMod::NFMModInputNone;
|
||||||
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||||
m_nfmMod->getInputMessageQueue()->push(message);
|
m_nfmMod->getInputMessageQueue()->push(message);
|
||||||
@ -264,15 +265,27 @@ void NFMModGUI::on_tone_toggled(bool checked)
|
|||||||
{
|
{
|
||||||
ui->play->setEnabled(!checked); // release other source inputs
|
ui->play->setEnabled(!checked); // release other source inputs
|
||||||
ui->mic->setEnabled(!checked);
|
ui->mic->setEnabled(!checked);
|
||||||
|
ui->morseKeyer->setEnabled(!checked);
|
||||||
m_modAFInput = checked ? NFMMod::NFMModInputTone : NFMMod::NFMModInputNone;
|
m_modAFInput = checked ? NFMMod::NFMModInputTone : NFMMod::NFMModInputNone;
|
||||||
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||||
m_nfmMod->getInputMessageQueue()->push(message);
|
m_nfmMod->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NFMModGUI::on_morseKeyer_toggled(bool checked)
|
||||||
|
{
|
||||||
|
ui->tone->setEnabled(!checked); // release other source inputs
|
||||||
|
ui->mic->setEnabled(!checked);
|
||||||
|
ui->play->setEnabled(!checked);
|
||||||
|
m_modAFInput = checked ? NFMMod::NFMModInputCWTone : NFMMod::NFMModInputNone;
|
||||||
|
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||||
|
m_nfmMod->getInputMessageQueue()->push(message);
|
||||||
|
}
|
||||||
|
|
||||||
void NFMModGUI::on_mic_toggled(bool checked)
|
void NFMModGUI::on_mic_toggled(bool checked)
|
||||||
{
|
{
|
||||||
ui->play->setEnabled(!checked); // release other source inputs
|
ui->play->setEnabled(!checked); // release other source inputs
|
||||||
ui->tone->setEnabled(!checked); // release other source inputs
|
ui->tone->setEnabled(!checked); // release other source inputs
|
||||||
|
ui->morseKeyer->setEnabled(!checked);
|
||||||
m_modAFInput = checked ? NFMMod::NFMModInputAudio : NFMMod::NFMModInputNone;
|
m_modAFInput = checked ? NFMMod::NFMModInputAudio : NFMMod::NFMModInputNone;
|
||||||
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
NFMMod::MsgConfigureAFInput* message = NFMMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||||
m_nfmMod->getInputMessageQueue()->push(message);
|
m_nfmMod->getInputMessageQueue()->push(message);
|
||||||
@ -383,6 +396,8 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pa
|
|||||||
ui->tone->setChecked(false);
|
ui->tone->setChecked(false);
|
||||||
ui->mic->setChecked(false);
|
ui->mic->setChecked(false);
|
||||||
|
|
||||||
|
ui->cwKeyerGUI->setBuddies(m_nfmMod->getInputMessageQueue(), m_nfmMod->getCWKeyer());
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
|
|
||||||
connect(m_nfmMod->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(m_nfmMod->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
|
@ -68,6 +68,7 @@ private slots:
|
|||||||
void on_volume_valueChanged(int value);
|
void on_volume_valueChanged(int value);
|
||||||
void on_audioMute_toggled(bool checked);
|
void on_audioMute_toggled(bool checked);
|
||||||
void on_tone_toggled(bool checked);
|
void on_tone_toggled(bool checked);
|
||||||
|
void on_morseKeyer_toggled(bool checked);
|
||||||
void on_mic_toggled(bool checked);
|
void on_mic_toggled(bool checked);
|
||||||
void on_play_toggled(bool checked);
|
void on_play_toggled(bool checked);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>298</width>
|
<width>298</width>
|
||||||
<height>182</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -37,10 +37,10 @@
|
|||||||
<widget class="QWidget" name="settingsContainer" native="true">
|
<widget class="QWidget" name="settingsContainer" native="true">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>2</x>
|
||||||
<y>10</y>
|
<y>2</y>
|
||||||
<width>280</width>
|
<width>280</width>
|
||||||
<height>161</height>
|
<height>271</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -417,6 +417,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ButtonSwitch" name="morseKeyer">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Morse keyer at tone frequency</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||||
|
<normaloff>:/morsekey.png</normaloff>:/morsekey.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDial" name="toneFrequency">
|
<widget class="QDial" name="toneFrequency">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -507,6 +521,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="cwKeyerLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="CWKeyerGUI" name="cwKeyerGUI" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="fileNameLayout">
|
<layout class="QHBoxLayout" name="fileNameLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -697,6 +718,12 @@
|
|||||||
<header>gui/levelmeter.h</header>
|
<header>gui/levelmeter.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CWKeyerGUI</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/cwkeyergui.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user