Re-connect scope to demodulator output data

This commit is contained in:
Charles J. Cliffe 2014-11-16 19:14:15 -05:00
parent 1950c3109a
commit 82b6b67f3c
2 changed files with 12 additions and 1 deletions

View File

@ -165,6 +165,16 @@ void AppFrame::OnDemodInput(wxThreadEvent& event) {
AudioThreadTask task = AudioThreadTask(AudioThreadTask::AUDIO_THREAD_DATA);
task.setData(*new_buffer);
threadQueueAudio->addTask(task, AudioThreadQueue::AUDIO_PRIORITY_HIGHEST);
if (scopeCanvas->waveform_points.size() != new_buffer->size() * 2) {
scopeCanvas->waveform_points.resize(new_buffer->size() * 2);
}
for (int i = 0, iMax = new_buffer->size(); i < iMax; i++) {
scopeCanvas->waveform_points[i * 2 + 1] = (*new_buffer)[i] * 0.5f;
scopeCanvas->waveform_points[i * 2] = ((double) i / (double) iMax);
}
} else {
std::cout << "Incoming Demod data empty?" << std::endl;
}

View File

@ -12,6 +12,8 @@
class ScopeCanvas: public wxGLCanvas {
public:
std::vector<float> waveform_points;
ScopeCanvas(wxWindow *parent, int *attribList = NULL);
~ScopeCanvas();
@ -23,7 +25,6 @@ private:
void OnIdle(wxIdleEvent &event);
wxWindow *parent;
std::vector<float> waveform_points;
ScopeContext *glContext;
// event table