Visual processor basic framework

This commit is contained in:
Charles J. Cliffe 2015-07-27 21:45:24 -04:00
parent a8e24d5537
commit 090062191c
3 changed files with 29 additions and 9 deletions

View File

@ -21,6 +21,12 @@
IMPLEMENT_APP(CubicSDR)
CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFAULT_SAMPLE_RATE), directSamplingMode(0),
sdrThread(NULL), sdrPostThread(NULL), threadCmdQueueSDR(NULL), iqPostDataQueue(NULL), iqVisualQueue(NULL), audioVisualQueue(NULL), t_SDR(NULL), t_PostSDR(NULL) {
}
bool CubicSDR::OnInit() {
#ifdef _OSX_APP_
CFBundleRef mainBundle = CFBundleGetMainBundle();

View File

@ -23,10 +23,7 @@
class CubicSDR: public wxApp {
public:
CubicSDR() :
appframe(NULL), m_glContext(NULL), frequency(0), sdrThread(NULL), sdrPostThread(NULL), threadCmdQueueSDR(NULL), iqVisualQueue(NULL), iqPostDataQueue(NULL), audioVisualQueue(NULL), t_SDR(NULL), t_PostSDR(NULL), sampleRate(DEFAULT_SAMPLE_RATE), offset(0), snap(1), directSamplingMode(0), ppm(0) {
}
CubicSDR();
PrimaryGLContext &GetContext(wxGLCanvas *canvas);

View File

@ -8,34 +8,51 @@ typedef ThreadQueue<ReferenceCounter *> VisualDataQueue;
class VisualProcessor {
public:
void setInput(VisualDataQueue *vis_in) {
// set input queue
busy_update.lock();
input = vis_in;
busy_update.unlock();
}
void attachOutput(VisualDataQueue *vis_out) {
// attach an output queue
busy_update.lock();
outputs.push_back(vis_out);
busy_update.unlock();
}
void removeOutput(VisualDataQueue *vis_out) {
// remove an output queue
busy_update.lock();
std::vector<VisualDataQueue *>::iterator i = std::find(outputs.begin(), outputs.end(), vis_out);
if (i != outputs.end()) {
outputs.erase(i);
}
busy_update.unlock();
}
void pushInput(ReferenceCounter *input) {
// push input data
void run() {
busy_update.lock();
process();
busy_update.unlock();
}
virtual void process() {
// process input to output
// process inputs to output
// distribute(output);
}
protected:
void distribute(ReferenceCounter *output) {
// distribute outputs
output->setRefCount(outputs.size());
std::vector<VisualDataQueue *>::iterator outputs_i;
for (outputs_i = outputs.begin(); outputs_i != outputs.begin(); outputs_i++) {
(*outputs_i)->push(output);
}
}
VisualDataQueue * input;
std::vector<VisualDataQueue *> outputs;
std::mutex busy_update;
};