Frame timer too jittery for anything but OSX, back to throttling which looks nicer..

This commit is contained in:
Charles J. Cliffe 2015-08-12 18:07:06 -04:00
parent d2dbb2ff11
commit 6ae02bee9c
10 changed files with 32 additions and 21 deletions

View File

@ -35,7 +35,7 @@ EVT_CLOSE(AppFrame::OnClose)
EVT_MENU(wxID_ANY, AppFrame::OnMenu)
EVT_COMMAND(wxID_ANY, wxEVT_THREAD, AppFrame::OnThread)
EVT_IDLE(AppFrame::OnIdle)
EVT_TIMER(FRAME_TIMER_ID, AppFrame::OnTimer)
//EVT_TIMER(FRAME_TIMER_ID, AppFrame::OnTimer)
wxEND_EVENT_TABLE()
AppFrame::AppFrame() :
@ -407,11 +407,11 @@ void AppFrame::initDeviceParams(std::string deviceId) {
// frame rate = 1000 / 30 = 33ms
// windows needs a bit more time or it lags?
#ifdef _WIN32
frame_timer.Start(25);
#else
frame_timer.Start(33);
#endif
//#ifdef _WIN32
// frame_timer.Start(25);
//#else
// frame_timer.Start(15);
//#endif
}
}
@ -608,10 +608,10 @@ void AppFrame::OnThread(wxCommandEvent& event) {
}
void AppFrame::OnIdle(wxIdleEvent& event) {
event.Skip();
}
void AppFrame::OnTimer(wxTimerEvent& event) {
// event.Skip();
//}
//
//void AppFrame::OnTimer(wxTimerEvent& event) {
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
@ -768,9 +768,8 @@ void AppFrame::OnTimer(wxTimerEvent& event) {
while (!wproc->isInputEmpty()) {
wproc->run();
}
scopeCanvas->Refresh();
/* scopeCanvas->Refresh();
waterfallCanvas->Refresh();
spectrumCanvas->Refresh();
@ -792,9 +791,9 @@ void AppFrame::OnTimer(wxTimerEvent& event) {
}
if (spectrumAvgMeter->getMouseTracker()->mouseInView()) {
spectrumAvgMeter->Refresh();
}
} */
event.Skip();
event.RequestMore();
}
void AppFrame::saveSession(std::string fileName) {

View File

@ -69,7 +69,7 @@ private:
void OnClose(wxCloseEvent& event);
void OnNewWindow(wxCommandEvent& event);
void OnIdle(wxIdleEvent& event);
void OnTimer(wxTimerEvent& event);
// void OnTimer(wxTimerEvent& event);
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas;

View File

@ -33,4 +33,4 @@ const char filePathSeparator =
#define DEFAULT_DEMOD_TYPE 1
#define DEFAULT_DEMOD_BW 200000
#define DEFAULT_WATERFALL_LPS 24
#define DEFAULT_WATERFALL_LPS 30

View File

@ -91,6 +91,7 @@ void SDRPostThread::run() {
iqDataInQueue->pop(data_in);
// std::lock_guard < std::mutex > lock(data_in->m_mutex);
int num_vis_samples = this->num_vis_samples;
if (data_in && data_in->data.size()) {
int dataSize = data_in->data.size()/2;
@ -120,6 +121,10 @@ void SDRPostThread::run() {
visualDataOut->busy_rw.lock();
visualDataOut->setRefCount(1);
if (num_vis_samples > data_in->data.size()) {
num_vis_samples = data_in->data.size();
}
if (visualDataOut->data.size() < num_vis_samples) {
if (visualDataOut->data.capacity() < num_vis_samples) {
visualDataOut->data.reserve(num_vis_samples);

View File

@ -79,7 +79,8 @@ void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
}
void MeterCanvas::OnIdle(wxIdleEvent &event) {
event.Skip();
Refresh();
event.RequestMore();
}
void MeterCanvas::OnMouseMoved(wxMouseEvent& event) {

View File

@ -72,7 +72,8 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
}
void ModeSelectorCanvas::OnIdle(wxIdleEvent &event) {
event.Skip();
Refresh();
event.RequestMore();
}
void ModeSelectorCanvas::OnMouseMoved(wxMouseEvent& event) {

View File

@ -87,7 +87,8 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
}
void ScopeCanvas::OnIdle(wxIdleEvent &event) {
event.Skip();
Refresh();
event.RequestMore();
}
ScopeRenderDataQueue *ScopeCanvas::getInputQueue() {

View File

@ -85,7 +85,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
void SpectrumCanvas::OnIdle(wxIdleEvent &event) {
event.Skip();
Refresh();
event.RequestMore();
}

View File

@ -252,6 +252,8 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
dragging = false;
}
}
Refresh();
event.RequestMore();
}
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {

View File

@ -347,7 +347,8 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
}
}
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
event.Skip();
Refresh();
event.RequestMore();
}
void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {