mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
PlutoSDR output: use settings in modulator
This commit is contained in:
parent
179c1a00c4
commit
b635e3c0ee
@ -27,7 +27,6 @@
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureAMMod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureChannelizer, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureAMModPrivate, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureFileSourceName, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureFileSourceSeek, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureAFInput, Message)
|
||||
@ -52,13 +51,6 @@ AMMod::AMMod() :
|
||||
{
|
||||
setObjectName("AMMod");
|
||||
|
||||
// m_config.m_outputSampleRate = 48000;
|
||||
// m_config.m_inputFrequencyOffset = 0;
|
||||
// m_config.m_rfBandwidth = 12500;
|
||||
// m_config.m_modFactor = 0.2f;
|
||||
// m_config.m_toneFrequency = 1000.0f;
|
||||
// m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
||||
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
|
||||
@ -83,18 +75,6 @@ AMMod::~AMMod()
|
||||
DSPEngine::instance()->removeAudioSource(&m_audioFifo);
|
||||
}
|
||||
|
||||
void AMMod::configure(MessageQueue* messageQueue,
|
||||
Real rfBandwidth,
|
||||
float modFactor,
|
||||
float toneFrequency,
|
||||
float volumeFactor,
|
||||
bool audioMute,
|
||||
bool playLoop)
|
||||
{
|
||||
Message* cmd = MsgConfigureAMModPrivate::create(rfBandwidth, modFactor, toneFrequency, volumeFactor, audioMute, playLoop);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
void AMMod::pull(Sample& sample)
|
||||
{
|
||||
if (m_settings.m_channelMute)
|
||||
@ -270,10 +250,6 @@ bool AMMod::handleMessage(const Message& cmd)
|
||||
{
|
||||
UpChannelizer::MsgChannelizerNotification& notif = (UpChannelizer::MsgChannelizerNotification&) cmd;
|
||||
|
||||
// m_config.m_basebandSampleRate = notif.getBasebandSampleRate();
|
||||
// m_config.m_outputSampleRate = notif.getSampleRate();
|
||||
// m_config.m_inputFrequencyOffset = notif.getFrequencyOffset();
|
||||
|
||||
AMModSettings settings = m_settings;
|
||||
|
||||
settings.m_basebandSampleRate = notif.getBasebandSampleRate();
|
||||
@ -315,31 +291,6 @@ bool AMMod::handleMessage(const Message& cmd)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureAMModPrivate::match(cmd))
|
||||
{
|
||||
MsgConfigureAMModPrivate& cfg = (MsgConfigureAMModPrivate&) cmd;
|
||||
|
||||
AMModSettings settings = m_settings;
|
||||
|
||||
settings.m_rfBandwidth = cfg.getRFBandwidth();
|
||||
settings.m_modFactor = cfg.getModFactor();
|
||||
settings.m_toneFrequency = cfg.getToneFrequency();
|
||||
settings.m_volumeFactor = cfg.getVolumeFactor();
|
||||
settings.m_channelMute = cfg.getChannelMute();
|
||||
settings.m_playLoop = cfg.getPlayLoop();
|
||||
|
||||
applySettings(settings);
|
||||
|
||||
qDebug() << "AMMod::handleMessage: MsgConfigureAMModPrivate:"
|
||||
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
||||
<< " m_modFactor: " << settings.m_modFactor
|
||||
<< " m_toneFrequency: " << settings.m_toneFrequency
|
||||
<< " m_volumeFactor: " << settings.m_volumeFactor
|
||||
<< " m_audioMute: " << settings.m_channelMute
|
||||
<< " m_playLoop: " << settings.m_playLoop;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureFileSourceName::match(cmd))
|
||||
{
|
||||
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd;
|
||||
@ -384,64 +335,6 @@ bool AMMod::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
//void AMMod::apply()
|
||||
//{
|
||||
//
|
||||
// if ((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||
|
||||
// (m_config.m_outputSampleRate != m_running.m_outputSampleRate))
|
||||
// {
|
||||
// m_settingsMutex.lock();
|
||||
// m_carrierNco.setFreq(m_config.m_inputFrequencyOffset, m_config.m_outputSampleRate);
|
||||
// m_settingsMutex.unlock();
|
||||
// }
|
||||
//
|
||||
// if((m_config.m_outputSampleRate != m_running.m_outputSampleRate) ||
|
||||
// (m_config.m_rfBandwidth != m_running.m_rfBandwidth) ||
|
||||
// (m_config.m_audioSampleRate != m_running.m_audioSampleRate))
|
||||
// {
|
||||
// m_settingsMutex.lock();
|
||||
// m_interpolatorDistanceRemain = 0;
|
||||
// m_interpolatorConsumed = false;
|
||||
// m_interpolatorDistance = (Real) m_config.m_audioSampleRate / (Real) m_config.m_outputSampleRate;
|
||||
// m_interpolator.create(48, m_config.m_audioSampleRate, m_config.m_rfBandwidth / 2.2, 3.0);
|
||||
// m_settingsMutex.unlock();
|
||||
// }
|
||||
//
|
||||
// if ((m_config.m_toneFrequency != m_running.m_toneFrequency) ||
|
||||
// (m_config.m_audioSampleRate != m_running.m_audioSampleRate))
|
||||
// {
|
||||
// m_settingsMutex.lock();
|
||||
// m_toneNco.setFreq(m_config.m_toneFrequency, m_config.m_audioSampleRate);
|
||||
// m_settingsMutex.unlock();
|
||||
// }
|
||||
//
|
||||
// if (m_config.m_audioSampleRate != m_running.m_audioSampleRate)
|
||||
// {
|
||||
// m_cwKeyer.setSampleRate(m_config.m_audioSampleRate);
|
||||
// m_cwSmoother.setNbFadeSamples(m_config.m_audioSampleRate / 250); // 4 ms
|
||||
// }
|
||||
//
|
||||
// m_running.m_outputSampleRate = m_config.m_outputSampleRate;
|
||||
// m_running.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
|
||||
// m_running.m_rfBandwidth = m_config.m_rfBandwidth;
|
||||
// m_running.m_modFactor = m_config.m_modFactor;
|
||||
// m_running.m_toneFrequency = m_config.m_toneFrequency;
|
||||
// m_running.m_volumeFactor = m_config.m_volumeFactor;
|
||||
// m_running.m_audioSampleRate = m_config.m_audioSampleRate;
|
||||
// m_running.m_channelMute = m_config.m_channelMute;
|
||||
// m_running.m_playLoop = m_config.m_playLoop;
|
||||
//
|
||||
// m_settings.m_outputSampleRate = m_config.m_outputSampleRate;
|
||||
// m_settings.m_inputFrequencyOffset = m_config.m_inputFrequencyOffset;
|
||||
// m_settings.m_rfBandwidth = m_config.m_rfBandwidth;
|
||||
// m_settings.m_modFactor = m_config.m_modFactor;
|
||||
// m_settings.m_toneFrequency = m_config.m_toneFrequency;
|
||||
// m_settings.m_volumeFactor = m_config.m_volumeFactor;
|
||||
// m_settings.m_audioSampleRate = m_config.m_audioSampleRate;
|
||||
// m_settings.m_channelMute = m_config.m_channelMute;
|
||||
// m_settings.m_playLoop = m_config.m_playLoop;
|
||||
//}
|
||||
|
||||
void AMMod::openFileStream()
|
||||
{
|
||||
if (m_ifstream.is_open()) {
|
||||
|
@ -224,14 +224,6 @@ public:
|
||||
AMMod();
|
||||
~AMMod();
|
||||
|
||||
void configure(MessageQueue* messageQueue,
|
||||
Real rfBandwidth,
|
||||
float modFactor,
|
||||
float toneFrequency,
|
||||
float volumeFactor,
|
||||
bool channelMute,
|
||||
bool playLoop);
|
||||
|
||||
virtual void pull(Sample& sample);
|
||||
virtual void pullAudio(int nbSamples);
|
||||
virtual void start();
|
||||
@ -253,79 +245,11 @@ signals:
|
||||
|
||||
|
||||
private:
|
||||
class MsgConfigureAMModPrivate : public Message
|
||||
{
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||
float getModFactor() const { return m_modFactor; }
|
||||
float getToneFrequency() const { return m_toneFrequency; }
|
||||
float getVolumeFactor() const { return m_volumeFactor; }
|
||||
bool getChannelMute() const { return m_channelMute; }
|
||||
bool getPlayLoop() const { return m_playLoop; }
|
||||
|
||||
static MsgConfigureAMModPrivate* create(Real rfBandwidth, float modFactor, float toneFreqeuncy, float volumeFactor, bool channelMute, bool playLoop)
|
||||
{
|
||||
return new MsgConfigureAMModPrivate(rfBandwidth, modFactor, toneFreqeuncy, volumeFactor, channelMute, playLoop);
|
||||
}
|
||||
|
||||
private:
|
||||
Real m_rfBandwidth;
|
||||
float m_modFactor;
|
||||
float m_toneFrequency;
|
||||
float m_volumeFactor;
|
||||
bool m_channelMute;
|
||||
bool m_playLoop;
|
||||
|
||||
MsgConfigureAMModPrivate(Real rfBandwidth, float modFactor, float toneFrequency, float volumeFactor, bool channelMute, bool playLoop) :
|
||||
Message(),
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_modFactor(modFactor),
|
||||
m_toneFrequency(toneFrequency),
|
||||
m_volumeFactor(volumeFactor),
|
||||
m_channelMute(channelMute),
|
||||
m_playLoop(playLoop)
|
||||
{ }
|
||||
};
|
||||
|
||||
//=================================================================
|
||||
|
||||
enum RateState {
|
||||
RSInitialFill,
|
||||
RSRunning
|
||||
};
|
||||
|
||||
struct Config {
|
||||
int m_basebandSampleRate;
|
||||
int m_outputSampleRate;
|
||||
qint64 m_inputFrequencyOffset;
|
||||
Real m_rfBandwidth;
|
||||
float m_modFactor;
|
||||
float m_toneFrequency;
|
||||
float m_volumeFactor;
|
||||
quint32 m_audioSampleRate;
|
||||
bool m_channelMute;
|
||||
bool m_playLoop;
|
||||
|
||||
Config() :
|
||||
m_basebandSampleRate(0),
|
||||
m_outputSampleRate(-1),
|
||||
m_inputFrequencyOffset(0),
|
||||
m_rfBandwidth(-1),
|
||||
m_modFactor(0.2f),
|
||||
m_toneFrequency(100),
|
||||
m_volumeFactor(1.0f),
|
||||
m_audioSampleRate(0),
|
||||
m_channelMute(false),
|
||||
m_playLoop(false)
|
||||
{ }
|
||||
};
|
||||
|
||||
//=================================================================
|
||||
|
||||
// Config m_config;
|
||||
// Config m_running;
|
||||
AMModSettings m_settings;
|
||||
|
||||
NCO m_carrierNco;
|
||||
|
@ -88,55 +88,6 @@ bool AMModGUI::deserialize(const QByteArray& data)
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
// SimpleDeserializer d(data);
|
||||
//
|
||||
// if(!d.isValid())
|
||||
// {
|
||||
// resetToDefaults();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if(d.getVersion() == 1)
|
||||
// {
|
||||
// QByteArray bytetmp;
|
||||
// quint32 u32tmp;
|
||||
// qint32 tmp;
|
||||
//
|
||||
// blockApplySettings(true);
|
||||
// m_channelMarker.blockSignals(true);
|
||||
//
|
||||
// d.readS32(1, &tmp, 0);
|
||||
// m_channelMarker.setCenterFrequency(tmp);
|
||||
// d.readS32(2, &tmp, 4);
|
||||
// ui->rfBW->setValue(tmp);
|
||||
// d.readS32(3, &tmp, 100);
|
||||
// ui->toneFrequency->setValue(tmp);
|
||||
// d.readS32(4, &tmp, 20);
|
||||
// ui->modPercent->setValue(tmp);
|
||||
//
|
||||
// if(d.readU32(5, &u32tmp))
|
||||
// {
|
||||
// m_channelMarker.setColor(u32tmp);
|
||||
// }
|
||||
//
|
||||
// d.readS32(6, &tmp, 10);
|
||||
// ui->volume->setValue(tmp);
|
||||
//
|
||||
// d.readBlob(7, &bytetmp);
|
||||
// ui->cwKeyerGUI->deserialize(bytetmp);
|
||||
//
|
||||
// blockApplySettings(false);
|
||||
// m_channelMarker.blockSignals(false);
|
||||
//
|
||||
// applySettings();
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// resetToDefaults();
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
bool AMModGUI::handleMessage(const Message& message)
|
||||
@ -351,7 +302,6 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* pare
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||
|
||||
//m_channelMarker = new ChannelMarker(this);
|
||||
m_channelMarker.setColor(Qt::yellow);
|
||||
m_channelMarker.setBandwidth(5000);
|
||||
m_channelMarker.setCenterFrequency(0);
|
||||
@ -388,7 +338,6 @@ AMModGUI::~AMModGUI()
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
delete m_amMod;
|
||||
//delete m_channelMarker;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -411,14 +360,6 @@ void AMModGUI::applySettings(bool force __attribute((unused)))
|
||||
|
||||
AMMod::MsgConfigureAMMod* message = AMMod::MsgConfigureAMMod::create( m_settings, force);
|
||||
m_amMod->getInputMessageQueue()->push(message);
|
||||
|
||||
// m_amMod->configure(m_amMod->getInputMessageQueue(),
|
||||
// m_settings.m_rfBandwidth,
|
||||
// m_settings.m_modFactor,
|
||||
// m_settings.m_toneFrequency,
|
||||
// m_settings.m_volumeFactor,
|
||||
// m_settings.m_channelMute,
|
||||
// m_settings.m_playLoop);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user