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

softknob.h (1175B)


      1 #pragma once
      2 
      3 #include <cstdint>
      4 
      5 #include "parameterlistener.h"
      6 
      7 namespace pluginLib
      8 {
      9 	class Controller;
     10 
     11 	class SoftKnob
     12 	{
     13 	public:
     14 		baseLib::Event<Parameter*> onBind;
     15 
     16 		SoftKnob(const Controller& _controller, uint8_t _part, uint32_t _parameterIndex);
     17 		~SoftKnob();
     18 
     19 		SoftKnob(const SoftKnob&) = delete;
     20 		SoftKnob(SoftKnob&&) = delete;
     21 		SoftKnob& operator = (const SoftKnob&) = delete;
     22 		SoftKnob& operator = (SoftKnob&&) = delete;
     23 
     24 		bool isValid() const { return m_sourceParam != nullptr && m_targetSelect != nullptr; }
     25 		bool isBound() const { return m_targetParam != nullptr; }
     26 
     27 		Parameter* getParameter() const { return m_sourceParam; }
     28 		Parameter* getTargetParameter() const { return m_targetParam; }
     29 
     30 	private:
     31 		void onTargetChanged();
     32 		void onSourceValueChanged() const;
     33 		void onTargetValueChanged() const;
     34 
     35 		void bind();
     36 		void unbind();
     37 
     38 		const Controller& m_controller;
     39 		const uint8_t m_part;
     40 
     41 		Parameter* m_sourceParam = nullptr;
     42 		Parameter* m_targetSelect = nullptr;
     43 		Parameter* m_targetParam = nullptr;
     44 
     45 		ParameterListener m_sourceParamListener;
     46 		ParameterListener m_targetSelectListener;
     47 		ParameterListener m_targetParamListener;
     48 	};
     49 }