bramdebouvere / fltouch

FL Studio MIDI controller scripts for the Behringer X-Touch + extenders (MCU)
The Unlicense
11 stars 4 forks source link

Scaled hsv #23

Closed rtosman closed 9 months ago

rtosman commented 9 months ago

Noticed there was a fundamental issue with the RgbToHsv transform that resulted in wrapping the hue value (which resulted in discontinuities in the hue space and exceptions in the color mapping code).

Rewrote the RgbToHsv function to produce linear hue values and then implemented the color mapping as a table.

It is, of course, subjective as to where the color space splits are, but it is an easily modifiable table that requires no code changes (just data) to tweak mappings if necessary.

I changed the pink identifier to purple as the color on the device here definitely seems more purple than pink.

Added a unit test

Joe9mm commented 9 months ago

Hello friend, I hope you have a good day. I bought a new Icon brand controller with an extender. I tried your code and something works. I wanted to ask you a favor if you could help me so that my new controller works. Sorry for my English. Google translated it.

bramdebouvere commented 9 months ago

Hey, thanks for your pull request. I did update the color table a little after merging, because red (in FL) was showing up as yellow (on the device) here. But like you say, it can of course be subjective. In any case, great work!