Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slmjkdbtl committed Dec 17, 2023
1 parent 0eb9125 commit 580bad1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/kaboom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,14 +1124,14 @@ export default (gopt: KaboomOpt = {}): KaboomCtx => {
if (music) {
return music.data
} else {
throw new Error(`Music not found: ${src}`)
return null
}
} else if (src instanceof HTMLAudioElement) {
return src
} else if (src instanceof Asset) {
} else if (src instanceof Asset && src.data instanceof HTMLAudioElement) {
return src.data
} else {
throw new Error(`Invalid music: ${src}`)
return null
}
}

Expand Down Expand Up @@ -1255,7 +1255,7 @@ export default (gopt: KaboomOpt = {}): KaboomCtx => {
},

set volume(val: number) {
music.volume = val
music.volume = clamp(val, 0, 1)
},

get volume() {
Expand Down Expand Up @@ -1300,7 +1300,7 @@ export default (gopt: KaboomOpt = {}): KaboomCtx => {
const music = resolveMusic(src)

if (music) {
return playMusic(music)
return playMusic(music, opt)
}

const ctx = audio.ctx
Expand Down

0 comments on commit 580bad1

Please sign in to comment.