diff --git a/desktop/apps/desktop.console/desktop.console.js b/desktop/apps/desktop.console/desktop.console.js
index f901d6a..b0809a4 100644
--- a/desktop/apps/desktop.console/desktop.console.js
+++ b/desktop/apps/desktop.console/desktop.console.js
@@ -145,6 +145,11 @@ desktop.app.console._allowCommands = {
description: 'Opens Musical Instruments',
icon: 'midifighter'
},
+ midi: {
+ command: 'desktop.ui.openWindow("midi");',
+ description: 'Audio MIDI Setup',
+ icon: 'midi'
+ },
midifighter: {
command: 'desktop.ui.openWindow("midifighter");',
description: 'MIDI Fighter styled Music Pad.',
diff --git a/desktop/apps/desktop.midi/desktop.midi.html b/desktop/apps/desktop.midi/desktop.midi.html
new file mode 100644
index 0000000..4280625
--- /dev/null
+++ b/desktop/apps/desktop.midi/desktop.midi.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
Audio MIDI Setup
+
+
To test MIDI Input:
+
+ - Plug in your MIDI device via USB to your computer.
+ - Twiddle some knobs. View received MIDI data below.
+ - All MIDI data is emitted as events to "desktop.emit" ( check console log )
+
+
+
+
+
MIDI Data Log
+
+
+
+
+
+ Build: v4.20.69
+
+
+
+
\ No newline at end of file
diff --git a/desktop/apps/desktop.midi/desktop.midi.js b/desktop/apps/desktop.midi/desktop.midi.js
new file mode 100644
index 0000000..413fecd
--- /dev/null
+++ b/desktop/apps/desktop.midi/desktop.midi.js
@@ -0,0 +1,77 @@
+desktop.app.midi = {};
+desktop.app.midi.label = 'Midi Setup';
+
+desktop.app.midi.load = function loadmidiGames (params, next) {
+ desktop.load.remoteAssets([
+ 'midi' // this loads the sibling desktop.app.midi.html file into
+ ], function (err) {
+ $('#window_midi').css('width', 662);
+ $('#window_midi').css('height', 495);
+ $('#window_midi').css('left', 50);
+ $('#window_midi').css('top', 50);
+
+ desktop.on('midi-message', "log-midi-data-to-console" , function(event){
+ desktop.log('MIDI:', event)
+ })
+
+ var midi;
+ var log = document.getElementById("midi-log");
+ init();
+
+ function init() {
+ logText("Initializing MIDI...");
+ navigator.requestMIDIAccess().then( onSuccess, onFailure ); //get midi access
+ }
+
+ function onSuccess( access ) {
+
+ midi = access;
+ var inputs = midi.inputs;
+
+ logText("Found " + inputs.size + " MIDI input(s)");
+
+ //connect to first device found
+ if(inputs.size > 0) {
+ var iterator = inputs.values(); // returns an iterator that loops over all inputs
+ var input = iterator.next().value; // get the first input
+ logText("Connected first input: " + input.name);
+ input.onmidimessage = handleMIDIMessage;
+ }
+ }
+
+ function onFailure( err ) {
+ logText("MIDI Init Error. Error code: " + err.code);
+ }
+
+ function handleMIDIMessage(event){
+
+ desktop.emit('midi-message', event.data)
+ //event.data & event.receivedTime are populated
+ //event.data has 3 components:
+ //0) The device id
+ //1) The controller id
+ //2) The controller value (typically in the range 0 - 127)
+
+ if (event.data.length === 3) {
+ logText('controller id: ' + event.data[1] + ', value: ' + event.data[2]);
+ }
+ }
+
+ function logText(str){
+ log.innerHTML += str;
+ log.innerHTML += "
";
+ log.scrollTop = log.scrollHeight;
+ }
+
+ next();
+ });
+
+};
+
+desktop.app.midi.openWindow = function openWindow () {
+ return true;
+};
+
+desktop.app.midi.closeWindow = function closeWindow () {
+ return true;
+};
\ No newline at end of file
diff --git a/desktop/apps/desktop.profile/desktop.profile.html b/desktop/apps/desktop.profile/desktop.profile.html
index abde10f..ba94178 100644
--- a/desktop/apps/desktop.profile/desktop.profile.html
+++ b/desktop/apps/desktop.profile/desktop.profile.html
@@ -183,10 +183,17 @@
Piano
+
+
+
+ |
+
+ Audio MIDI Setup
+ |
+
-
|
Stream Squad ( Live Streamers )
diff --git a/desktop/assets/images/icons/icon_midi_64.png b/desktop/assets/images/icons/icon_midi_64.png
new file mode 100644
index 0000000..100af8b
Binary files /dev/null and b/desktop/assets/images/icons/icon_midi_64.png differ
|