Skip to content

MIDI for light: add settings ui#13721

Merged
fwcd merged 3 commits into
mixxxdj:2.5from
ekordas:MIDI-for-light-add-settings-ui
Dec 9, 2024
Merged

MIDI for light: add settings ui#13721
fwcd merged 3 commits into
mixxxdj:2.5from
ekordas:MIDI-for-light-add-settings-ui

Conversation

@ekordas
Copy link
Copy Markdown
Contributor

@ekordas ekordas commented Oct 6, 2024

Adds Setting definition for UI of the Midi for Light Script

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Oct 6, 2024

Thank you for this PR.
Please sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

Do you mind attaching a screenshot of the new settings?

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 6, 2024

I allready signed the agreement.

Here is a screenshot:
midi_for_light-settings

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Oct 6, 2024

Okay, thank you, I didn't remember you already worked on MIDI for lights.

The VU checkboxes could use more human-readable labels, not just the internal variable names, no?

I didn't work with the controller settings, yet, wasn't there an option/flag that would arange group items horizontally if the preference page allows it?

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 6, 2024

I didnt work with the controller settings either, If there is a documentation for it i can set other flags. Leaving the Orientation to unset flipps checkboxes to a row while resizing the settings wich is really destroying the layout:
Bildschirmfoto vom 2024-10-07 00-00-49
So i leave it to vertical.
The Labels are changed in the next commit.

@JoergAtGithub
Copy link
Copy Markdown
Member

If there is a documentation for it i can set other flags.

@acolombier Do we have this described in the manual?

The best reference is the mapping for the S4 Mk3: #12995

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 6, 2024

The Mapping xml file is described at https://github.com/mixxxdj/mixxx/wiki/MIDI%20controller%20mapping%20file%20format but not the ui Stuff. I Used the mentioned diff as reference.

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 6, 2024

The<row orientation="vertical">seems to do the intended behavior, but if the vertical list of checkboxes is flipped to a row it does not flip back. And it does not matter how slim you resize the window.
The section above does change to a row if the Size allows it and back, but it seems there is a Problem with a long list of checkboxes.
Since the script is more aimed at developers and technical applications I personally would not bother making it pretty to much. It only requires a little scrolling.
Following is a new attempt:
Bildschirmfoto vom 2024-10-07 00-52-49

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 26, 2024

Is anything missing or is everyone OK with the design?

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Oct 26, 2024

I'm not familiar with controller settings.
@JoergAtGithub wdyt?

@JoergAtGithub JoergAtGithub requested a review from fwcd October 26, 2024 22:17
@JoergAtGithub
Copy link
Copy Markdown
Member

The settings syntax looks goot to me. But I'm not familar with MIDI for Light.

var enable_vu_right_average_meter = false; // set to false if you not need VU right average meter
var deck_ending_time = 15; // set a time (in seconds) in which the playing track is considered to be ending
var deck_ending_priority_factor = 0.9; // decrease the priority of the ending track by this factor
var midi_channel = engine.getSetting("midi_channel"); // set midi_channel. Valid range: 1 to 16.
Copy link
Copy Markdown
Member

@fwcd fwcd Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In previous mappings we've "defensively" added the default values here too (either using the nullish coalescing operator ?? or ||), even though we've already declared them in the XML.

I don't think that should be necessary, so this looks good to me, but just to confirm, is this safe @acolombier?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, the default values there were only necessarry for backward compatibility of the mapping to 2.4 without the controller settings feature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting, so engine.getSetting was already available in 2.4, but invocations always returned undefined?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not exist in 2.4, and is therefore undefined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't call undefined without getting a TypeError though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm the mapping does not work with the proposed fallback. Changing the line to
var midi_channel = engine.getSetting("midi_channel") || 1;
causes an error in Version 2.4:
Uncaught exception: file:///C:/Program Files/Mixxx/controllers/Midi_for_light-scripts.js:19: TypeError: Property 'getSetting' of object ControllerScriptInterfaceLegacy(0x16b9d336520) is not a function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var midi_channel = engine.getSetting ? engine.getSetting("midi_channel") : 1; seems to work

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on how new the JS engine is you might be able to do

engine.getSetting?.("midi_channel") ?? 1

But tbh if we're merging this to 2.5, it shouldn't be needed anyway (and I don't think there'll be many 2.4 releases anymore apart from minor bug fixes)

@acolombier
Copy link
Copy Markdown
Member

I have added some documentation in the wiki, hopefully this can help refining the UI a bit.

@ekordas
Copy link
Copy Markdown
Contributor Author

ekordas commented Oct 28, 2024

So, should I
a) implement a fallback and re target to 2.4 (previous underlying patch was considered to go into 2.5) or
b) leave target to 2.4
and

  1. retouch the ui? (Personally i am quite happy now...) or
  2. you have some style issues to fix? or
  3. leave as is?

@fwcd
Copy link
Copy Markdown
Member

fwcd commented Oct 28, 2024

I'd say targeting 2.5 is fine, along with keeping everything as is. From a quick glance the PR looks good, I'll see if I find some time to test it soon.

@fwcd
Copy link
Copy Markdown
Member

fwcd commented Dec 9, 2024

I have tested this in QLC+1 and it seems to work well. Thanks!

Footnotes

  1. Just in case anyone else wants to experiment with this, here's a workspace that maps every MIDI control (it's a bit fiddly to do that manually): Mixxx MIDI.qxw.zip This is configured to use a device named "Loop", which is a small virtual MIDI device created by another small tool I wrote: https://github.com/fwcd/midiloop

@fwcd fwcd merged commit b7211ee into mixxxdj:2.5 Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants