MCPcopy Create free account
hub / github.com/VCVRack/Befaco / setLightHSBSmooth

Method setLightHSBSmooth

src/MotionMTR.cpp:186–216  ·  view source on GitHub ↗

hue: 0 - 360

Source from the content-addressed store, hash-verified

184
185 // hue: 0 - 360
186 void setLightHSBSmooth(int lightId, const ProcessArgs& args, float H, float S, float V) {
187
188 float C = S * V;
189 float X = C * (1 - std::abs(std::fmod(H / 60.0, 2) - 1));
190 float m = V - C;
191 float r, g, b;
192 if (H >= 0 && H < 60) {
193 r = C, g = X, b = 0;
194 }
195 else if (H >= 60 && H < 120) {
196 r = X, g = C, b = 0;
197 }
198 else if (H >= 120 && H < 180) {
199 r = 0, g = C, b = X;
200 }
201 else if (H >= 180 && H < 240) {
202 r = 0, g = X, b = C;
203 }
204 else if (H >= 240 && H < 300) {
205 r = X, g = 0, b = C;
206 }
207 else {
208 r = C, g = 0, b = X;
209 }
210
211 float R = (r + m);
212 float G = (g + m);
213 float B = (b + m);
214
215 setLightRGBSmooth(lightId, args, R, G, B);
216 }
217
218 void lightsForSignal(LightDisplayType type, const LightId lightId, float signal, const ProcessArgs& args, const int channel) {
219

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected