mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 01:20:56 -05:00
Boost.
This commit is contained in:
parent
3b8add19c3
commit
06c50842ae
@ -38,9 +38,9 @@ TCPSrc::~TCPSrc()
|
||||
{
|
||||
}
|
||||
|
||||
void TCPSrc::configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort)
|
||||
void TCPSrc::configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort, int boost)
|
||||
{
|
||||
Message* cmd = MsgTCPSrcConfigure::create(sampleFormat, outputSampleRate, rfBandwidth, tcpPort);
|
||||
Message* cmd = MsgTCPSrcConfigure::create(sampleFormat, outputSampleRate, rfBandwidth, tcpPort, boost);
|
||||
cmd->submit(messageQueue, this);
|
||||
}
|
||||
|
||||
@ -58,12 +58,15 @@ void TCPSrc::feed(SampleVector::const_iterator begin, SampleVector::const_iterat
|
||||
|
||||
m_sampleBuffer.clear();
|
||||
|
||||
// Rtl-Sdr uses full 16-bit scale; FCDPP does not
|
||||
int rescale = 20000 * m_boost * m_boost;
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it) {
|
||||
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, c, &ci)) {
|
||||
m_sampleBuffer.push_back(Sample(ci.real() * 20000.0, ci.imag() * 20000.0));
|
||||
m_sampleBuffer.push_back(Sample(ci.real() * rescale, ci.imag() * rescale));
|
||||
m_sampleDistanceRemain += m_inputSampleRate / m_outputSampleRate;
|
||||
}
|
||||
}
|
||||
@ -76,7 +79,7 @@ void TCPSrc::feed(SampleVector::const_iterator begin, SampleVector::const_iterat
|
||||
|
||||
if((m_sampleFormat == FormatSSB) && (m_ssbSockets.count() > 0)) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
Complex cj(it->real() / 20000.0, it->imag() / 20000.0);
|
||||
Complex cj(it->real() / 30000.0, it->imag() / 30000.0);
|
||||
int n_out = TCPFilter->runSSB(cj, &sideband, true);
|
||||
if (n_out) {
|
||||
for (int i = 0; i < n_out; i+=2) {
|
||||
@ -93,7 +96,7 @@ void TCPSrc::feed(SampleVector::const_iterator begin, SampleVector::const_iterat
|
||||
|
||||
if((m_sampleFormat == FormatNFM) && (m_ssbSockets.count() > 0)) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
Complex cj(it->real() / 20000.0, it->imag() / 20000.0);
|
||||
Complex cj(it->real() / 30000.0, it->imag() / 30000.0);
|
||||
int n_out = TCPFilter->runFilt(cj, &sideband);
|
||||
if (n_out) {
|
||||
Real sum = 1.0;
|
||||
@ -155,6 +158,7 @@ bool TCPSrc::handleMessage(Message* cmd)
|
||||
m_tcpServer->close();
|
||||
m_tcpServer->listen(QHostAddress::Any, m_tcpPort);
|
||||
}
|
||||
m_boost = cfg->getBoost();
|
||||
m_interpolator.create(16, m_inputSampleRate, m_rfBandwidth / 2.1);
|
||||
m_sampleDistanceRemain = m_inputSampleRate / m_outputSampleRate;
|
||||
TCPFilter->create_filter(0.048f / 48.0f, m_rfBandwidth / 2.0 / m_outputSampleRate);
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
TCPSrc(MessageQueue* uiMessageQueue, TCPSrcGUI* tcpSrcGUI, SampleSink* spectrum);
|
||||
~TCPSrc();
|
||||
|
||||
void configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort);
|
||||
void configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort, int boost);
|
||||
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||
|
||||
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
||||
@ -74,10 +74,11 @@ protected:
|
||||
Real getOutputSampleRate() const { return m_outputSampleRate; }
|
||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||
int getTCPPort() const { return m_tcpPort; }
|
||||
int getBoost() const { return m_boost; }
|
||||
|
||||
static MsgTCPSrcConfigure* create(SampleFormat sampleFormat, Real sampleRate, Real rfBandwidth, int tcpPort)
|
||||
static MsgTCPSrcConfigure* create(SampleFormat sampleFormat, Real sampleRate, Real rfBandwidth, int tcpPort, int boost)
|
||||
{
|
||||
return new MsgTCPSrcConfigure(sampleFormat, sampleRate, rfBandwidth, tcpPort);
|
||||
return new MsgTCPSrcConfigure(sampleFormat, sampleRate, rfBandwidth, tcpPort, boost);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -85,13 +86,15 @@ protected:
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
int m_tcpPort;
|
||||
int m_boost;
|
||||
|
||||
MsgTCPSrcConfigure(SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort) :
|
||||
MsgTCPSrcConfigure(SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int tcpPort, int boost) :
|
||||
Message(),
|
||||
m_sampleFormat(sampleFormat),
|
||||
m_outputSampleRate(outputSampleRate),
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_tcpPort(tcpPort)
|
||||
m_tcpPort(tcpPort),
|
||||
m_boost(boost)
|
||||
{ }
|
||||
};
|
||||
class MsgTCPSrcSpectrum : public Message {
|
||||
@ -123,6 +126,7 @@ protected:
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
int m_tcpPort;
|
||||
int m_boost;
|
||||
|
||||
Real m_scale;
|
||||
Complex m_last, m_this;
|
||||
|
@ -31,6 +31,7 @@ void TCPSrcGUI::resetToDefaults()
|
||||
ui->rfBandwidth->setText("32000");
|
||||
ui->tcpPort->setText("9999");
|
||||
ui->spectrumGUI->resetToDefaults();
|
||||
ui->boost->setValue(1);
|
||||
applySettings();
|
||||
|
||||
}
|
||||
@ -45,6 +46,7 @@ QByteArray TCPSrcGUI::serialize() const
|
||||
s.writeReal(5, m_rfBandwidth);
|
||||
s.writeS32(6, m_tcpPort);
|
||||
s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||
s.writeS32(8, (qint32)m_boost);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -88,6 +90,8 @@ bool TCPSrcGUI::deserialize(const QByteArray& data)
|
||||
ui->tcpPort->setText(QString("%1").arg(s32tmp));
|
||||
d.readBlob(7, &bytetmp);
|
||||
ui->spectrumGUI->deserialize(bytetmp);
|
||||
d.readS32(8, &s32tmp, 1);
|
||||
ui->boost->setValue(s32tmp);
|
||||
applySettings();
|
||||
return true;
|
||||
} else {
|
||||
@ -178,11 +182,13 @@ void TCPSrcGUI::applySettings()
|
||||
int tcpPort = ui->tcpPort->text().toInt(&ok);
|
||||
if((!ok) || (tcpPort < 1) || (tcpPort > 65535))
|
||||
tcpPort = 9999;
|
||||
int boost = ui->boost->value();
|
||||
|
||||
setTitleColor(m_channelMarker->getColor());
|
||||
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
|
||||
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
|
||||
ui->tcpPort->setText(QString("%1").arg(tcpPort));
|
||||
ui->boost->setValue(boost);
|
||||
m_channelMarker->disconnect(this, SLOT(channelMarkerChanged()));
|
||||
m_channelMarker->setBandwidth((int)rfBandwidth);
|
||||
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
||||
@ -212,12 +218,14 @@ void TCPSrcGUI::applySettings()
|
||||
m_outputSampleRate = outputSampleRate;
|
||||
m_rfBandwidth = rfBandwidth;
|
||||
m_tcpPort = tcpPort;
|
||||
m_boost = boost;
|
||||
|
||||
m_tcpSrc->configure(m_threadedSampleSink->getMessageQueue(),
|
||||
sampleFormat,
|
||||
outputSampleRate,
|
||||
rfBandwidth,
|
||||
tcpPort);
|
||||
tcpPort,
|
||||
boost);
|
||||
|
||||
ui->applyBtn->setEnabled(false);
|
||||
}
|
||||
@ -247,6 +255,12 @@ void TCPSrcGUI::on_applyBtn_clicked()
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void TCPSrcGUI::on_boost_valueChanged(int value)
|
||||
{
|
||||
ui->boost->setValue(value);
|
||||
ui->applyBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
void TCPSrcGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
{
|
||||
if((widget == ui->spectrumBox) && (m_tcpSrc != NULL))
|
||||
|
@ -41,7 +41,7 @@ private slots:
|
||||
void on_applyBtn_clicked();
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDoubleClicked();
|
||||
|
||||
void on_boost_valueChanged(int value);
|
||||
private:
|
||||
Ui::TCPSrcGUI* ui;
|
||||
PluginAPI* m_pluginAPI;
|
||||
@ -52,6 +52,7 @@ private:
|
||||
TCPSrc::SampleFormat m_sampleFormat;
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
int m_boost;
|
||||
int m_tcpPort;
|
||||
bool m_basicSettingsShown;
|
||||
|
||||
|
@ -100,7 +100,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="4" column="1">
|
||||
<widget class="QSlider" name="boost">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QPushButton" name="applyBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -4,6 +4,7 @@ find_package(LibUSB)
|
||||
#find_package(LibOsmoSDR)
|
||||
|
||||
add_subdirectory(gnuradio)
|
||||
#add_subdirectory(remote)
|
||||
|
||||
if(LIBUSB_FOUND AND LIBOSMOSDR_FOUND)
|
||||
add_subdirectory(osmosdr)
|
||||
@ -13,8 +14,6 @@ if(KERNEL AND UNIX)
|
||||
FIND_LIBRARY (LIBV4L2 v4l2)
|
||||
FIND_PATH (LIBV4L2H libv4l2.h)
|
||||
add_subdirectory(v4l)
|
||||
else()
|
||||
find_package(LibRTLSDR)
|
||||
endif()
|
||||
|
||||
if(LIBUSB_FOUND AND UNIX)
|
||||
@ -25,6 +24,7 @@ if(LIBASOUND AND ASOUNDH)
|
||||
add_subdirectory(fcd)
|
||||
endif()
|
||||
|
||||
find_package(LibRTLSDR)
|
||||
if(LIBUSB_FOUND AND LIBRTLSDR_FOUND)
|
||||
add_subdirectory(rtlsdr)
|
||||
endif(LIBUSB_FOUND AND LIBRTLSDR_FOUND)
|
||||
|
Loading…
Reference in New Issue
Block a user