Skip to content

Commit

Permalink
Merge pull request #13721 from ekordas/MIDI-for-light-add-settings-ui
Browse files Browse the repository at this point in the history
MIDI for light:  add settings ui
  • Loading branch information
fwcd authored Dec 9, 2024
2 parents 3921734 + 55d8f6e commit b7211ee
Show file tree
Hide file tree
Showing 2 changed files with 300 additions and 32 deletions.
64 changes: 32 additions & 32 deletions res/controllers/Midi_for_light-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ function midi_for_light() {}
///////////////////////////////////////////////////////////////
// USER OPTIONS //
///////////////////////////////////////////////////////////////
var midi_channel = 1; // set midi_channel. Valid range: 1 to 16.
var enable_beat = true; // set to false if you not need beat
var enable_bpm = true; // set to false if you not need BPM
var enable_mtc_timecode = false; // set to false if you not need midi time code
var enable_vu_mono_current = false; // set to false if you not need VU mono current
var enable_vu_mono_average_min = false; // set to false if you not need VU mono average min
var enable_vu_mono_average_mid = false; // set to false if you not need VU mono average mid
var enable_vu_mono_average_max = false; // set to false if you not need VU mono average max
var enable_vu_mono_average_fit = true; // set to false if you not need VU mono average fit
var enable_vu_mono_current_meter = false; // set to false if you not need VU mono current meter
var enable_vu_mono_average_meter = true; // set to false if you not need VU mono average meter
var enable_vu_left_current = false; // set to false if you not need VU left current
var enable_vu_left_average_min = false; // set to false if you not need VU left average min
var enable_vu_left_average_mid = false; // set to false if you not need VU left average mid
var enable_vu_left_average_max = false; // set to false if you not need VU left average max
var enable_vu_left_average_fit = true; // set to false if you not need VU left average fit
var enable_vu_left_current_meter = false; // set to false if you not need VU left current meter
var enable_vu_left_average_meter = false; // set to false if you not need VU left average meter
var enable_vu_right_current = false; // set to false if you not need VU right current
var enable_vu_right_average_min = false; // set to false if you not need VU right average min
var enable_vu_right_average_mid = false; // set to false if you not need VU right average mid
var enable_vu_right_average_max = false; // set to false if you not need VU right average max
var enable_vu_right_average_fit = true; // set to false if you not need VU right average fit
var enable_vu_right_current_meter = false; // set to false if you not need VU right current meter
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.
var enable_beat = engine.getSetting("enable_beat"); // set to false if you not need beat
var enable_bpm = engine.getSetting("enable_bpm"); // set to false if you not need BPM
var enable_mtc_timecode = engine.getSetting("enable_mtc_timecode"); // set to false if you not need midi time code
var deck_ending_time = engine.getSetting("deck_ending_time"); // set a time (in seconds) in which the playing track is considered to be ending
var deck_ending_priority_factor = engine.getSetting("deck_ending_priority_factor"); // decrease the priority of the ending track by this factor
var enable_vu_mono_current = engine.getSetting("enable_vu_mono_current"); // set to false if you not need VU mono current
var enable_vu_mono_average_min = engine.getSetting("enable_vu_mono_average_min"); // set to false if you not need VU mono average min
var enable_vu_mono_average_mid = engine.getSetting("enable_vu_mono_average_mid"); // set to false if you not need VU mono average mid
var enable_vu_mono_average_max = engine.getSetting("enable_vu_mono_average_max"); // set to false if you not need VU mono average max
var enable_vu_mono_average_fit = engine.getSetting("enable_vu_mono_average_fit"); // set to false if you not need VU mono average fit
var enable_vu_mono_current_meter = engine.getSetting("enable_vu_mono_current_meter"); // set to false if you not need VU mono current meter
var enable_vu_mono_average_meter = engine.getSetting("enable_vu_mono_average_meter"); // set to false if you not need VU mono average meter
var enable_vu_left_current = engine.getSetting("enable_vu_left_current"); // set to false if you not need VU left current
var enable_vu_left_average_min = engine.getSetting("enable_vu_left_average_min"); // set to false if you not need VU left average min
var enable_vu_left_average_mid = engine.getSetting("enable_vu_left_average_mid"); // set to false if you not need VU left average mid
var enable_vu_left_average_max = engine.getSetting("enable_vu_left_average_max"); // set to false if you not need VU left average max
var enable_vu_left_average_fit = engine.getSetting("enable_vu_left_average_fit"); // set to false if you not need VU left average fit
var enable_vu_left_current_meter = engine.getSetting("enable_vu_left_current_meter"); // set to false if you not need VU left current meter
var enable_vu_left_average_meter = engine.getSetting("enable_vu_left_average_meter"); // set to false if you not need VU left average meter
var enable_vu_right_current = engine.getSetting("enable_vu_right_current"); // set to false if you not need VU right current
var enable_vu_right_average_min = engine.getSetting("enable_vu_right_average_min"); // set to false if you not need VU right average min
var enable_vu_right_average_mid = engine.getSetting("enable_vu_right_average_mid"); // set to false if you not need VU right average mid
var enable_vu_right_average_max = engine.getSetting("enable_vu_right_average_max"); // set to false if you not need VU right average max
var enable_vu_right_average_fit = engine.getSetting("enable_vu_right_average_fit"); // set to false if you not need VU right average fit
var enable_vu_right_current_meter = engine.getSetting("enable_vu_right_current_meter"); // set to false if you not need VU right current meter
var enable_vu_right_average_meter = engine.getSetting("enable_vu_right_average_meter"); // set to false if you not need VU right average meter

