reVeno/Source/Veno/GUI/Components/LCD/Waveforms.h

63 lines
2 KiB
C
Raw Normal View History

//
2020-06-13 10:56:20 +02:00
// Created by versustune on 11.06.20.
//
#ifndef VENO_WAVEFORMS_H
#define VENO_WAVEFORMS_H
#include "JuceHeader.h"
#include "../BaseComponent.h"
#include "DecibelScale.h"
2020-06-13 10:56:20 +02:00
#define RANDOM_TEXT_COUNT 5
// opengl context :D
class Waveforms : public BaseComponent,
private OpenGLRenderer,
private Timer
{
2020-06-13 10:56:20 +02:00
protected:
bool m_enableModeToggle = true;
int m_mode = 0;
std::string m_readyText = "=WELCOME=";
std::string m_warmUpText[RANDOM_TEXT_COUNT] = {"Warmup...", "Mayonnaise", "Dont shake the baby", "Awesome stuff",
"drink beer"};
2020-06-13 10:56:20 +02:00
int pickRandomText = 0;
bool m_isWelcome = true;
bool m_isStarting = true;
int m_ticks = 0;
int m_time_needed_startup = 0;
int m_time_needed = 0;
bool needToClear = false;
2020-07-09 16:31:33 +02:00
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Waveforms);
2020-06-13 10:56:20 +02:00
public:
explicit Waveforms (const std::string& processId);
~Waveforms () override;
void newOpenGLContextCreated () override;
void openGLContextClosing () override;
void renderOpenGL () override;
void mouseDown (const MouseEvent& e) override;
void mouseDrag (const MouseEvent& e) override;
void paint (Graphics& g) override;
void resized () override;
2020-06-13 10:56:20 +02:00
bool m_isChangingData = false;
std::string changingParameter = "";
float changedValue = 0;
private:
void timerCallback () override;
void drawWaveTable ();
void drawAudioOutput ();
void drawSpectrum ();
void drawPeakMeter (); //?!
void drawChangedParameter (Graphics& g, int w, int h, int x, int y) const;
void drawWelcome (Graphics& g, int w, int h, int x, int y);
void compileOpenGLShaderProgram ();
void selectColourByPeak (float value);
2020-06-14 21:14:28 +02:00
float getdBForChannel (float value);
void setFps();
2020-06-13 10:56:20 +02:00
OpenGLContext m_context;
std::unique_ptr<OpenGLShaderProgram> shaderProgram;
std::unique_ptr<DecibelScale> dBScale;
2020-06-14 21:14:28 +02:00
int m_currentFps = 0;
2020-06-13 10:56:20 +02:00
};
#endif //VENO_WAVEFORMS_H