Balanced thread performance w/ CPU usage

Seems smooth and responsive now.
This commit is contained in:
Charles J. Cliffe 2014-11-16 19:02:40 -05:00
parent 739854cd7f
commit 1950c3109a
5 changed files with 14 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include "SDRThread.h"
#include "DemodulatorThread.h"
#include "AudioThread.h"
#include "CubicSDR.h"
wxBEGIN_EVENT_TABLE(AppFrame, wxFrame)
//EVT_MENU(wxID_NEW, AppFrame::OnNewWindow)
@ -53,7 +54,7 @@ AppFrame::AppFrame() :
SetMenuBar(menuBar);
CreateStatusBar();
SetClientSize(1280, 400);
SetClientSize(1280, 600);
Centre();
Show();
@ -186,6 +187,7 @@ void AppFrame::OnAudioInput(wxThreadEvent& event) {
void AppFrame::OnIdle(wxIdleEvent& event) {
wxGetApp().Yield();
event.Skip();
}

View File

@ -111,9 +111,10 @@ wxThread::ExitCode AudioThread::Entry() {
break;
}
}
} else {
this->Yield();
this->Sleep(1);
}
Sleep(1000);
}
std::cout << std::endl << "Audio Thread Done." << std::endl << std::endl;

View File

@ -1,6 +1,6 @@
#pragma once
#define BUF_SIZE (16 * 32 * 256)
#define BUF_SIZE (16 * 32 * 128)
#define SRATE 2000000
#define FFT_SIZE 2048

View File

@ -162,9 +162,10 @@ wxThread::ExitCode DemodulatorThread::Entry() {
break;
}
}
} else {
this->Yield();
this->Sleep(1);
}
Sleep(1000);
}
std::cout << std::endl << "Demodulator Thread Done." << std::endl << std::endl;

View File

@ -1,6 +1,7 @@
#include "SDRThread.h"
#include "CubicSDRDefs.h"
#include <vector>
#include "CubicSDR.h"
//wxDEFINE_EVENT(wxEVT_COMMAND_SDRThread_INPUT, wxThreadEvent);
@ -159,6 +160,9 @@ wxThread::ExitCode SDRThread::Entry() {
} else {
delete new_buffer;
}
} else {
this->Yield();
this->Sleep(1);
}
}
std::cout << std::endl << "Done." << std::endl << std::endl;