mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-05 00:41:17 -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();
|
||||
}
|
||||
|
||||
VisualDataDistributor<DemodulatorThreadIQData> *CubicSDR::getSpectrumDistributor() {
|
||||
VisualDataReDistributor<DemodulatorThreadIQData> *CubicSDR::getSpectrumDistributor() {
|
||||
return &spectrumDistributor;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
ScopeVisualProcessor *getScopeProcessor();
|
||||
SpectrumVisualProcessor *getSpectrumProcessor();
|
||||
SpectrumVisualProcessor *getDemodSpectrumProcessor();
|
||||
VisualDataDistributor<DemodulatorThreadIQData> *getSpectrumDistributor();
|
||||
VisualDataReDistributor<DemodulatorThreadIQData> *getSpectrumDistributor();
|
||||
|
||||
DemodulatorThreadOutputQueue* getAudioVisualQueue();
|
||||
DemodulatorThreadInputQueue* getIQVisualQueue();
|
||||
@ -111,7 +111,7 @@ private:
|
||||
|
||||
ScopeVisualProcessor scopeProcessor;
|
||||
|
||||
VisualDataDistributor<DemodulatorThreadIQData> spectrumDistributor;
|
||||
VisualDataReDistributor<DemodulatorThreadIQData> spectrumDistributor;
|
||||
|
||||
std::thread *t_SDR;
|
||||
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 (lpsIndex >= targetVis) {
|
||||
tex_update.lock();
|
||||
while (lpsIndex >= targetVis) {
|
||||
SpectrumVisualData *vData;
|
||||
if (!visualDataQueue.empty()) {
|
||||
@ -115,6 +116,7 @@ void WaterfallCanvas::processInputQueue() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tex_update.unlock();
|
||||
}
|
||||
}
|
||||
if (processed) {
|
||||
@ -235,7 +237,9 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glContext->BeginDraw(0,0,0);
|
||||
|
||||
waterfallPanel.calcTransform(CubicVR::mat4::identity());
|
||||
tex_update.lock();
|
||||
waterfallPanel.draw();
|
||||
tex_update.unlock();
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
@ -314,7 +318,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
glContext->EndDraw();
|
||||
|
||||
glFlush();
|
||||
// glFlush();
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
Timer gTimer, testTimer;
|
||||
double lpsIndex;
|
||||
bool preBuf;
|
||||
std::mutex tex_update;
|
||||
// event table
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user