mirror of https://github.com/f4exb/sdrangel.git
SpectrumVis and DeviceUISet: add possibility to change spectrum scaling factor for Rx/Tx same spectrum commutation (MIMO)
This commit is contained in:
parent
8412260d5a
commit
31a7a0fdde
|
@ -70,6 +70,11 @@ DeviceUISet::~DeviceUISet()
|
||||||
delete m_spectrum;
|
delete m_spectrum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceUISet::setSpectrumScalingFactor(float scalef)
|
||||||
|
{
|
||||||
|
m_spectrumVis->setScalef(m_spectrumVis->getInputMessageQueue(), scalef);
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceUISet::addChannelMarker(ChannelMarker* channelMarker)
|
void DeviceUISet::addChannelMarker(ChannelMarker* channelMarker)
|
||||||
{
|
{
|
||||||
m_spectrum->addChannelMarker(channelMarker);
|
m_spectrum->addChannelMarker(channelMarker);
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
~DeviceUISet();
|
~DeviceUISet();
|
||||||
|
|
||||||
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter
|
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter
|
||||||
|
void setSpectrumScalingFactor(float scalef);
|
||||||
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
|
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
|
||||||
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window
|
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ inline double log2f(double n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureSpectrumVis, Message)
|
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureSpectrumVis, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureScalingFactor, Message)
|
||||||
|
|
||||||
const Real SpectrumVis::m_mult = (10.0f / log2f(10.0f));
|
const Real SpectrumVis::m_mult = (10.0f / log2f(10.0f));
|
||||||
|
|
||||||
|
@ -53,6 +54,12 @@ void SpectrumVis::configure(MessageQueue* msgQueue,
|
||||||
msgQueue->push(cmd);
|
msgQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectrumVis::setScalef(MessageQueue* msgQueue, Real scalef)
|
||||||
|
{
|
||||||
|
MsgConfigureScalingFactor* cmd = new MsgConfigureScalingFactor(scalef);
|
||||||
|
getInputMessageQueue()->push(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void SpectrumVis::feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly)
|
void SpectrumVis::feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||||
{
|
{
|
||||||
feed(triggerPoint, end, positiveOnly); // normal feed from trigger point
|
feed(triggerPoint, end, positiveOnly); // normal feed from trigger point
|
||||||
|
@ -322,6 +329,12 @@ bool SpectrumVis::handleMessage(const Message& message)
|
||||||
conf.getLinear());
|
conf.getLinear());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgConfigureScalingFactor::match(message))
|
||||||
|
{
|
||||||
|
MsgConfigureScalingFactor& conf = (MsgConfigureScalingFactor&) message;
|
||||||
|
handleScalef(conf.getScalef());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -376,3 +389,9 @@ void SpectrumVis::handleConfigure(int fftSize,
|
||||||
m_ofs = 20.0f * log10f(1.0f / m_fftSize);
|
m_ofs = 20.0f * log10f(1.0f / m_fftSize);
|
||||||
m_powFFTDiv = m_fftSize*m_fftSize;
|
m_powFFTDiv = m_fftSize*m_fftSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectrumVis::handleScalef(Real scalef)
|
||||||
|
{
|
||||||
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
m_scalef = scalef;
|
||||||
|
}
|
|
@ -61,6 +61,22 @@ public:
|
||||||
bool m_linear;
|
bool m_linear;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgConfigureScalingFactor : public Message
|
||||||
|
{
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
MsgConfigureScalingFactor(Real scalef) :
|
||||||
|
Message(),
|
||||||
|
m_scalef(scalef)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Real getScalef() const { return m_scalef; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Real m_scalef;
|
||||||
|
};
|
||||||
|
|
||||||
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
|
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
|
||||||
virtual ~SpectrumVis();
|
virtual ~SpectrumVis();
|
||||||
|
|
||||||
|
@ -71,6 +87,7 @@ public:
|
||||||
AvgMode averagingMode,
|
AvgMode averagingMode,
|
||||||
FFTWindow::Function window,
|
FFTWindow::Function window,
|
||||||
bool m_linear);
|
bool m_linear);
|
||||||
|
void setScalef(MessageQueue* msgQueue, Real scalef);
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||||
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);
|
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||||
|
@ -113,6 +130,7 @@ private:
|
||||||
AvgMode averagingMode,
|
AvgMode averagingMode,
|
||||||
FFTWindow::Function window,
|
FFTWindow::Function window,
|
||||||
bool linear);
|
bool linear);
|
||||||
|
void handleScalef(Real scalef);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_SPECTRUMVIS_H
|
#endif // INCLUDE_SPECTRUMVIS_H
|
||||||
|
|
Loading…
Reference in New Issue