Comment 10 for bug 1136890

Revision history for this message
rob (another-rob) wrote :

OK, figured out a workaround, and figured out why this was happening. Given the messed up return values for connectcontrol, and the "shouldn't happen error", it does seem that there's a bug in the mixxx code, but I've figured out why my connects and triggers weren't working. It happened when I was switching modes, trying to set a hook using engine.connectcontrol where the hook I was setting (eg: hotcue_10_enabled) was assigned to a button/LED in the previous mode, and it hadn't been cleared yet. I had a for loop that functioned like this:

for (each button/LED){
if LED was previously hooked to a mixxx control, then clear the control.
set the new hook.
Trigger the new hook to set the LED state.
go to the next LED
}

I have two hotcue modes. One displays hotcues 1-24, the other displays hotcues 9-32. All hooks point to one function, which figures out which LED to light based on which hotcue triggered the function. The LED setup for loop would fail when switching between these modes - eg: switching from 1-24 to 9-32, button/LED 1 would clear ok (previously hotcue_1_enabled), but connecting it to hotcue_9_enabled would fail, apparently because hotcue_9_enabled is already connected to button/LED 9, and that hasn't been cleared yet (but connectcontrol would return "ControllerEngineConnectionScriptValue(name = "")" instead of false). Then when I trigger hotcue_9, I would get the "shouldn't happen" error.

When the for loop gets to the last set of buttons, it starts working again, because hotcues 25-32 weren't set in the previous mode.

I fixed my script by splitting that into two loops - the first clears all the hooks, then the second for sets new hooks. No more errors. But it seems that there is a bug in mixxx (probably in controllerengine.cpp - the "shouldn't happen" error comes from line 827) given the error messages and the messed up return values for connectcontrol.

In case it's useful, I've attached the pre-fix version of my controller script, with a bunch of debugging code in place. The for loop I described above is in NK2.updateLEDs(), which starts around line 193