mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-10 06:18:57 -05:00
tex update lock, VisualData"Re"Distributor
This commit is contained in:
parent
4301d0d434
commit
0a6d409065
@ -298,7 +298,7 @@ SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcessor() {
|
|||||||
return demodVisualThread->getProcessor();
|
return demodVisualThread->getProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualDataDistributor<DemodulatorThreadIQData> *CubicSDR::getSpectrumDistributor() {
|
VisualDataReDistributor<DemodulatorThreadIQData> *CubicSDR::getSpectrumDistributor() {
|
||||||
return &spectrumDistributor;
|
return &spectrumDistributor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
ScopeVisualProcessor *getScopeProcessor();
|
ScopeVisualProcessor *getScopeProcessor();
|
||||||
SpectrumVisualProcessor *getSpectrumProcessor();
|
SpectrumVisualProcessor *getSpectrumProcessor();
|
||||||
SpectrumVisualProcessor *getDemodSpectrumProcessor();
|
SpectrumVisualProcessor *getDemodSpectrumProcessor();
|
||||||
VisualDataDistributor<DemodulatorThreadIQData> *getSpectrumDistributor();
|
VisualDataReDistributor<DemodulatorThreadIQData> *getSpectrumDistributor();
|
||||||
|
|
||||||
DemodulatorThreadOutputQueue* getAudioVisualQueue();
|
DemodulatorThreadOutputQueue* getAudioVisualQueue();
|
||||||
DemodulatorThreadInputQueue* getIQVisualQueue();
|
DemodulatorThreadInputQueue* getIQVisualQueue();
|
||||||
@ -111,7 +111,7 @@ private:
|
|||||||
|
|
||||||
ScopeVisualProcessor scopeProcessor;
|
ScopeVisualProcessor scopeProcessor;
|
||||||
|
|
||||||
VisualDataDistributor<DemodulatorThreadIQData> spectrumDistributor;
|
VisualDataReDistributor<DemodulatorThreadIQData> spectrumDistributor;
|
||||||
|
|
||||||
std::thread *t_SDR;
|
std::thread *t_SDR;
|
||||||
std::thread *t_PostSDR;
|
std::thread *t_PostSDR;
|
||||||
|
@ -107,3 +107,25 @@ protected:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class OutputDataType = ReferenceCounter>
|
||||||
|
class VisualDataReDistributor : public VisualProcessor<OutputDataType, OutputDataType> {
|
||||||
|
protected:
|
||||||
|
void process() {
|
||||||
|
while (!VisualProcessor<OutputDataType, OutputDataType>::input->empty()) {
|
||||||
|
if (!VisualProcessor<OutputDataType, OutputDataType>::isAnyOutputEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OutputDataType *inp;
|
||||||
|
VisualProcessor<OutputDataType, OutputDataType>::input->pop(inp);
|
||||||
|
|
||||||
|
if (inp) {
|
||||||
|
OutputDataType *outp = buffers.getBuffer();
|
||||||
|
(*outp) = (*inp);
|
||||||
|
inp->decRefCount();
|
||||||
|
VisualProcessor<OutputDataType, OutputDataType>::distribute(outp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReBuffer<OutputDataType> buffers;
|
||||||
|
};
|
||||||
|
@ -99,6 +99,7 @@ void WaterfallCanvas::processInputQueue() {
|
|||||||
|
|
||||||
if (linesPerSecond) {
|
if (linesPerSecond) {
|
||||||
if (lpsIndex >= targetVis) {
|
if (lpsIndex >= targetVis) {
|
||||||
|
tex_update.lock();
|
||||||
while (lpsIndex >= targetVis) {
|
while (lpsIndex >= targetVis) {
|
||||||
SpectrumVisualData *vData;
|
SpectrumVisualData *vData;
|
||||||
if (!visualDataQueue.empty()) {
|
if (!visualDataQueue.empty()) {
|
||||||
@ -115,6 +116,7 @@ void WaterfallCanvas::processInputQueue() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tex_update.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (processed) {
|
if (processed) {
|
||||||
@ -235,7 +237,9 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
glContext->BeginDraw(0,0,0);
|
glContext->BeginDraw(0,0,0);
|
||||||
|
|
||||||
waterfallPanel.calcTransform(CubicVR::mat4::identity());
|
waterfallPanel.calcTransform(CubicVR::mat4::identity());
|
||||||
|
tex_update.lock();
|
||||||
waterfallPanel.draw();
|
waterfallPanel.draw();
|
||||||
|
tex_update.unlock();
|
||||||
|
|
||||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||||
|
|
||||||
@ -314,7 +318,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
|
|
||||||
glContext->EndDraw();
|
glContext->EndDraw();
|
||||||
|
|
||||||
glFlush();
|
// glFlush();
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
Timer gTimer, testTimer;
|
Timer gTimer, testTimer;
|
||||||
double lpsIndex;
|
double lpsIndex;
|
||||||
bool preBuf;
|
bool preBuf;
|
||||||
|
std::mutex tex_update;
|
||||||
// event table
|
// event table
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user