From 8dfd94df8dd893dc70a4948f3955399df904a0c3 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Fri, 31 Jul 2015 21:33:31 -0400 Subject: [PATCH] ScopeVisualProcessor cleanup --- src/process/ScopeVisualProcessor.cpp | 35 +++++++++++- src/process/ScopeVisualProcessor.h | 80 ---------------------------- 2 files changed, 34 insertions(+), 81 deletions(-) delete mode 100644 src/process/ScopeVisualProcessor.h diff --git a/src/process/ScopeVisualProcessor.cpp b/src/process/ScopeVisualProcessor.cpp index 89af21c..c3ffbc9 100644 --- a/src/process/ScopeVisualProcessor.cpp +++ b/src/process/ScopeVisualProcessor.cpp @@ -1 +1,34 @@ -#include "ScopeVisualProcessor.h" \ No newline at end of file +#include "ScopeVisualProcessor.h" + +void ScopeVisualProcessor::process() { + if (isOutputEmpty()) { + return; + } + if (!input->empty()) { + AudioThreadInput *audioInputData; + input->pop(audioInputData); + + if (!audioInputData) { + return; + } + int iMax = audioInputData->data.size(); + if (!iMax) { + audioInputData->decRefCount(); + return; + } + + ScopeRenderData *renderData = outputBuffers.getBuffer(); + renderData->channels = audioInputData->channels; + + if (renderData->waveform_points.size() != iMax * 2) { + renderData->waveform_points.resize(iMax * 2); + } + + for (int i = 0; i < iMax; i++) { + renderData->waveform_points[i * 2 + 1] = audioInputData->data[i] * 0.5f; + renderData->waveform_points[i * 2] = ((double) i / (double) iMax); + } + + distribute(renderData); + } +} diff --git a/src/process/ScopeVisualProcessor.h b/src/process/ScopeVisualProcessor.h deleted file mode 100644 index 44262ab..0000000 --- a/src/process/ScopeVisualProcessor.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include "VisualProcessor.h" -#include "AudioThread.h" - -class ScopeRenderData: public ReferenceCounter { -public: - std::vector waveform_points; - int channels; -}; - -typedef ThreadQueue ScopeRenderDataQueue; - -class ScopeVisualProcessor : public VisualProcessor { -protected: - virtual void process() { - if (isOutputEmpty()) { - return; - } - if (!input->empty()) { - AudioThreadInput *audioInputData; - input->pop(audioInputData); - - if (!audioInputData) { - return; - } - int iMax = audioInputData->data.size(); - if (!iMax) { - audioInputData->decRefCount(); - return; - } - - ScopeRenderData *renderData = outputBuffers.getBuffer(); - renderData->channels = audioInputData->channels; - - if (renderData->waveform_points.size() != iMax * 2) { - renderData->waveform_points.resize(iMax * 2); - } - - for (int i = 0; i < iMax; i++) { - renderData->waveform_points[i * 2 + 1] = audioInputData->data[i] * 0.5f; - renderData->waveform_points[i * 2] = ((double) i / (double) iMax); - } - - distribute(renderData); - // ati->channels - } - } - - ReBuffer outputBuffers; -}; - - -/* - if (!wxGetApp().getAudioVisualQueue()->empty()) { - AudioThreadInput *demodAudioData; - wxGetApp().getAudioVisualQueue()->pop(demodAudioData); - - int iMax = demodAudioData?demodAudioData->data.size():0; - - if (demodAudioData && iMax) { - if (waveform_points.size() != iMax * 2) { - waveform_points.resize(iMax * 2); - } - - demodAudioData->busy_update.lock(); - - for (int i = 0; i < iMax; i++) { - waveform_points[i * 2 + 1] = demodAudioData->data[i] * 0.5f; - waveform_points[i * 2] = ((double) i / (double) iMax); - } - - demodAudioData->busy_update.unlock(); - - setStereo(demodAudioData->channels == 2); - } else { - std::cout << "Incoming Demodulator data empty?" << std::endl; - } - } -*/