Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
/.vs
22 changes: 15 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,15 @@ <h3>- Chart info -</h3>

<h3>- Other -</h3>

<abbr title="Name of the song folder, required for old versions of TrombLoader">i</abbr>
<label for="foldername">Folder Name</label>
<input type="text" id="foldername" name="foldername" placeholder="Auto">
<abbr title="Name used by mods to identify your chart. Use only a-Z, 1-9, _, -, and space. Should be globally unique.">i</abbr>
<label for="trackRef">trackRef</label>
<input type="text" id="trackRef" name="trackRef">

<abbr
title="The length of the song in measures. Leave this blank unless you need to manually set the endpoint.">i</abbr>
<abbr title="Whether TCCC should generate a random prefix for trackRef. This ensures trackRef will be globally unique.">i</abbr>
<label for="prefixTrackRef">Prefix trackRef?</label>
<input type="checkbox" id="prefixTrackRef" name="prefixTrackRef" checked>

<abbr title="The length of the song in measures. Leave this blank unless you need to manually set the endpoint.">i</abbr>
<label for="songendpoint">Song Endpoint</label>
<input type="number" id="songendpoint" name="songendpoint" placeholder="Auto">
</div>
Expand Down Expand Up @@ -174,8 +177,8 @@ <h2>About</h2>
<li>
Fill out the form
<ul>
<li>All fields must be filled in, except those in the Other section</li>
<li>Only input whole numbers. Decimals are not guaranteed to work.</li>
<li>All fields must be filled in, except Song Endpoint</li>
<li>Use whole numbers whenever possible: Decimals are not guaranteed to work</li>
<li>Hover over the names of each field to see detailed info</li>
</ul>
</li>
Expand Down Expand Up @@ -277,6 +280,11 @@ <h3>Examples</h3>

<div class="container">
<h2>Version history</h2>
<p>
v1.8a:<br>
Changed "Song Folder" to "trackRef"
Added option to generate unique trackRef prefix
</p>
<p>
v1.8:<br>
Added support for converting MIDI pitch bend events into note pitch adjustments
Expand Down
5 changes: 3 additions & 2 deletions src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
};
Expand Down
13 changes: 11 additions & 2 deletions src/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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)) {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 */
Expand Down