I’m finally using controlP5 in earnest, and I noticed that two-finger trackpad scrolling over a knob didn’t dial the knob, like I’d hoped it would. (Thanks to Ben Oakes, again, for showing me - just yesterday afternoon - that Ubuntu’s volume icon supports this. That was the trigger that got me wondering about this.)

It turns out controlP5 does let you turn knobs with the mouse wheel, but, for some reason, it’s disabled by default. There’s an example sketch, “ControlP5mouseWheel”, that shows how to enable it, but it doesn’t work for me with Processing 2.2. The problematic part is the addMouseWheelListener() callback that mucks with java.awt.event stuff.

Here’s a Processing 2.2-style mouseWheel callback event that gets us back to turning knobs by scrolling:

 1 // When working in desktop mode, you can add mousewheel
 2 // support for controlP5 by using Processing 2.2's built-in
 3 // support:
 4 void mouseWheel(MouseEvent e) {
 5   // Processing's `getCount()` returns 1 when the mouseWheel
 6   // is rotated down, and -1 when the mouseWheel is rotated
 7   // up. Natural scrolling reverses this, so you need to
 8   // negate the count value. Try removing the negation, if
 9   // the scrolling is backwards for you.
10   cp5.setMouseWheelRotation(-e.getCount());
11 }

While I was at it, I noticed that controlP5 is still hosted on the retired google-code platform, so I exported it to my github account. I expect Andreas will export it to his own soon enough, and I can fork his version then, and merge in my update to the ControlP5mouseWheel example sketch.