Skip to content

Commit

Permalink
Issue #1 try using constant array to hold sound file data
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson318 committed Nov 18, 2022
1 parent 70a562a commit 9581361
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/sounds.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const soundFiles = 43
const allsounds = []
const sounds_00 = ['sounds/00_panned.mp3', 'sounds/ulysses_624_pico.mp3']

allsounds.push(sounds_00)

const water = document.getElementById('watersound');
const narration = document.getElementById('narration');
const startButton = document.getElementById('startbutton');
Expand Down Expand Up @@ -40,9 +46,12 @@ let playAttempt = setInterval(() => {


let x = 0
const soundFiles = 43
$("#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])

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

0 comments on commit 9581361

Please sign in to comment.