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