In the device we built in the last episode, we had to ‘grab’ the push grid by checking a checkbox, which worked, but isn’t the way the Push is designed to work. Usually things happen automatically - for example, if you point at a simple Utility device, the device will show Live’s standard ‘blue hand’ icon, the Push will instantly acknowledge this and give you control of the device’s parameters, albeit with shortened 8-letter names:
We can also get this kind of behaviour, with almost no effort, in our own max4live devices too! to see this in action, we need to add a few more things to our new device.
Place your mouse to the bottom-left of the p push_grid and type the letter m. This will create a blank message object. Now wire the top-right-hand input of this to the bottom-left output of the p push_grid.
Next, hover somewhere above the p push_grid and type m again. Now double-click this new object and type fbStyle 1 $1. Now wire its bottom-left output to the top-middle input of the p push_grid.
Finally, put your pointer above that, and start typing live. You should see a pop-up list of object names:
Either carry on typing or select a live.numbox then wire that to the left-hand input of the last message object.
Now, go to File and Save As..., choose a name and close the editor window. Your new device will now be displayed in all its glory in Live’s device bar:
Give it a click and you should see the blue hand icon, and the Push’s grid lights will switch off (if this doesn’t happen, just toggle the device on and off).
So, what’s this device for, then? Time to explain...
Tap some of the Push grid buttons, you will see them illuminating under your finger with apparently random colours. Try soft then hard taps and it turns out these are actually linked to the velocity with which the buttons are tapped; this is what the fbStyle 1 0 message is doing. The $1 is replaced with the 0 from the number box object. The 1 means yes, I want visual feedback, the 0 means link the colour to the velocity, and finally piping the whole message into the p push_grid’s middle input makes this actually happen.
The fact that the Push’s grid now has this behaviour is thanks to the Push control when object. With the current option, Device Selected, it will send the number 1 to the right-hand input of the p push_grid when we have a blue hand, and our device will take control of the Push’s grid, which is what we’d want nine times out of ten (there’s also a Track Selected option, which I can’t really imagine using!).
Now to that live.numbox at the top of our device. Something very clever but quite subtle is happening here. Take a look at the display on your Push - you’ll see the first two columns have some stuff in them; and the live.nmbx column is the one we’re interested in. Give the knob above it a twiddle - you’ll see the number change on the Push screen, along with a little bargraph, but - and here’s the clever bit - the number in our device’s live.numbox in Live changes. This works both ways - click and drag the live.numbox up and down in Live and the change is reflected on the Push display.
The brilliant thing is that this happened automatically, without our having to do any mapping by hand. This is happens automatically for all the live. controls in that drop-down earlier, and it means we can build instantly controllable devices with dials, sliders and all the rest - which behave like Live’s built-in devices - with no extra effort!