|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function formatTime(totalSeconds) |
|
|
{ |
|
|
totalSeconds = Math.floor(totalSeconds); |
|
|
let minutes = Math.floor(totalSeconds / 60); |
|
|
let seconds = Math.round(totalSeconds - (minutes * 60)); |
|
|
return { |
|
|
"minutes": minutes, |
|
|
"seconds": seconds, |
|
|
"time": `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}` |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function formatTitle(fileName) |
|
|
{ |
|
|
return fileName |
|
|
.trim() |
|
|
.replaceAll(".mid", "") |
|
|
.replaceAll(".kar", "") |
|
|
.replaceAll(".rmi", "") |
|
|
.replaceAll(".xmf", "") |
|
|
.replaceAll(".mxmf", "") |
|
|
.replaceAll("_", " ") |
|
|
.trim(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function arrayToHexString(arr) |
|
|
{ |
|
|
let hexString = ""; |
|
|
|
|
|
for (let i = 0; i < arr.length; i++) |
|
|
{ |
|
|
const hex = arr[i].toString(16).padStart(2, "0").toUpperCase(); |
|
|
hexString += hex; |
|
|
hexString += " "; |
|
|
} |
|
|
|
|
|
return hexString; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function sanitizeKarLyrics(eventData) |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sanitized = []; |
|
|
for (let byte of eventData) |
|
|
{ |
|
|
if (byte === 47 || byte === 92) |
|
|
{ |
|
|
byte = 10; |
|
|
} |
|
|
sanitized.push(byte); |
|
|
} |
|
|
return new Uint8Array(sanitized); |
|
|
} |
|
|
|
|
|
export const consoleColors = { |
|
|
warn: "color: orange;", |
|
|
unrecognized: "color: red;", |
|
|
info: "color: aqua;", |
|
|
recognized: "color: lime", |
|
|
value: "color: yellow; background-color: black;" |
|
|
}; |
|
|
|
|
|
|
|
|
|