javascript - why the for loop is not playing audio files again and again? -


for full code please visit this question

for problem coming in code is:

var times_played =1,      l=pattern_config[actions().whichpattern].wp_slotscounter; var p = setinterval(function(){     var x = pattern[actions().whichpattern][times_played];     for(var i=0; i<x.length;i++){             var tobeplayed = x[i];            if(tobeplayed !== undefined){                 var url= "all drums sounds/"+tobeplayed+".wav";             audio.src = url;             audio.play();             //console.log(audio);         }else{};     }     times_played++;     console.log(l);     if(times_played === l+1){clearinterval(p);}; }, pattern_config[actions().whichpattern].delay); 

note: part of function named _play()

and problem that:

suppose have array like: [['drum_snare_01'],['drum_snare_01'],['drum_snare_01']]. should expect function play audio file named 'drum_snare_01' 3 times. not happening playing once. debugging know file played after loop over, i.e. @ last.

case 2

again if have array like: [[ 'kick_02','drum_snare_01'],[ 'kick_02','drum_snare_01'],[ 'kick_02','drum_snare_01'],[ 'kick_02','drum_snare_01']] going play drum_snare_01 , not kick_02 or in general play file @ last of array

i don't know how solution of problem going be, that's why asked here.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -