Skip to content

Commit

Permalink
Segments can now start before the audio; don't try to play negative o…
Browse files Browse the repository at this point in the history
…ffsets
  • Loading branch information
abarbu committed May 7, 2020
1 parent 1114e22 commit 95c1bb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,13 @@ function play(offset_: TimeInBuffer, duration_?: TimeInBuffer) {
const duration = from(duration_)
endTime = offset + duration
audioIsPlaying += 1
sourceNode.start(0, offset, duration)
// Math.max is required for .start() because we have sgments that start before our audio does
sourceNode.start(0, Math.max(0, offset), duration)
} else {
endTime = 1000000 // infinity seconds..
audioIsPlaying += 1
sourceNode.start(0, offset)
// Math.max is required for .start() because we have sgments that start before our audio does
sourceNode.start(0, Math.max(0, offset))
}
}

Expand Down

0 comments on commit 95c1bb4

Please sign in to comment.