ScopeVisualProcessor cleanup

This commit is contained in:
Charles J. Cliffe
2015-07-31 21:33:31 -04:00
parent 6f3d9a6c82
commit 8dfd94df8d
2 changed files with 34 additions and 81 deletions
+34 -1
View File
@@ -1 +1,34 @@
#include "ScopeVisualProcessor.h"
#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);
}
}