diff --git a/.gitignore b/.gitignore index 485dee6..434ce18 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +/.vs diff --git a/index.html b/index.html index 93b4ea9..4ee2a56 100644 --- a/index.html +++ b/index.html @@ -138,12 +138,15 @@

- Chart info -

- Other -

- i - - + i + + - i + i + + + + i @@ -174,8 +177,8 @@

About

  • Fill out the form
  • @@ -277,6 +280,11 @@

    Examples

    Version history

    +

    + v1.8a:
    + Changed "Song Folder" to "trackRef" + Added option to generate unique trackRef prefix +

    v1.8:
    Added support for converting MIDI pitch bend events into note pitch adjustments diff --git a/src/generate.js b/src/generate.js index ce0bc83..c025a55 100644 --- a/src/generate.js +++ b/src/generate.js @@ -8,7 +8,7 @@ const Generate = (function () { if (!Inputs.verifyInputs() || MidiToNotes.notes.length === 0) { alert( "Please ensure a valid midi is uploaded and all fields are filled\n" + - "(Folder Name and Song Endpoint can be empty)" + "(Song Endpoint can be empty)" ); return; } @@ -19,7 +19,8 @@ const Generate = (function () { ...inputs, notes: MidiToNotes.notes, lyrics: MidiToNotes.lyrics, - trackRef: inputs.trackRef || `${Math.random()}`, + trackRef: (inputs.prefixTrackRef ? Math.random().toString().substring(2) + '_' : '') + inputs.trackRef, + prefixTrackRef: undefined, endpoint: inputs.endpoint || MidiToNotes.calculatedEndpoint, UNK1: 0, }; diff --git a/src/inputs.js b/src/inputs.js index 7f45329..58396f1 100644 --- a/src/inputs.js +++ b/src/inputs.js @@ -16,12 +16,13 @@ const Inputs = (function () { notespacing: "savednotespacing", notestartcolor: "note_color_start", noteendcolor: "note_color_end", - foldername: "trackRef", + trackRef: "trackRef", + prefixTrackRef: "prefixTrackRef", songendpoint: "endpoint", }; /** Inputs that are not required to be filled in */ - const optionalInputNames = new Set(["foldername", "songendpoint"]); + const optionalInputNames = new Set(["songendpoint"]); /** Inputs that need to be formatted as ints */ const intInputNames = new Set([ @@ -39,6 +40,9 @@ const Inputs = (function () { /** Inputs that need to be formatted as colors */ const colorInputNames = new Set(["notestartcolor", "noteendcolor"]); + /** Checkbox inputs fetch `checked` instead of `value` */ + const checkboxInputNames = new Set(["prefixTrackRef"]); + /** Returns whether all required fields are filled in */ function verifyInputs() { for (const [inputName, input] of Object.entries(inputs)) { @@ -59,6 +63,8 @@ const Inputs = (function () { result[inputMap[inputName]] = Number(input.value); } else if (colorInputNames.has(inputName)) { result[inputMap[inputName]] = Color.hexToFloats(input.value); + } else if (checkboxInputNames.has(inputName)) { + result[inputMap[inputName]] = input.checked; } else { result[inputMap[inputName]] = input.value; } @@ -94,6 +100,9 @@ const Inputs = (function () { } input.dispatchEvent(new Event("change")); } + + // Do not prefix if the trackRef was passed + if (obj.trackRef) inputs.prefixTrackRef.checked = false; } /** Converts a string to an number, warning if it's actually a float */