Tx ph.1: fixed AM modulator

This commit is contained in:
f4exb 2016-10-24 01:27:23 +02:00
parent 8f70840561
commit 9f1b801d1a
4 changed files with 26 additions and 9 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
CMakeLists.txt.user*
build/*
build*
qtbuild/*
sdriq/*
presets/*

View File

@ -55,9 +55,9 @@ AMMod::~AMMod()
{
}
void AMMod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, int modPercent, bool audioMute)
void AMMod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute)
{
Message* cmd = MsgConfigureAMMod::create(rfBandwidth, afBandwidth, modPercent, audioMute);
Message* cmd = MsgConfigureAMMod::create(rfBandwidth, afBandwidth, modFactor, audioMute);
messageQueue->push(cmd);
}
@ -75,7 +75,7 @@ void AMMod::pull(Sample& sample)
m_carrierNco.getIQ(m_modSample);
Real t = m_toneNco.get();
m_modSample *= (t+1.0f) * m_running.m_modFactor * 16384.0f; // modulate carrier
m_modSample *= (t+1.0f) * m_running.m_modFactor * 16384.0f; // modulate and scale carrier
m_interpolatorDistanceRemain += m_interpolatorDistance;
}
@ -150,7 +150,7 @@ void AMMod::apply()
if(m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset)
{
m_carrierNco.setFreq(-m_config.m_inputFrequencyOffset, m_config.m_audioSampleRate);
m_carrierNco.setFreq(m_config.m_inputFrequencyOffset, m_config.m_audioSampleRate);
}
if((m_config.m_outputSampleRate != m_running.m_outputSampleRate) ||

View File

@ -35,7 +35,7 @@ public:
AMMod();
~AMMod();
void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, int modPercent, bool audioMute);
void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute);
virtual void pull(Sample& sample);
virtual void start();
@ -54,9 +54,9 @@ private:
float getModFactor() const { return m_modFactor; }
bool getAudioMute() const { return m_audioMute; }
static MsgConfigureAMMod* create(Real rfBandwidth, Real afBandwidth, int modPercent, bool audioMute)
static MsgConfigureAMMod* create(Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute)
{
return new MsgConfigureAMMod(rfBandwidth, afBandwidth, modPercent, audioMute);
return new MsgConfigureAMMod(rfBandwidth, afBandwidth, modFactor, audioMute);
}
private:

View File

@ -175,6 +175,7 @@ void DSPDeviceSinkEngine::work()
sampleFifo->getWriteIterator(writeBegin);
SampleVector::iterator writeAt = writeBegin;
Sample s;
int sourceOccurence = 0;
if ((m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size()) > 0)
{
@ -185,7 +186,14 @@ void DSPDeviceSinkEngine::work()
{
(*it)->pull(s);
s /= (m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size());
(*writeAt) += s;
if (sourceOccurence == 0) {
(*writeAt) = s;
} else {
(*writeAt) += s;
}
sourceOccurence++;
}
// pull data from direct sources and merge them in the device sample FIFO
@ -194,9 +202,18 @@ void DSPDeviceSinkEngine::work()
(*it)->pull(s);
s /= (m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size());
(*writeAt) += s;
if (sourceOccurence == 0) {
(*writeAt) = s;
} else {
(*writeAt) += s;
}
sourceOccurence++;
}
sampleFifo->bumpIndex(writeAt);
sourceOccurence = 0;
}
// feed the mix to the sinks normally just the main spectrum vis