diff --git a/js/abcd2abc.js b/js/abcd2abc.js index a08e9cd..4589a2f 100644 --- a/js/abcd2abc.js +++ b/js/abcd2abc.js @@ -202,7 +202,7 @@ function isStaffInstrumentAndOpenCurlyBracket(abcdLine) { async function abcd2abc(abcd) { - function getABCPreambule(lines) { + function getABCLinesPreambule(lines) { const abc = []; abc.push("X:1"); abc.push("L:1/4"); @@ -212,7 +212,7 @@ async function abcd2abc(abcd) { let i = 0; - while (true) { + while (lines.length > 0) { let line = lines[0].trim(); if (line != "") { if (isStaffLine(line)) @@ -227,18 +227,15 @@ async function abcd2abc(abcd) { return abc; } } + else + lines.shift(); } + return abc; } const lines = abcd.split("\n"); - const abc = getABCPreambule(lines); - - const iScoreInABC = abc.length - 1; - - - - + const abc = getABCLinesPreambule(lines); let scoreStructure = new ScoreStructure(); let scoreData = new ScoreData(); @@ -296,6 +293,9 @@ async function abcd2abc(abcd) { let currentTimeSignature = 1; // bydefaut measures = await Promise.all(measures.map(async (measureStr) => { + if (measureStr == "") // DO NOT REMOVE. It enables to handle "||" + return ""; + let accidentals = {}; const getCurrentAccidental = (pitch) => { @@ -355,9 +355,6 @@ async function abcd2abc(abcd) { const ppure = new Pitch(note.pitch.value, 0); accidentals[ppure.toStringABC()] = noteAccidental; - console.log(noteAccidental) - - console.log((currentA == noteAccidental)) if (currentA == noteAccidental) return note.toStringABC(); else { diff --git a/js/gui.js b/js/gui.js index 46f84c6..22e3a38 100644 --- a/js/gui.js +++ b/js/gui.js @@ -15,7 +15,7 @@ dialogOpenButtonOpen.onclick = () => { editor.text = Save.load();//editor.setValue(Save.load(), -1); } else { - alert("No document with name '" + newid + "' found!") + alert("No document with id name '" + newid + "' found!") } } @@ -44,7 +44,7 @@ buttonDialogOpen.onclick = () => { buttonSave.onclick = () => { - const newid = prompt("What name do you want to give to this score?", Save.getId()); + const newid = prompt("What id name do you want to give to this score?", Save.getId()); Save.setId(newid); Save.save(); } @@ -128,6 +128,7 @@ async function update() { synthControl.load("#audio", null, { displayRestart: true, displayPlay: true, displayProgress: true }); synthControl.setTune(visualObj, false); } + editor.onchange = update; update(); /** diff --git a/js/rhythmguess.js b/js/rhythmguess.js index a4d8e36..4783353 100644 --- a/js/rhythmguess.js +++ b/js/rhythmguess.js @@ -52,8 +52,6 @@ class RhythmGuess { const nbSpacesArray = []; let isElement = false; const elements = []; //array of Element, Chord or string :) - console.log("tokens: ", tokens); - tokens.map((token) => { if (token == "") { @@ -249,7 +247,6 @@ function tokenize(abcdStr) { abcdStr = abcdStr.replaceAll("-", " - "); const L = abcdStr.split(" "); - console.log(L) for (const chunk of L) { if (!isBracket) { @@ -276,7 +273,6 @@ function tokenize(abcdStr) { bracketToken += chunk + " "; } } - console.log(tokens) return tokens; } diff --git a/style.css b/style.css index 9a51dbe..81a2bbe 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ position: absolute; top: 76px; right: 0px; - bottom: 50%; + bottom: 60%; left: 0; border: 1px solid black; } @@ -18,7 +18,7 @@ #outputWrapper { overflow: auto; position: absolute; - top: 50%; + top: 40%; left: 0px; right: 0px; bottom: 0px;