Skip to content

Commit

Permalink
Issue #1 use modulo operator
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson318 committed Nov 21, 2022
1 parent fb6fd59 commit 1c5e6a1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/sounds.js.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ let playAttempt = setInterval(() => {
let x = 0
$("#narration").bind("ended", function(){
x = x + 1
console.log("Sound array", allsounds)
console.log("Sound array", allsounds[0])
console.log("Sound array", allsounds[0][1])
console.log("Sound array", allsounds[x%soundFiles])
const pick_one = Math.round(Math.random() * (allsounds[x%soundFiles].length-1))

const file = "sounds/" + String(x%soundFiles).padStart(2, '0') + "_panned.mp3"
const file = allsounds[x][pick_one]
console.log("Looking for ", file)
narration.src = file
narration.pause()
Expand Down

0 comments on commit 1c5e6a1

Please sign in to comment.