Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
state.position += duration
break
}
case "keySignature": {
state.keySignature = new KeySignature(+command[1])
break
}
case "timeSignature": {
let [, perBeat, noteValue] = command
state.beatsPerNote = 4 / noteValue
state.beatsPerMeasure = state.beatsPerNote * perBeat
break
}
case "macro": {
let [, macroName] = command
let chord = AutoChords.coerceChord(macroName)
if (chord) {
if (!song.autoChords) {
song.autoChords = []
}
song.autoChords.push([state.position, chord])
}
break
}
default: {
console.warn("Got unknown command when parsing song", command)
}
}
}
[["Cb", "dimM7"], () => AutoChords.coerceChord("cbdimM7")],
].map(function([expected, fn]) {
[["B", "m"], () => AutoChords.coerceChord("bm")],
[["Fb", "M"], () => AutoChords.coerceChord("fbM")],
[["G#", "m"], () => AutoChords.coerceChord("g#m")],
[["Cb", "dimM7"], () => AutoChords.coerceChord("cbdimM7")],
[["G", "M"], () => AutoChords.coerceChord("g")],
[["A", "M"], () => AutoChords.coerceChord("aM")],
[["Fb", "M"], () => AutoChords.coerceChord("fbM")],
[["G#", "m"], () => AutoChords.coerceChord("g#m")],
[["A", "M"], () => AutoChords.coerceChord("aM")],
[["B", "m"], () => AutoChords.coerceChord("bm")],
[undefined, () => AutoChords.coerceChord("hello world")],
[["G", "M"], () => AutoChords.coerceChord("g")],