<commit_before>loadAPI(1);

load("NoteManager.js");

host.defineController("<NAME>", "12 Step", "0.1.0", "22f76bfc-789d-43ef-8468-71ab2f645b12", "<NAME>");
host.defineMidiPorts(1, 0);
host.addDeviceNameBasedDiscoveryPair(["12Step"], []);

const MIDI_NOTE_OFF = 0x80;
const MIDI_NOTE_ON = 0x90;

// All notes in [C4, C5] except F#, G#, and A#
const CLIP_CONTROL_NOTES = [48, 49, 50, 51, 52, 53, 55, 57, 59, 60];
const STOP_ALL_NOTE = 54; // F# 4
const SCENE_SWITCH_NOTE = 56; // G# 4
const PAGE_TURN_NOTE = 58; //  A# 4

const DOUBLE_TAP_HOLD_TIMEOUT = 500; // milliseconds

var noteMap;

function init() {
  host.getMidiInPort(0).setMidiCallback(onMidi);

  // A mapping from MIDI notes to what we want to do with them
  // TODO: Move this to its own class?
  noteMap = {};
  CLIP_CONTROL_NOTES.forEach(function(noteId, clipId) {
    noteMap[CLIP_CONTROL_NOTES[clipId]] = new NoteManager(
      DOUBLE_TAP_HOLD_TIMEOUT,
      function() { // singleTapCallback
        host.println("Single tap clip " + clipId);
        // TODO: Trigger clip clipId at the currently selected scene<commit_msg>Autodetect hardware on Mac<commit_after>loadAPI(1);

load("NoteManager.js");

host.defineController("<NAME>", "12 Step", "0.1.0", "22f76bfc-789d-43ef-8468-71ab2f645b12", "<NAME>a");
host.defineMidiPorts(1, 0);
host.addDeviceNameBasedDiscoveryPair(["12Step"], []); // Windows
host.addDeviceNameBasedDiscoveryPair(["12Step Port 1"], []); // Mac

const MIDI_NOTE_OFF = 0x80;
const MIDI_NOTE_ON = 0x90;

// All notes in [C4, C5] except F#, G#, and A#
const CLIP_CONTROL_NOTES = [48, 49, 50, 51, 52, 53, 55, 57, 59, 60];
const STOP_ALL_NOTE = 54; // F# 4
const SCENE_SWITCH_NOTE = 56; // G# 4
const PAGE_TURN_NOTE = 58; //  A# 4

const DOUBLE_TAP_HOLD_TIMEOUT = 500; // milliseconds

var noteMap;

function init() {
  host.getMidiInPort(0).setMidiCallback(onMidi);

  // A mapping from MIDI notes to what we want to do with them
  // TODO: Move this to its own class?
  noteMap = {};
  CLIP_CONTROL_NOTES.forEach(function(noteId, clipId) {
    noteMap[CLIP_CONTROL_NOTES[clipId]] = new NoteManager(
      DOUBLE_TAP_HOLD_TIMEOUT,
      function() { // singleTapCallback
        host.println("Single tap clip " + clipId);
        // TODO: Trigger clip clipId at the currently selected scene
{'fraction_non_alphanumeric': 0.13934065934065934, 'fraction_numerical': 0.06461538461538462, 'mean_word_length': 4.160997732426304, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2048042', 'n_tokens_mistral': 971, 'n_tokens_neox': 841, 'n_words': 217}