Skip to content

Instantly share code, notes, and snippets.

@ronso0
Last active September 19, 2022 08:49
Show Gist options
  • Save ronso0/567f6e92c04ef16989a95cac841bd680 to your computer and use it in GitHub Desktop.
Save ronso0/567f6e92c04ef16989a95cac841bd680 to your computer and use it in GitHub Desktop.
Track load helper
function MidithroughJS() {}
var count = 0;
var loadTimer = null;
MidithroughJS.init = function (id,debug) {
// deck2, eject triggers track load actions every 500ms
engine.makeConnection("[Channel2]", "beats_translate_curpos", function(value) {
print(".");
print(" beats_translate_curpos" + value);
print(".");
if (!value) {
return;
}
if (count >= 5) {
engine.stopTimer(loadTimer);
loadTimer = null;
count = 0;
}
engine.beginTimer(
500,
function() {
if (count < 5) {
print(".");
print(" count: " + count);
print(".");
engine.setValue("[Channel1]", "LoadSelectedTrack", 1);
count++;
}
},
false);
});
}
MidithroughJS.shutdown = function () {
// print(".");
// print("MidithroughJS: shut down.");
// print(".");
}
<?xml version='1.0' encoding='utf-8'?>
<MixxxControllerPreset schemaVersion="1" mixxxVersion="">
<info>
<name>MIDI-through Debug Deck track menu</name>
<description>Eject on deck2 triggers "LoadSelectedTrack" every 500ms</description>
</info>
<controller id="midithrough">
<scriptfiles>
<file filename="midi-through-debug__track-load-via-eject.js" functionprefix="MidithroughJS"/>
</scriptfiles>
<controls>
<control>
<group>[Channel1]</group>
<key>play</key>
<description>assasd--</description>
<status>0x90</status>
<midino>0x00</midino>
<options>
<normal/>
</options>
</control>
</controls>
<outputs/>
</controller>
</MixxxControllerPreset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment