mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
SSB mod: moved AF input mode in settings structure
This commit is contained in:
parent
b151b00182
commit
e3815e4076
@ -34,7 +34,6 @@ MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureSSBMod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureChannelizer, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureFileSourceName, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureFileSourceSeek, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureAFInput, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgConfigureFileSourceStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamData, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SSBMod::MsgReportFileSourceStreamTiming, Message)
|
||||
@ -62,7 +61,6 @@ SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) :
|
||||
m_fileSize(0),
|
||||
m_recordLength(0),
|
||||
m_sampleRate(48000),
|
||||
m_afInput(SSBModInputNone),
|
||||
m_levelCalcCount(0),
|
||||
m_peakLevel(0.0f),
|
||||
m_levelSum(0.0f),
|
||||
@ -211,9 +209,9 @@ void SSBMod::pullAF(Complex& sample)
|
||||
int decim = 1<<(m_settings.m_spanLog2 - 1);
|
||||
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||
|
||||
switch (m_afInput)
|
||||
switch (m_settings.m_modAFInput)
|
||||
{
|
||||
case SSBModInputTone:
|
||||
case SSBModSettings::SSBModInputTone:
|
||||
if (m_settings.m_dsb)
|
||||
{
|
||||
Real t = m_toneNco.next()/1.25;
|
||||
@ -229,7 +227,7 @@ void SSBMod::pullAF(Complex& sample)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSBModInputFile:
|
||||
case SSBModSettings::SSBModInputFile:
|
||||
// Monaural (mono):
|
||||
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
|
||||
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
|
||||
@ -295,7 +293,7 @@ void SSBMod::pullAF(Complex& sample)
|
||||
ci.imag(0.0f);
|
||||
}
|
||||
break;
|
||||
case SSBModInputAudio:
|
||||
case SSBModSettings::SSBModInputAudio:
|
||||
if (m_settings.m_audioBinaural)
|
||||
{
|
||||
if (m_settings.m_audioFlipChannels)
|
||||
@ -326,7 +324,7 @@ void SSBMod::pullAF(Complex& sample)
|
||||
}
|
||||
|
||||
break;
|
||||
case SSBModInputCWTone:
|
||||
case SSBModSettings::SSBModInputCWTone:
|
||||
Real fadeFactor;
|
||||
|
||||
if (m_cwKeyer.getSample())
|
||||
@ -376,12 +374,13 @@ void SSBMod::pullAF(Complex& sample)
|
||||
}
|
||||
|
||||
break;
|
||||
case SSBModInputNone:
|
||||
case SSBModSettings::SSBModInputNone:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((m_afInput == SSBModInputFile) || (m_afInput == SSBModInputAudio)) // real audio
|
||||
if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputFile)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAudio)) // real audio
|
||||
{
|
||||
if (m_settings.m_dsb)
|
||||
{
|
||||
@ -439,7 +438,8 @@ void SSBMod::pullAF(Complex& sample)
|
||||
}
|
||||
}
|
||||
} // Real audio
|
||||
else if ((m_afInput == SSBModInputTone) || (m_afInput == SSBModInputCWTone)) // tone
|
||||
else if ((m_settings.m_modAFInput == SSBModSettings::SSBModInputTone)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputCWTone)) // tone
|
||||
{
|
||||
m_sum += sample;
|
||||
|
||||
@ -565,13 +565,6 @@ bool SSBMod::handleMessage(const Message& cmd)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureAFInput::match(cmd))
|
||||
{
|
||||
MsgConfigureAFInput& conf = (MsgConfigureAFInput&) cmd;
|
||||
m_afInput = conf.getAFInput();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
|
||||
{
|
||||
std::size_t samplesCount;
|
||||
|
@ -44,15 +44,6 @@ class SSBMod : public BasebandSampleSource, public ChannelSourceAPI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
SSBModInputNone,
|
||||
SSBModInputTone,
|
||||
SSBModInputFile,
|
||||
SSBModInputAudio,
|
||||
SSBModInputCWTone
|
||||
} SSBModInputAF;
|
||||
|
||||
class MsgConfigureSSBMod : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -158,27 +149,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgConfigureAFInput : public Message
|
||||
{
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
SSBModInputAF getAFInput() const { return m_afInput; }
|
||||
|
||||
static MsgConfigureAFInput* create(SSBModInputAF afInput)
|
||||
{
|
||||
return new MsgConfigureAFInput(afInput);
|
||||
}
|
||||
|
||||
private:
|
||||
SSBModInputAF m_afInput;
|
||||
|
||||
MsgConfigureAFInput(SSBModInputAF afInput) :
|
||||
Message(),
|
||||
m_afInput(afInput)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportFileSourceStreamTiming : public Message
|
||||
{
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -319,7 +289,6 @@ private:
|
||||
quint32 m_recordLength; //!< record length in seconds computed from file size
|
||||
int m_sampleRate;
|
||||
|
||||
SSBModInputAF m_afInput;
|
||||
quint32 m_levelCalcCount;
|
||||
Real m_peakLevel;
|
||||
Real m_levelSum;
|
||||
|
@ -233,9 +233,8 @@ void SSBModGUI::on_play_toggled(bool checked)
|
||||
ui->tone->setEnabled(!checked); // release other source inputs
|
||||
ui->morseKeyer->setEnabled(!checked);
|
||||
ui->mic->setEnabled(!checked);
|
||||
m_modAFInput = checked ? SSBMod::SSBModInputFile : SSBMod::SSBModInputNone;
|
||||
SSBMod::MsgConfigureAFInput* message = SSBMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||
m_ssbMod->getInputMessageQueue()->push(message);
|
||||
m_settings.m_modAFInput = checked ? SSBModSettings::SSBModInputFile : SSBModSettings::SSBModInputNone;
|
||||
applySettings();
|
||||
ui->navTimeSlider->setEnabled(!checked);
|
||||
m_enableNavTime = !checked;
|
||||
}
|
||||
@ -245,9 +244,8 @@ void SSBModGUI::on_tone_toggled(bool checked)
|
||||
ui->play->setEnabled(!checked); // release other source inputs
|
||||
ui->morseKeyer->setEnabled(!checked);
|
||||
ui->mic->setEnabled(!checked);
|
||||
m_modAFInput = checked ? SSBMod::SSBModInputTone : SSBMod::SSBModInputNone;
|
||||
SSBMod::MsgConfigureAFInput* message = SSBMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||
m_ssbMod->getInputMessageQueue()->push(message);
|
||||
m_settings.m_modAFInput = checked ? SSBModSettings::SSBModInputTone : SSBModSettings::SSBModInputNone;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void SSBModGUI::on_morseKeyer_toggled(bool checked)
|
||||
@ -255,9 +253,8 @@ void SSBModGUI::on_morseKeyer_toggled(bool checked)
|
||||
ui->play->setEnabled(!checked); // release other source inputs
|
||||
ui->tone->setEnabled(!checked); // release other source inputs
|
||||
ui->mic->setEnabled(!checked);
|
||||
m_modAFInput = checked ? SSBMod::SSBModInputCWTone : SSBMod::SSBModInputNone;
|
||||
SSBMod::MsgConfigureAFInput* message = SSBMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||
m_ssbMod->getInputMessageQueue()->push(message);
|
||||
m_settings.m_modAFInput = checked ? SSBModSettings::SSBModInputCWTone : SSBModSettings::SSBModInputNone;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void SSBModGUI::on_mic_toggled(bool checked)
|
||||
@ -265,9 +262,8 @@ void SSBModGUI::on_mic_toggled(bool checked)
|
||||
ui->play->setEnabled(!checked); // release other source inputs
|
||||
ui->morseKeyer->setEnabled(!checked);
|
||||
ui->tone->setEnabled(!checked); // release other source inputs
|
||||
m_modAFInput = checked ? SSBMod::SSBModInputAudio : SSBMod::SSBModInputNone;
|
||||
SSBMod::MsgConfigureAFInput* message = SSBMod::MsgConfigureAFInput::create(m_modAFInput);
|
||||
m_ssbMod->getInputMessageQueue()->push(message);
|
||||
m_settings.m_modAFInput = checked ? SSBModSettings::SSBModInputAudio : SSBModSettings::SSBModInputNone;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void SSBModGUI::on_agc_toggled(bool checked)
|
||||
@ -363,8 +359,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
m_recordSampleRate(48000),
|
||||
m_samplesCount(0),
|
||||
m_tickCount(0),
|
||||
m_enableNavTime(false),
|
||||
m_modAFInput(SSBMod::SSBModInputNone)
|
||||
m_enableNavTime(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
@ -648,6 +643,20 @@ void SSBModGUI::displaySettings()
|
||||
ui->volume->setValue(m_settings.m_volumeFactor * 10.0);
|
||||
ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
|
||||
|
||||
ui->tone->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputTone)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
|
||||
ui->mic->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputAudio)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
|
||||
ui->play->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputFile)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
|
||||
ui->morseKeyer->setEnabled((m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputCWTone)
|
||||
|| (m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputNone));
|
||||
|
||||
ui->tone->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputTone);
|
||||
ui->mic->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputAudio);
|
||||
ui->play->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputFile);
|
||||
ui->morseKeyer->setChecked(m_settings.m_modAFInput == SSBModSettings::SSBModInputAF::SSBModInputCWTone);
|
||||
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
@ -695,7 +704,7 @@ void SSBModGUI::tick()
|
||||
m_channelPowerDbAvg(powDb);
|
||||
ui->channelPower->setText(tr("%1 dB").arg(m_channelPowerDbAvg.asDouble(), 0, 'f', 1));
|
||||
|
||||
if (((++m_tickCount & 0xf) == 0) && (m_modAFInput == SSBMod::SSBModInputFile))
|
||||
if (((++m_tickCount & 0xf) == 0) && (m_settings.m_modAFInput == SSBModSettings::SSBModInputFile))
|
||||
{
|
||||
SSBMod::MsgConfigureFileSourceStreamTiming* message = SSBMod::MsgConfigureFileSourceStreamTiming::create();
|
||||
m_ssbMod->getInputMessageQueue()->push(message);
|
||||
|
@ -77,7 +77,6 @@ private:
|
||||
int m_samplesCount;
|
||||
std::size_t m_tickCount;
|
||||
bool m_enableNavTime;
|
||||
SSBMod::SSBModInputAF m_modAFInput;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
QIcon m_iconDSBUSB;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
|
||||
QString("SSB Modulator"),
|
||||
QString("3.12.0"),
|
||||
QString("3.14.2"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -66,6 +66,7 @@ void SSBModSettings::resetToDefaults()
|
||||
m_agcThresholdDelay = 2400;
|
||||
m_rgbColor = QColor(0, 255, 0).rgb();
|
||||
m_title = "SSB Modulator";
|
||||
m_modAFInput = SSBModInputAF::SSBModInputNone;
|
||||
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;
|
||||
}
|
||||
|
||||
@ -105,6 +106,7 @@ QByteArray SSBModSettings::serialize() const
|
||||
|
||||
s.writeString(19, m_title);
|
||||
s.writeString(20, m_audioDeviceName);
|
||||
s.writeS32(21, (int) m_modAFInput);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -172,6 +174,13 @@ bool SSBModSettings::deserialize(const QByteArray& data)
|
||||
d.readString(19, &m_title, "SSB Modulator");
|
||||
d.readString(20, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
||||
|
||||
d.readS32(21, &tmp, 0);
|
||||
if ((tmp < 0) || (tmp > (int) SSBModInputAF::SSBModInputTone)) {
|
||||
m_modAFInput = SSBModInputNone;
|
||||
} else {
|
||||
m_modAFInput = (SSBModInputAF) tmp;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -25,6 +25,15 @@ class Serializable;
|
||||
|
||||
struct SSBModSettings
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
SSBModInputNone,
|
||||
SSBModInputTone,
|
||||
SSBModInputFile,
|
||||
SSBModInputAudio,
|
||||
SSBModInputCWTone
|
||||
} SSBModInputAF;
|
||||
|
||||
static const int m_nbAGCTimeConstants;
|
||||
static const int m_agcTimeConstant[];
|
||||
|
||||
@ -50,6 +59,7 @@ struct SSBModSettings
|
||||
quint32 m_rgbColor;
|
||||
|
||||
QString m_title;
|
||||
SSBModInputAF m_modAFInput;
|
||||
QString m_audioDeviceName;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
|
Loading…
Reference in New Issue
Block a user