Oscilloscope 0.5.0
A simple oscilloscope VST
Loading...
Searching...
No Matches
OscilloscopeComponent.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 OscilloscopeComponent.h
5 Created: 24 Feb 2023 6:47:52pm
6 Author: wadda
7
8 ==============================================================================
9*/
10
11#pragma once
12#include <JuceHeader.h>
13#include "AudioBufferQueue.h"
14#include "PluginProcessor.h"
15#include "InitVariables.h"
16
23class OscilloscopeComponent : public juce::Component, public juce::AudioProcessorValueTreeState::Listener, private juce::Timer
24{
25public:
26 //==============================================================================
32 OscilloscopeComponent(OscilloscopeAudioProcessor &aProcessor, int sampleRate, int framesPerSecond);
33
39
40 //==============================================================================
46 void setFramesPerSecond(int framesPerSecond);
47
48 //==============================================================================
49
57 void drawGrid(juce::Graphics &g, float w, float h);
58
64 void paint(juce::Graphics &g) override;
65
66 //==============================================================================
71 void resized() override;
72
73protected:
75 std::vector<float> sampleData;
77
78private:
79 //==============================================================================
80 int displayLength;
81 std::vector<float> newlyPopped;
82 std::vector<float> notInterpolatedData;
83 std::vector<float> newData;
84 double ratio = 1.;
85 juce::Interpolators::Linear interpolator;
86
93 void parameterChanged(const juce::String &parameterID, float newValue) override;
94
95 //==============================================================================
102 void timerCallback() override;
103
104 //==============================================================================
117 virtual void plot(
118 juce::Graphics &g,
119 juce::Rectangle<float> rect,
120 float scaler = float(1),
121 float offset = float(0)) = 0;
122
129 virtual void subclassSpecificCallback() = 0;
130};
Oscilloscope audio processor.
void paint(juce::Graphics &g) override
void drawGrid(juce::Graphics &g, float w, float h)
OscilloscopeAudioProcessor & audioProcessor
void setFramesPerSecond(int framesPerSecond)
std::vector< float > sampleData