mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-10-08 08:10:26 -04:00
Frame rate limiter
This commit is contained in:
@@ -22,7 +22,7 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
||||
wxGLCanvas(parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
|
||||
wxFULL_REPAINT_ON_RESIZE), parent(parent) {
|
||||
wxFULL_REPAINT_ON_RESIZE), parent(parent), frameTimer(0) {
|
||||
|
||||
int in_block_size = BUF_SIZE / 2;
|
||||
int out_block_size = FFT_SIZE;
|
||||
@@ -35,6 +35,7 @@ WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
||||
fft_floor_ma = fft_floor_maa = 0.0;
|
||||
|
||||
glContext = new WaterfallContext(this, &wxGetApp().GetContext(this));
|
||||
timer.start();
|
||||
}
|
||||
|
||||
WaterfallCanvas::~WaterfallCanvas() {
|
||||
@@ -150,5 +151,10 @@ void WaterfallCanvas::setData(std::vector<signed char> *data) {
|
||||
}
|
||||
|
||||
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
timer.update();
|
||||
frameTimer += timer.lastUpdateSeconds();
|
||||
if (frameTimer > 1.0/30.0) {
|
||||
Refresh(false);
|
||||
frameTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user