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

n2xOctLed.cpp (688B)


      1 #include "n2xOctLed.h"
      2 
      3 #include "n2xController.h"
      4 
      5 namespace n2xJucePlugin
      6 {
      7 	OctLed::OctLed(Editor& _editor) : ParameterDrivenLed(_editor, "O2Pitch_LED", "O2Pitch")
      8 	{
      9 		bind();
     10 	}
     11 
     12 	bool OctLed::updateToggleState(const pluginLib::Parameter* _parameter) const
     13 	{
     14 		const auto v = _parameter->getUnnormalizedValue();
     15 		const bool active = v / 12 * 12 == v;
     16 		return active;
     17 	}
     18 
     19 	void OctLed::onClick(pluginLib::Parameter* _targetParameter, bool _toggleState)
     20 	{
     21 		const auto v = _targetParameter->getUnnormalizedValue();
     22 		auto newV = v + 6;
     23 		newV /= 12;
     24 		newV *= 12;
     25 		if(newV != v)
     26 			_targetParameter->setUnnormalizedValueNotifyingHost(newV, pluginLib::Parameter::Origin::Ui);
     27 	}
     28 }