///////////////////////////////////////////////////////////////
// GLOBAL FOR SCRIPT, DON'T TOUCH //
Expand Down Expand Up @@ -85,7 +85,7 @@ midi_for_light.init = function(id) { // called when the MIDI device is opened &
];
midi_for_light.vu_meter_timer = undefined;

engine.connectControl("[Master]", "crossfader", "midi_for_light.calculateDeckPriority");
engine.makeConnection("[Master]", "crossfader", midi_for_light.calculateDeckPriority);

if (enable_vu_meter_global === true) midi_for_light.vu_meter_timer = engine.beginTimer(40, midi_for_light.vuMeter);

Expand All @@ -95,10 +95,10 @@ midi_for_light.init = function(id) { // called when the MIDI device is opened &

for (var i = 0; i <= 3; i++) {
deck_beat_watchdog_timer[i] = engine.beginTimer(beat_watchdog_time, () => { midi_for_light.deckBeatWatchdog(i); });
engine.connectControl(`[Channel${ i + 1 }]`, "beat_active", "midi_for_light.deckBeatOutputToMidi");
engine.connectControl(`[Channel${ i + 1 }]`, "volume", "midi_for_light.calculateDeckPriority");
engine.connectControl(`[Channel${ i + 1 }]`, "play", "midi_for_light.deckButtonPlay");
if (enable_mtc_timecode === true) { engine.connectControl(`[Channel${ i + 1 }]`, "playposition", "midi_for_light.sendMidiMtcFullFrame"); }
engine.makeConnection(`[Channel${ i + 1 }]`, "beat_active", midi_for_light.deckBeatOutputToMidi);
engine.makeConnection(`[Channel${ i + 1 }]`, "volume", midi_for_light.calculateDeckPriority);
engine.makeConnection(`[Channel${ i + 1 }]`, "play", midi_for_light.deckButtonPlay);
if (enable_mtc_timecode === true) { engine.makeConnection(`[Channel${ i + 1 }]`, "playposition", midi_for_light.sendMidiMtcFullFrame); }
}

midi_for_light.calculateDeckPriority();
Expand Down
268 changes: 268 additions & 0 deletions res/controllers/Midi_for_light.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,274 @@
<forums>https://mixxx.discourse.group/t/midi-for-light/15513</forums>
<wiki>http://mixxx.org/wiki/doku.php/midi_for_light</wiki>
</info>
<settings>
<group label="General">
<row orientation="vertical">
<option
variable="midi_channel"
type="integer"
min="1"
max="16"
default="1"
label="Midi Channel">
</option>
</row>
</group>
<group label="BPM and Timecode">
<row orientation="vertical">
<option
variable="enable_bpm"
type="boolean"
default="true"
label="Enable BPM">
<description>
Output the velocity of (BPM - 50) on the note E (52 / 0x34)
</description>
</option>
<option
variable="enable_beat"
type="boolean"
default="true"
label="Enable Beat">
<description>
Output the Beat of the Current Deck to D (50 / 0x32)
</description>
</option>
<option
variable="enable_mtc_timecode"
type="boolean"
default="true"
label="Enable MTC Timecode">
<description>
Output MTC Timecode of the current Deck as Fullframe messages in 25 frame format
</description>
</option>
<option
variable="deck_ending_time"
type="integer"
min="0"
max="60"
default="15"
label="Deck Ending Time">
<description>
Set a Time (in Seconds) in which the playing Track is considered to be ending
</description>
</option>
<option
variable="deck_ending_priority_factor"
type="real"
precision="2"
min="0.0"
max="1.0"
step="0.01"
default="0.9"
label="Priority Factor for ending Decks">
<description>
Decrease the Priority of the ending Track by this Factor
</description>
</option>
</row>
</group>
<group label="VU Meter">
<row orientation="vertical">
<group label="Mono">
<option
variable="enable_vu_mono_current"
type="boolean"
default="false"
label="Enable VU mono current">
<description>
Output VU mono current to E (64 / 0x40)
</description>
</option>
<option
variable="enable_vu_mono_average_min"
type="boolean"
default="false"
label="Enable VU mono average">
<description>
Output VU mono average min to F (65 / 0x41)
</description>
</option>
<option
variable="enable_vu_mono_average_mid"
type="boolean"
default="false"
label="Enable VU mono average mid">
<description>
Output VU mono average mid to F# (66 / 0x42)
</description>
</option>
<option
variable="enable_vu_mono_average_max"
type="boolean"
default="false"
label="Enable VU mono average max">
<description>
Output VU mono average max to G (67 / 0x43)
</description>
</option>
<option
variable="enable_vu_mono_average_fit"
type="boolean"
default="true"
label="Enable VU mono average">
<description>
Output VU mono average fit to G# (68 / 0x44)
</description>
</option>
<option
variable="enable_vu_mono_current_meter"
type="boolean"
default="false"
label="Enable VU mono current meter">
<description>
Output VU mono current meter to A (69 / 0x45) until C (72 / 0x48)
</description>
</option>
<option
variable="enable_vu_mono_average_meter"
type="boolean"
default="true"
label="Enable VU mono average meter">
<description>
Output VU mono average meter to A (73 / 0x49) until C (76 / 0x4c)
</description>
</option>
</group>
<group label="Left">
<option
variable="enable_vu_left_current"
type="boolean"
default="false"
label="Enable VU left current">
<description>
Output VU left current to G# (80 / 0x50)
</description>
</option>
<option
variable="enable_vu_left_average_min"
type="boolean"
default="false"
label="Enable VU left average min">
<description>
Output VU left average min to A (81 / 0x51)
</description>
</option>
<option
variable="enable_vu_left_average_mid"
type="boolean"
default="false"
label="Enable VU left average mid">
<description>
Output VU left average mid to A# (82 / 0x52)
</description>
</option>
<option
variable="enable_vu_left_average_max"
type="boolean"
default="false"
label="Enable VU left average max">
<description>
Output VU left average max to B (83 / 0x53)
</description>
</option>
<option
variable="enable_vu_left_average_fit"
type="boolean"
default="true"
label="Enable VU left average fit">
<description>
Output VU left average fit to C (84 / 0x54)
</description>
</option>
<option
variable="enable_vu_left_current_meter"
type="boolean"
default="false"
label="Enable VU left current meter">
<description>
Output VU left current meter to C# (85 / 0x55) until E (88 / 0x58)
</description>
</option>
<option
variable="enable_vu_left_average_meter"
type="boolean"
default="false"
label="Enable VU left average meter">
<description>
Output VU left average meter to F (89 / 0x59) until G# (92 / 0x5c)
</description>
</option>
</group>
<group label="Right">
<option
variable="enable_vu_right_current"
type="boolean"
default="false"
label="Enable VU right current">
<description>
Output VU right current to C (96 / 0x60)
</description>
</option>
<option
variable="enable_vu_right_average_min"
type="boolean"
default="false"
label="Enable VU right average min">
<description>
Output VU right average min to C# (97 / 0x61)
</description>
</option>
<option
variable="enable_vu_right_average_mid"
type="boolean"
default="false"
label="Enable VU right average mid">
<description>
Output VU right average mid to D (98 / 0x62)
</description>
</option>
<option
variable="enable_vu_right_average_max"
type="boolean"
default="false"
label="Enable VU right average max">
<description>
Output VU right average max to D# (99 / 0x63)
</description>
</option>
<option
variable="enable_vu_right_average_fit"
type="boolean"
default="true"
label="Enable VU right average fit">
<description>
Output VU right average fit to E (100 / 0x64)
</description>
</option>
<option
variable="enable_vu_right_current_meter"
type="boolean"
default="false"
label="Enable VU right current meter">
<description>
Output VU right current meter to F (101 / 0x65) until G# (104 / 0x68)
</description>
</option>
<option
variable="enable_vu_right_average_meter"
type="boolean"
default="false"
label="Enable VU right average meter">
<description>
Output VU right average meter to A (105 / 0x69) until C (108 / 0x6c)
</description>
</option>
</group>
</row>
</group>
</settings>
<controller id="midi_for_light Control">
<scriptfiles>
<file filename="Midi_for_light-scripts.js" functionprefix="midi_for_light"/>
Expand Down

0 comments on commit b7211ee

Please sign in to comment.