kopia lustrzana https://github.com/jameshball/osci-render
Remove unneccessary reattach code
rodzic
dcfba66f00
commit
dc9fe17c1c
|
@ -12,8 +12,7 @@
|
|||
#include "TexturedVertexShader.glsl"
|
||||
|
||||
VisualiserComponent::VisualiserComponent(AudioBackgroundThreadManager& threadManager, VisualiserSettings& settings, VisualiserComponent* parent, bool visualiserOnly) : settings(settings), threadManager(threadManager), visualiserOnly(visualiserOnly), AudioBackgroundThread("VisualiserComponent", threadManager), parent(parent) {
|
||||
setShouldBeRunning(true);
|
||||
|
||||
|
||||
addAndMakeVisible(record);
|
||||
record.setPulseAnimation(true);
|
||||
record.onClick = [this] {
|
||||
|
@ -55,6 +54,12 @@ VisualiserComponent::VisualiserComponent(AudioBackgroundThreadManager& threadMan
|
|||
|
||||
openGLContext.setRenderer(this);
|
||||
openGLContext.attachTo(*this);
|
||||
|
||||
std::vector<OsciPoint> initBuffer;
|
||||
initBuffer.resize(1024, OsciPoint(0, 0, 0));
|
||||
setBuffer(initBuffer);
|
||||
|
||||
setShouldBeRunning(true);
|
||||
}
|
||||
|
||||
VisualiserComponent::~VisualiserComponent() {
|
||||
|
@ -78,10 +83,7 @@ void VisualiserComponent::mouseDoubleClick(const juce::MouseEvent& event) {
|
|||
|
||||
void VisualiserComponent::setBuffer(const std::vector<OsciPoint>& buffer) {
|
||||
juce::CriticalSection::ScopedLockType lock(samplesLock);
|
||||
|
||||
if (xSamples.size() != buffer.size()) {
|
||||
needsReattach = true;
|
||||
}
|
||||
|
||||
xSamples.clear();
|
||||
ySamples.clear();
|
||||
zSamples.clear();
|
||||
|
@ -267,11 +269,6 @@ void VisualiserComponent::handleAsyncUpdate() {
|
|||
zResampler.process(zSamples.data(), smoothedZSamples.data(), zSamples.size());
|
||||
}
|
||||
|
||||
if (needsReattach) {
|
||||
openGLContext.detach();
|
||||
openGLContext.attachTo(*this);
|
||||
needsReattach = false;
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ private:
|
|||
int nEdges = 0;
|
||||
|
||||
juce::CriticalSection samplesLock;
|
||||
bool needsReattach = true;
|
||||
std::vector<float> xSamples{2};
|
||||
std::vector<float> ySamples;
|
||||
std::vector<float> zSamples;
|
||||
|
|
|
@ -13,7 +13,7 @@ class VisualiserParameters {
|
|||
public:
|
||||
BooleanParameter* graticuleEnabled = new BooleanParameter("Show Graticule", "graticuleEnabled", VERSION_HINT, true, "Show the graticule or grid lines over the oscilloscope display.");
|
||||
BooleanParameter* smudgesEnabled = new BooleanParameter("Show Smudges", "smudgesEnabled", VERSION_HINT, true, "Adds a subtle layer of dirt/smudges to the oscilloscope display to make it look more realistic.");
|
||||
BooleanParameter* upsamplingEnabled = new BooleanParameter("Upsample Audio", "upsamplingEnabled", VERSION_HINT, true, "Upsamples the audio before visualising it to make it appear more realistic, at the expense of performance.");
|
||||
BooleanParameter* upsamplingEnabled = new BooleanParameter("Upsample Audio", "upsamplingEnabled", VERSION_HINT, false, "Upsamples the audio before visualising it to make it appear more realistic, at the expense of performance.");
|
||||
BooleanParameter* sweepEnabled = new BooleanParameter("Sweep", "sweepEnabled", VERSION_HINT, true, "Plots the audio signal over time, sweeping from left to right");
|
||||
BooleanParameter* visualiserFullScreen = new BooleanParameter("Visualiser Fullscreen", "visualiserFullScreen", VERSION_HINT, false, "Makes the software visualiser fullscreen.");
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue