mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
New scope: pass sample rate
This commit is contained in:
parent
58f3180132
commit
d69c6cc417
@ -437,7 +437,7 @@ bool ChannelAnalyzerNGGUI::setNewRate(int spanLog2)
|
||||
}
|
||||
|
||||
ui->glScope->setSampleRate(m_rate);
|
||||
//m_scopeVis->setSampleRate(m_rate); TODO: not needed anymore?
|
||||
m_scopeVis->setSampleRate(m_rate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -36,7 +36,9 @@ ScopeVisNG::ScopeVisNG(GLScopeNG* glScope) :
|
||||
m_traceStart(true),
|
||||
m_traceFill(0),
|
||||
m_zTraceIndex(-1),
|
||||
m_traceCompleteCount(0)
|
||||
m_traceCompleteCount(0),
|
||||
m_timeOfsProMill(0),
|
||||
m_sampleRate(0)
|
||||
{
|
||||
setObjectName("ScopeVisNG");
|
||||
m_tracebackBuffers.resize(1);
|
||||
@ -53,6 +55,15 @@ ScopeVisNG::~ScopeVisNG()
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVisNG::setSampleRate(int sampleRate)
|
||||
{
|
||||
if (sampleRate != m_sampleRate)
|
||||
{
|
||||
m_sampleRate = sampleRate;
|
||||
if (m_glScope) m_glScope->setSampleRate(m_sampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeVisNG::configure(MessageQueue* msgQueue,
|
||||
uint traceSize)
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
ScopeVisNG(GLScopeNG* glScope = 0);
|
||||
virtual ~ScopeVisNG();
|
||||
|
||||
void setSampleRate(int sampleRate);
|
||||
void configure(MessageQueue* msgQueue,
|
||||
uint32_t traceSize);
|
||||
|
||||
@ -70,6 +71,8 @@ public:
|
||||
private:
|
||||
typedef DoubleBufferSimple<Sample> TraceBuffer;
|
||||
|
||||
// === messages ===
|
||||
// ---------------------------------------------
|
||||
class MsgConfigureScopeVisNG : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -88,6 +91,7 @@ private:
|
||||
{}
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class MsgScopeVisNGAddTrigger : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -106,6 +110,7 @@ private:
|
||||
{}
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class MsgScopeVisNGRemoveTrigger : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -124,6 +129,8 @@ private:
|
||||
{}
|
||||
};
|
||||
|
||||
// === projectors ===
|
||||
// ---------------------------------------------
|
||||
class Projector
|
||||
{
|
||||
public:
|
||||
@ -135,6 +142,7 @@ private:
|
||||
ProjectionType m_projectionType;
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorReal : public Projector
|
||||
{
|
||||
public:
|
||||
@ -142,6 +150,7 @@ private:
|
||||
virtual Real run(const Sample& s) { return s.m_real / 32768.0f; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorImag : public Projector
|
||||
{
|
||||
public:
|
||||
@ -149,6 +158,7 @@ private:
|
||||
virtual Real run(const Sample& s) { return s.m_imag / 32768.0f; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorMagLin : public Projector
|
||||
{
|
||||
public:
|
||||
@ -160,6 +170,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorMagDB : public Projector
|
||||
{
|
||||
public:
|
||||
@ -173,6 +184,7 @@ private:
|
||||
static const Real mult;
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorPhase : public Projector
|
||||
{
|
||||
public:
|
||||
@ -180,6 +192,7 @@ private:
|
||||
virtual Real run(const Sample& s) { return std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------
|
||||
class ProjectorDPhase : public Projector
|
||||
{
|
||||
public:
|
||||
@ -203,6 +216,7 @@ private:
|
||||
Real m_prevArg;
|
||||
};
|
||||
|
||||
|
||||
enum TriggerState
|
||||
{
|
||||
TriggerFreeRun, //!< Trigger is disabled
|
||||
@ -276,6 +290,7 @@ private:
|
||||
int m_zTraceIndex; //!< Index of the trace used for Z input (luminance or false colors)
|
||||
int m_traceCompleteCount; //!< Count of completed traces
|
||||
SampleVector::const_iterator m_triggerPoint; //!< Trigger start location in the samples vector
|
||||
int m_sampleRate;
|
||||
|
||||
void processPrevTrace(SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, std::vector<Trace>::iterator& trace);
|
||||
};
|
||||
|
@ -290,6 +290,7 @@ void GLScopeNG::setSampleRate(int sampleRate)
|
||||
m_sampleRate = sampleRate;
|
||||
m_configChanged = true;
|
||||
update();
|
||||
emit sampleRateChanged(m_sampleRate);
|
||||
}
|
||||
|
||||
void GLScopeNG::setTimeBase(int timeBase)
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
void setTraces(const ScopeVisNG::DisplayTraces *traces) { m_traces = traces; m_configChanged = true; }
|
||||
void newTraces();
|
||||
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
|
||||
void setTriggerPre(Real triggerPre);
|
||||
void setTimeOfsProMill(int timeOfsProMill);
|
||||
void setSampleRate(int sampleRate);
|
||||
@ -62,6 +64,9 @@ public:
|
||||
void setDisplayMode(DisplayMode displayMode);
|
||||
void setTraceSize(int trceSize);
|
||||
|
||||
signals:
|
||||
void sampleRateChanged(int);
|
||||
|
||||
private:
|
||||
DisplayMode m_displayMode;
|
||||
QTimer m_timer;
|
||||
|
@ -16,6 +16,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "glscopenggui.h"
|
||||
#include "glscopeng.h"
|
||||
#include "ui_glscopenggui.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
@ -40,6 +41,7 @@ void GLScopeNGGUI::setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis,
|
||||
m_messageQueue = messageQueue;
|
||||
m_scopeVis = scopeVis;
|
||||
m_glScope = glScope;
|
||||
connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int)));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -48,6 +50,13 @@ void GLScopeNGGUI::setSampleRate(int sampleRate)
|
||||
m_sampleRate = sampleRate;
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_scope_sampleRateChanged(int sampleRate)
|
||||
{
|
||||
//m_sampleRate = m_glScope->getSampleRate();
|
||||
m_sampleRate = sampleRate;
|
||||
ui->sampleRateText->setText(tr("%1\nkS/s").arg(m_sampleRate / 1000.0f, 0, 'f', 2));
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::resetToDefaults()
|
||||
{
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ private:
|
||||
|
||||
void applySettings();
|
||||
|
||||
private slots:
|
||||
void on_scope_sampleRateChanged(int value);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user