Skip to content

Commit de67bce

Browse files
author
Vanshika
committed
fix: restore missing ABC debug logic and fix failing tests
1 parent 721ea30 commit de67bce

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

js/abc.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const processABCNotes = function (logo, turtle) {
223223
if (
224224
logo.notation.notationStaging[turtle][i + j][NOTATIONINSIDECHORD] > 0 &&
225225
logo.notation.notationStaging[turtle][i + j][NOTATIONINSIDECHORD] ===
226-
logo.notation.notationStaging[turtle][i + j - 1][NOTATIONINSIDECHORD]
226+
logo.notation.notationStaging[turtle][i + j - 1][NOTATIONINSIDECHORD]
227227
) {
228228
// In a chord, so jump to next note.
229229
j++;
@@ -287,6 +287,19 @@ const processABCNotes = function (logo, turtle) {
287287
k++; // Increment notes in tuplet.
288288
}
289289

290+
// FIXME: Debug for ABC
291+
if (i + j - 1 < logo.notation.notationStaging[turtle].length - 1) {
292+
const nextObj = logo.notation.notationStaging[turtle][i + j];
293+
if (typeof nextObj === "string" && nextObj === ")") {
294+
// logo.notationNotes[turtle] += '';
295+
i += 1;
296+
} else {
297+
logo.notationNotes[turtle] += " ";
298+
}
299+
} else {
300+
logo.notationNotes[turtle] += " ";
301+
}
302+
290303
return j;
291304
};
292305

@@ -336,7 +349,7 @@ const processABCNotes = function (logo, turtle) {
336349
if (
337350
i === 0 ||
338351
logo.notation.notationStaging[turtle][i - 1][NOTATIONINSIDECHORD] !==
339-
obj[NOTATIONINSIDECHORD]
352+
obj[NOTATIONINSIDECHORD]
340353
) {
341354
// Open the chord.
342355
logo.notationNotes[turtle] += "[";
@@ -348,7 +361,7 @@ const processABCNotes = function (logo, turtle) {
348361
if (
349362
i === logo.notation.notationStaging[turtle].length - 1 ||
350363
logo.notation.notationStaging[turtle][i + 1][NOTATIONINSIDECHORD] !==
351-
obj[NOTATIONINSIDECHORD]
364+
obj[NOTATIONINSIDECHORD]
352365
) {
353366
// Close the chord and add note duration.
354367
logo.notationNotes[turtle] += "]";

0 commit comments

Comments
 (0)