From 24b245aa65e6c652b6d731e0f2575f7d8d2ada89 Mon Sep 17 00:00:00 2001 From: Bui Date: Sun, 26 Aug 2018 20:20:57 +0100 Subject: [PATCH] improve note parser --- src/js/parsesong.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/js/parsesong.js b/src/js/parsesong.js index da73cc3..2452fca 100644 --- a/src/js/parsesong.js +++ b/src/js/parsesong.js @@ -189,40 +189,41 @@ function ParseSong(fileContent){ var txt; var emptyValue=false; - switch(values[4]){ - case '0': + switch(parseInt(values[4])){ + case 0: type="don"; txt="ドン"; break; - case '2': + case 2: type="ka"; txt="カッ"; break; - case '4': + case 4: type="daiDon"; txt="ドン"; break; - case '6': + case 6: type="daiKa"; txt="カッ"; break; - case '8': + case 8: type="ka"; txt="カッ"; break; - case '10': + case 10: type="ka"; txt="カッ"; break; - case '12': + case 12: type="daiKa"; txt="カッ"; break; - case '14': + case 14: type="daiKa"; txt="カッ"; break; default: + console.log('[WARNING] Unknown note type found on line ' + i+1 + ': ' + _data[i]); emptyValue=true; break; }