ArpUserPattern.h (1050B)
1 #pragma once 2 3 #include "juce_gui_basics/juce_gui_basics.h" 4 5 #include "jucePluginLib/parameterlistener.h" 6 7 namespace pluginLib 8 { 9 class Parameter; 10 class Controller; 11 } 12 13 namespace genericVirusUI 14 { 15 class VirusEditor; 16 17 class ArpUserPattern : public juce::Component 18 { 19 public: 20 using BoundParam = std::pair<pluginLib::Parameter*, pluginLib::ParameterListener>; 21 22 ArpUserPattern(const VirusEditor& _editor); 23 24 void paint(juce::Graphics& g) override; 25 26 void onCurrentPartChanged(); 27 private: 28 void unbindParameters(); 29 void bindParameters(); 30 static void unbindParameter(BoundParam& _parameter); 31 32 BoundParam bindParameter(const std::string& _name); 33 34 void onParameterChanged(); 35 36 struct Step 37 { 38 BoundParam length; 39 BoundParam velocity; 40 BoundParam bitfield; 41 }; 42 43 pluginLib::Controller& m_controller; 44 std::array<Step, 32> m_steps; 45 BoundParam m_patternLength; 46 47 juce::Colour m_colRectFillActive = juce::Colour(0xddffffff); 48 juce::Colour m_colRectFillInactive = juce::Colour(0x77aaaaaa); 49 float m_gradientStrength = 0.0f; 50 }; 51 }