getPrimaryDevice not always working?

Post Reply New Topic
RELATED
PRODUCTS

Post

So, in my midi callback function I'm trying to reach the primary device of a track:

Code: Select all

trackBank.getChannel(channelIdx).getMute().toggle();
trackBank.getChannel(channelIdx).getPrimaryDevice().getMacro(0).getAmount().set(0, 128);
While the first line is working flawlessly, and I can toggle the track mute, the second doesn't do anything. The macro is not set to 0. Am I doing something wrong?

I can only make 'getPrimaryDevice' function work in the 'init' function. Is this expected?

Post

First, you should replace the 'getPrimaryDevice' call - it's deprecated. The API doc shows what to use instead.
Then, nothing is wrong with putting CursorDevices into variables *once* during init and reusing those inside your midi callback. Just do it ;).

Post

Yeah, that's what I ended up doing. Creating a bunch of CursorDevices using createCursorDevice and then moving them between different tracks using selectFirstInChannel as needed :)
Works like a charm!

Although I noticed that when switching between tracks and immediately changing macros, sometimes the CursorDevice is not keeping up and the wrong macro get changed. I fixed that by creating one CursorDevice for each group of tracks that is gonna be modulated together.

Post Reply

Return to “Controller Scripting”