Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. loadAPI(1);
  3.  
  4. host.defineController("Novation", "Novation ReMOTE SL37", "1.0",
  5.  
  6. "f56c04a0-c304-11e4-8830-0800200c9a66");
  7. host.defineMidiPorts(3, 1);
  8.  
  9. var LOWEST_CC
  10.  
  11. = 0;host.addDeviceNameBasedDiscoveryPair(["3- ReMOTE SL", "MIDIIN2 (3-ReMOTE SL)", "MIDIIN3 (3-ReMOTE SL)"],["3-ReMOTE SL"]);
  12. var HIGHEST_CC = 127;
  13.  
  14. function init()
  15. {
  16.    host.getMidiInPort
  17.  
  18. (0).setMidiCallback(onMidi);
  19.    generic = host.getMidiInPort(0).createNoteInput
  20.  
  21. ("", "Novation ReMOTE keyboard");
  22.    generic.setShouldConsumeEvents(false);
  23.  
  24.    //
  25.  
  26. Make CCs 1-119 freely mappable
  27.    userControls = host.createUserControlsSection
  28.  
  29. (HIGHEST_CC - LOWEST_CC + 1);
  30.  
  31.    for(var i=LOWEST_CC; i<=HIGHEST_CC; i++)
  32.    {
  33.      
  34.  
  35. userControls.getControl(i - LOWEST_CC).setLabel("CC" + i);
  36.    }
  37. }
  38.  
  39. function onMidi
  40.  
  41. (status, data1, data2)
  42. {
  43.    if (isChannelController(status))
  44.    {
  45.       if (data1 >=
  46.  
  47. LOWEST_CC && data1 <= HIGHEST_CC)
  48.       {
  49.          var index = data1 - LOWEST_CC;
  50.    
  51.  
  52.       userControls.getControl(index).set(data2, 128);
  53.       }
  54.    }     
  55. }
  56.  
  57. function exit()
  58. {
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement