midi feedback with midi-cat for buttons and switches

hey,

I’m using midi-cat to map 54 buttons and switches from a launchpad x. I require midi feedback so that least this rather complex configuration is loaded onto my controller at startup. Using midi-mon, I can see continuous knob changes being sent back to the controller, but buttons and switches do nothing but send the previously sent message from the midi controller backed to it. If I map a switch through cv-pam and into cv-midi, I can get it to work but with this many parameters I prefer not to do it this way. how can I get my switches to show up properly in midi feedback? If it helps I’m the developer of the module in question so I can change my switches to be compliant if need be.

1 Like

I found this in the code for midi-cat.

How can I work around this? @stoermelder, I’m a big fan but this is preventing me from using 8face lol (because all my lights are wrong after I change presets).

(sorry didnt mean to page you and demand help, just at-ing you in case you’re interested)

	virtual T getValue() {
		float f = paramQuantity->getScaledValue();
		if (isNear(valueOut, f)) return valueIn;
		// Reset the internal values to the actual parameter's value in case 
		// getValue() is called before setValue() - for proper MIDI feedback
		if (valueOut == std::numeric_limits<float>::infinity()) value = valueOut = f;
		// If a parameter is snapped then the returned value of ParaQuantity can't be trusted
		// -> simply return the input value
		if (paramQuantity->snapEnabled) f = valueOut;

		f = rescale(f, min, max, limitMin, limitMax);
		f = clamp(f, limitMin, limitMax);
		T i = T(f);
		if (valueIn == uninit) valueIn = i;
		return i;
	}

I remove that code and recompiled the module and it works like a charm

Sounds like a requst for an option to bypass that bit of code.

1 Like

I solved my problem, but its in a shared class in bens code, so maybe i broke something else. Ill leave it to the experts to decide if this is worth fixing, or if i should just change my code. works good enough for me now. Cheers.

I need a bit of context here - I don’t understand what you mean by „all lights are wrong“ and I’m not sure if you are talking about 8FACE or MIDI-CAT.
Removing this definitely breaks something with MIDI feedback. What exactly did you remove to get it working? (not sure what „working“ means in this situation)

Sorry for the late response. I removed this

if (paramQuantity->snapEnabled) f = valueOut

Let me see if I can be clear here. The following is without my change.

I’m using a launchpad x. The module I’m controlling has many switches, snap knobs and buttons. When I initialize my patch it initialializes the lights on LPX to the correct state, and when i press buttons it sets the lights properly. However, if I use 8face and change the state of the buttons on the module without the LPX’s input, the LPX lights dont get set to match the new state (set by 8face). According to midimon, midicat is just sending back to the LPx the previously value received from the LPX. This is due to the code above. Btw, continuous parameters “just work”.

8face i dont think is the problem. Right click randomize is the same. As is me pressing switches with the mouse. 8face is relavent only because i use it in performance.

With my “fix” it works, in the sense that i can use 8face and the LPX lights change to match the preset. I’ve recorded many hours and two live shows in this config (living on the edge, I know). I’m definately interested to know if I’m vulnerable to any bugs like this, but it seems to work fine.

Btw, the module being controlled by midicat is my LameJuis. Its totally possible I messed up the code somehow.

I think I finally understand what the code is supposed to do, and why it’s there.

Imagine you have a controller with a button that when pressed outputs a cc value of 10 and lights up when it receives a cc value of 10. You assign this cc to a snap knob, which will do some rounding with decides its position after which the knob position corresponds to a cc value of 11. If you send 11 back to the controller, the light turns off. The code above will cause 10 to be sent back to the controller. I didn’t notice this because when I configured my controller, I was very careful about calculating the cc values that it should expect. So not reading values for snap knobs will give slightly misconfigured controllers a much better experience, but it’s not a full solution since it doesn’t handle patch initialization (in my example 11 will be sent back to the controller on initialization).

Every controller is its own special snowflake, its kind of incredible this works as well as it does. I have a much greater appreciation for the complexity of midi interfaces now.