Handle SSB variable span in the spectrum GUI but not in the spectrum itseld still based on 6kHz bandwodth

pull/6/head
f4exb 2015-06-11 09:18:10 +02:00
rodzic bec01078d9
commit 85610c6a86
4 zmienionych plików z 29 dodań i 10 usunięć

Wyświetl plik

@ -33,6 +33,7 @@ SSBDemod::SSBDemod(AudioFifo* audioFifo, SampleSink* sampleSink) :
m_Bandwidth = 5000;
m_LowCutoff = 300;
m_volume = 2.0;
m_spanLog2 = 3;
m_sampleRate = 96000;
m_frequency = 0;
m_nco.setFreq(m_frequency, m_sampleRate);
@ -53,9 +54,9 @@ SSBDemod::~SSBDemod()
if (SSBFilter) delete SSBFilter;
}
void SSBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real LowCutoff, Real volume)
void SSBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real LowCutoff, Real volume, int spanLog2)
{
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume);
Message* cmd = MsgConfigureSSBDemod::create(Bandwidth, LowCutoff, volume, spanLog2);
cmd->submit(messageQueue, this);
}
@ -117,7 +118,7 @@ bool SSBDemod::handleMessage(Message* cmd)
if(DSPSignalNotification::match(cmd)) {
DSPSignalNotification* signal = (DSPSignalNotification*)cmd;
qDebug("%d samples/sec, %lld Hz offset", signal->getSampleRate(), signal->getFrequencyOffset());
//fprintf(stderr, "%d samples/sec, %lld Hz offset", signal->getSampleRate(), signal->getFrequencyOffset());
m_sampleRate = signal->getSampleRate();
m_nco.setFreq(-signal->getFrequencyOffset(), m_sampleRate);
m_interpolator.create(16, m_sampleRate, m_Bandwidth);
@ -151,6 +152,9 @@ bool SSBDemod::handleMessage(Message* cmd)
m_volume = cfg->getVolume();
m_volume *= m_volume * 0.1;
m_spanLog2 = cfg->getSpanLog2();
cmd->completed();
return true;
} else {

Wyświetl plik

@ -35,7 +35,7 @@ public:
SSBDemod(AudioFifo* audioFifo, SampleSink* sampleSink);
~SSBDemod();
void configure(MessageQueue* messageQueue, Real Bandwidth, Real LowCutoff, Real volume);
void configure(MessageQueue* messageQueue, Real Bandwidth, Real LowCutoff, Real volume, int spanLog2);
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
void start();
@ -50,22 +50,25 @@ private:
Real getBandwidth() const { return m_Bandwidth; }
Real getLoCutoff() const { return m_LowCutoff; }
Real getVolume() const { return m_volume; }
int getSpanLog2() const { return m_spanLog2; }
static MsgConfigureSSBDemod* create(Real Bandwidth, Real LowCutoff, Real volume)
static MsgConfigureSSBDemod* create(Real Bandwidth, Real LowCutoff, Real volume, int spanLog2)
{
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume);
return new MsgConfigureSSBDemod(Bandwidth, LowCutoff, volume, spanLog2);
}
private:
Real m_Bandwidth;
Real m_LowCutoff;
Real m_volume;
int m_spanLog2;
MsgConfigureSSBDemod(Real Bandwidth, Real LowCutoff, Real volume) :
MsgConfigureSSBDemod(Real Bandwidth, Real LowCutoff, Real volume, int spanLog2) :
Message(),
m_Bandwidth(Bandwidth),
m_LowCutoff(LowCutoff),
m_volume(volume)
m_volume(volume),
m_spanLog2(spanLog2)
{ }
};
@ -78,6 +81,7 @@ private:
Real m_Bandwidth;
Real m_LowCutoff;
Real m_volume;
int m_spanLog2;
int m_undersampleCount;
int m_sampleRate;
int m_frequency;

Wyświetl plik

@ -210,7 +210,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::SSBDemodGUI),
m_pluginAPI(pluginAPI),
m_basicSettingsShown(false),
m_rate(6000)
m_rate(6000),
m_spanLog2(3)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
@ -264,18 +265,23 @@ bool SSBDemodGUI::setNewRate(int spanLog2)
return false;
}
m_spanLog2 = spanLog2;
m_rate = 48000 / (1<<spanLog2);
if (ui->BW->value() < -m_rate/100) {
ui->BW->setValue(-m_rate/100);
m_channelMarker->setBandwidth(-m_rate*2);
} else if (ui->BW->value() > m_rate/100) {
ui->BW->setValue(m_rate/100);
m_channelMarker->setBandwidth(m_rate*2);
}
if (ui->lowCut->value() < -m_rate/100) {
ui->lowCut->setValue(-m_rate/100);
m_channelMarker->setLowCutoff(-m_rate);
} else if (ui->lowCut->value() > m_rate/100) {
ui->lowCut->setValue(m_rate/100);
m_channelMarker->setLowCutoff(m_rate);
}
ui->BW->setMinimum(-m_rate/100);
@ -286,6 +292,9 @@ bool SSBDemodGUI::setNewRate(int spanLog2)
QString s = QString::number(m_rate/1000.0, 'f', 1);
ui->spanText->setText(tr("%1k").arg(s));
ui->glSpectrum->setCenterFrequency(m_rate/2);
ui->glSpectrum->setSampleRate(m_rate);
return true;
}
@ -300,7 +309,8 @@ void SSBDemodGUI::applySettings()
m_ssbDemod->configure(m_threadedSampleSink->getMessageQueue(),
ui->BW->value() * 100.0,
ui->lowCut->value() * 100.0,
ui->volume->value() / 10.0 );
ui->volume->value() / 10.0,
m_spanLog2);
}
void SSBDemodGUI::leaveEvent(QEvent*)

Wyświetl plik

@ -50,6 +50,7 @@ private:
ChannelMarker* m_channelMarker;
bool m_basicSettingsShown;
int m_rate;
int m_spanLog2;
AudioFifo* m_audioFifo;
ThreadedSampleSink* m_threadedSampleSink;