heronarts / LX

Core library for 3D LED lighting engines
https://chromatik.co/
Other
41 stars 25 forks source link

Add palette editing to APC40Mk2 #51

Closed raldi closed 2 years ago

raldi commented 2 years ago

I tried recording a video of this code in action, but despite all white-balance-adjustment efforts, I couldn't get the APC's button lights to look onscreen like anything other than uniform shades of white. Instead, here are instructions for making your own walking tour:

  1. Open up a project and give it an interesting main palette and a couple extra swatches on the side
  2. Press DEV LOCK. Your side swatches should now appear in the channel grid, and the main palette swatch on the SCENE LAUNCH column to the right.
  3. Turn CUE LEVEL both with and without SHIFT and note how the APC's button changes color in sync with the onscreen copy.
  4. Tap the third (or whatever) row of the SCENE LAUNCH column. This marks the corresponding palette entry as the new focusColor.
  5. Repeat Step 3 and note that the knob is now controlling the focusColor.
  6. Tap the illuminated Channel Focus button beneath one of your side swatch columns in the grid. That should set this swatch as the main one.
  7. Tap one of the illuminated rows in the grid. This copies its color to the clipboard.
  8. Tap one of the rows in the SCENE LAUNCH column. This pastes the color from the clipboard. (It also still marks it as the focusColor, so you can tweak it with the CUE LEVEL knob.)
  9. Tap another one. It'll paste again.
  10. Tap STOP ALL CLIPS. This clears the clipboard, so now if you tap a color in the main palette, it'll only give it focus.
  11. Turn the TEMPO knob one notch. The whole grid should light up in a rainbow of colors.
  12. Turn the knob some more. The rainbow should scroll.
  13. Tap any of these rainbow colors and it'll be copied to the clipboard. As before, tap a row in the SCENE LAUNCH column to paste it and turn the CUE LEVEL knob to tweak.
  14. Tap the TAP TEMPO button to turn off Rainbow Mode.
  15. Press DEV LOCK to get out of palette mode. (Or BANK, to switch from palette mode to bank mode.)

The most glaring problem remaining is that the RGB values in APC's spec seem kind of bonkers. It may very well be the values being sent to their LEDs, but due to issues of gamma correction or what-have-you, the actual observed result of comparing the illuminated buttons to onscreen representations of their RGB values often shows wild discrepancies. I might have to just go through all 128 colors and rewrite their supposed RGB values to match what my own eye is seeing.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

raldi commented 2 years ago

I'm redesigning the rainbow picker. The old one was based on the built-in colors of the APC, but who cares about that? The new one will let you scroll through the HSB colorspace, with 72 hues of columns you can scroll through with the Tempo knob, and for each hue, there are five sat/bri combos. The APC will display them with as much fidelity as the hardware supports, and then when you pick one, the color on the clipboard will be the precise HSB for that square, regardless of the APC's limited palette.

raldi commented 2 years ago

Also working on rebasing this off the dev branch. If you have the time, though, I'd appreciate a UX / design review of the PR as-is, and I'll integrate your feedback into the next revision.

raldi commented 2 years ago

Rebased off the dev branch and redesigned the color picker.

mcslee commented 2 years ago

Also to clarify my suggestion the GridMode stuff - I think it's probably worth actually making that a member variable of the class, and having the value set + update when either the BANK or the DEVICE_LOCK button is pushed.

That way all of the other code that's checking those things can simply check: if (this.gridMode == GridMode.WHICHEVER)

And there can be: private void setGridMode()

invoked when either BANK or DEV LOCK is pressed, and it can deal with updating this.gridMode and performing all of the necessary side-effect operations.

raldi commented 2 years ago

I have some big ideas involving dynamic colors, but I'd like to get this PR in first and then I'll write them up for your consideration.

Next iteration of this PR is up.

mcslee commented 2 years ago

Good stuff, just merged and made a few very minor cleanups. Some of that bank-vs-device button stuff could perhaps go into the updateGridMode() method to ensure that they are always consistent, but I think it's fine how you've done it.

https://github.com/heronarts/LX/commit/0fcb6a546ed6a65edeb8836fdc7382a05505afbf

Ping me about dynamic colors whenever you like!