gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

led.h (620B)


      1 #pragma once
      2 
      3 #include "juce_events/juce_events.h"
      4 
      5 namespace juce
      6 {
      7 	class Component;
      8 }
      9 
     10 namespace jucePluginEditorLib
     11 {
     12 	class Led : public juce::Timer
     13 	{
     14 	public:
     15 		using SourceCallback = std::function<float()>;
     16 
     17 		Led(juce::Component* _targetAlpha, juce::Component* _targetInvAlpha = nullptr);
     18 
     19 		void setValue(float _v);
     20 
     21 		void timerCallback() override;
     22 
     23 		void setSourceCallback(SourceCallback&& _func, int _timerMilliseconds = 1000/60);
     24 
     25 	private:
     26 		void repaint() const;
     27 
     28 		juce::Component* m_targetAlpha;
     29 		juce::Component* m_targetInvAlpha;
     30 
     31 		float m_value = -1.0f;
     32 
     33 		SourceCallback m_sourceCallback;
     34 	};
     35 }