while cicle

• Jun 23, 2024 - 12:49

Every time i add the condition while(pae_list.length>0) it cause the crash of MS. here my code. Thank you
onRun:{
var valid_pae_charsBAR =":/"
var valid_pae_charsOCT =",'"
var valid_pae_charsNOTE ="CDEFGHAB"
var valid_pae_charsTIMESIG ="123456789./"
var valid_pae_charsNOTEL ="123456789."

 var number;
 var note;
 var octave;
 var numberTraducREST;
 var rest;




var P = newScore("traduzione","piano",8)
var mioCursore= P.newCursor()
mioCursore.track=0
mioCursore.rewind(0)

var input="'3ABC" 




pae_list=translatorPAE(input)
while(pae_list.length>0){
var c=''
c=pae_list.shift()
console.log(c)

console.log(pae_list.length)



             if (pae_list.length>0 && valid_pae_charsNOTEL.indexOf(c) !== -1){
               number=c 
                while (valid_pae_charsNOTEL.indexOf(pae_list[0])){
                number += pae_list.shift()
                console.log(number)
             }


            } else if (pae_list.length>0 &&valid_pae_charsNOTE.indexOf(c) !== -1){
              note=c 
                while (valid_pae_charsNOTE.indexOf(pae_list[0])){
                note += pae_list.shift()
                console.log(note)
             }


            }else if (pae_list.length>0 && valid_pae_charsOCT.indexOf(c) !== -1){
              octave=c 

                while (pae_list.length>0 && valid_pae_charsOCT.indexOf(pae_list[0]) !== -1){
                octave += pae_list.shift()
                console.log(octave)
             }
            }
           }

}

}

Do you still have an unanswered question? Please log in first to post your question.