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

n2xLcd.h (1106B)


      1 #pragma once
      2 
      3 #include <string>
      4 
      5 #include "baseLib/event.h"
      6 
      7 #include "juce_events/juce_events.h"
      8 
      9 namespace juce
     10 {
     11 	class Label;
     12 }
     13 
     14 namespace n2xJucePlugin
     15 {
     16 	class Editor;
     17 
     18 	class Lcd : juce::Timer
     19 	{
     20 	public:
     21 		enum class AnimState
     22 		{
     23 			Start,
     24 			Scroll,
     25 			End
     26 		};
     27 
     28 		explicit Lcd(Editor& _editor);
     29 
     30 		void setText(const std::string& _text);
     31 
     32 		void timerCallback() override;
     33 
     34 		void updatePatchName();
     35 
     36 		void setOverrideText(const std::string& _text);
     37 
     38 	private:
     39 		void setClippedText(const std::string& _text);
     40 		static std::string substring(const std::string& _text, uint32_t _offset, uint32_t _len);
     41 		bool updateClippedText(const std::string& _text, uint32_t _offset);
     42 		void startAnim();
     43 		void onTextChanged();
     44 		void onProgramChanged();
     45 		const std::string& getCurrentText() const;
     46 
     47 		Editor& m_editor;
     48 		juce::Label* m_label;
     49 		std::string m_text;
     50 		std::string m_clippedText;
     51 		uint32_t m_currentOffset = 0;
     52 		AnimState m_animState = AnimState::Start;
     53 
     54 		std::string m_overrideText;
     55 
     56 		baseLib::EventListener<> m_onProgramChanged;
     57 		baseLib::EventListener<uint8_t> m_onPartChanged;
     58 	};
     59 }