mixxxdj / manual

The Mixxx Manual
https://manual.mixxx.org/
50 stars 117 forks source link

[MIDI scripting] Wrong info about controller ID in the doc #118

Open nm2107 opened 4 years ago

nm2107 commented 4 years ago

Hello :wave:

The documentation about MIDI scripting states that the id parameter received in the controller's init function is what is defined in the related xml file, but actually the given value is the name of the controller that is listed in the Controllers tab in mixxx's preferences.

What the doc says :

The ID parameter of the init function is the controller id attribute from the XML file.
This can be used to identify the particular controller instance in print statements.

What is actually passed : https://github.com/mixxxdj/mixxx/blob/fa797d239d4331d13ca73863391262612ea5d5ed/src/controllers/engine/controllerengine.cpp#L277-L282

Is it possible to fix the doc (or even better, to change mixxx behavior to match the doc ?)

Be-ing commented 4 years ago

We could consider changing either the documentation or the behavior... what are you using this info for in your script?

nm2107 commented 4 years ago

Hello, thank you for your answer.

I'd like to be able to get the identifier of a specific deck (i.e. passed by the <controller id="XXX"> XML attribute). I have one XML file per deck, as the MIDI channel to use is specific to a deck (I'm using a pair of single deck controllers).

See https://github.com/nm2107/mixxx-midi-mappings/blob/6fde2721649050d7959aaca24f653950805db2cd/src/single-deck/Denon-SC3900/scripts.js#L264-L295

For now, I'm using the script's init function by assuming that all the decks are connected to this kind of controller hardware, but it's a blind assumption. It would be better to be able to only identify the related deck by retrieving its ID (given as the init fn parameter). This way, I could pass [Channel1] as the ID for deck 1, and [Channel2] as the ID for deck 2, so the init fn would only target the related deck for LED initialization.

Be-ing commented 4 years ago

To clarify, is the issue that the MIDI channel identifying the deck number is not received until the first MIDI message is received?

nm2107 commented 4 years ago

To clarify, is the issue that the MIDI channel identifying the deck number is not received until the first MIDI message is received?

yes, exactly :+1: