2014-05-18 11:52:39 -04:00
|
|
|
#ifndef INCLUDE_SCOPEVIS_H
|
|
|
|
#define INCLUDE_SCOPEVIS_H
|
|
|
|
|
|
|
|
#include "dsp/samplesink.h"
|
|
|
|
#include "util/export.h"
|
2015-07-13 04:46:51 -04:00
|
|
|
#include "util/message.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
class GLScope;
|
|
|
|
class MessageQueue;
|
|
|
|
|
|
|
|
class SDRANGELOVE_API ScopeVis : public SampleSink {
|
|
|
|
public:
|
|
|
|
enum TriggerChannel {
|
|
|
|
TriggerFreeRun,
|
|
|
|
TriggerChannelI,
|
2015-07-13 04:46:51 -04:00
|
|
|
TriggerChannelQ,
|
|
|
|
TriggerMagLin,
|
|
|
|
TriggerMagDb,
|
|
|
|
TriggerPhase
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
ScopeVis(GLScope* glScope = NULL);
|
|
|
|
|
2015-07-13 04:46:51 -04:00
|
|
|
void configure(MessageQueue* msgQueue, TriggerChannel triggerChannel, Real triggerLevel, bool triggerPositiveEdge);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2014-06-15 04:32:25 -04:00
|
|
|
void feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly);
|
2014-05-18 11:52:39 -04:00
|
|
|
void start();
|
|
|
|
void stop();
|
2015-06-23 14:05:28 -04:00
|
|
|
bool handleMessageKeep(Message* message);
|
2014-05-18 11:52:39 -04:00
|
|
|
bool handleMessage(Message* message);
|
|
|
|
|
2015-07-06 19:17:16 -04:00
|
|
|
void setSampleRate(int sampleRate);
|
|
|
|
int getSampleRate() const { return m_sampleRate; }
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
private:
|
2015-07-13 04:46:51 -04:00
|
|
|
class MsgConfigureScopeVis : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
int getTriggerChannel() const { return m_triggerChannel; }
|
|
|
|
Real getTriggerLevel() const { return m_triggerLevel; }
|
|
|
|
Real getTriggerPositiveEdge() const { return m_triggerPositiveEdge; }
|
|
|
|
|
|
|
|
static MsgConfigureScopeVis* create(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge)
|
|
|
|
{
|
|
|
|
return new MsgConfigureScopeVis(triggerChannel, triggerLevel, triggerPositiveEdge);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_triggerChannel;
|
|
|
|
Real m_triggerLevel;
|
|
|
|
bool m_triggerPositiveEdge;
|
|
|
|
|
|
|
|
MsgConfigureScopeVis(int triggerChannel, Real triggerLevel, bool triggerPositiveEdge) :
|
|
|
|
Message(),
|
|
|
|
m_triggerChannel(triggerChannel),
|
|
|
|
m_triggerLevel(triggerLevel),
|
|
|
|
m_triggerPositiveEdge(triggerPositiveEdge)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
enum TriggerState {
|
|
|
|
Untriggered,
|
|
|
|
Triggered,
|
|
|
|
WaitForReset
|
|
|
|
};
|
|
|
|
|
|
|
|
GLScope* m_glScope;
|
|
|
|
std::vector<Complex> m_trace;
|
|
|
|
uint m_fill;
|
|
|
|
TriggerState m_triggerState;
|
|
|
|
TriggerChannel m_triggerChannel;
|
2015-07-13 17:38:10 -04:00
|
|
|
Real m_triggerLevel;
|
2015-07-13 04:46:51 -04:00
|
|
|
bool m_triggerPositiveEdge;
|
2014-05-18 11:52:39 -04:00
|
|
|
int m_sampleRate;
|
2015-07-13 17:38:10 -04:00
|
|
|
|
|
|
|
bool triggerCondition(SampleVector::const_iterator& it);
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_SCOPEVIS_H
|