Skip to content

Commit

Permalink
examples/audiopanning: Bug fix: Fix several issues
Browse files Browse the repository at this point in the history
 * The stream was not looped.
 * The shown position was wrong.

Closes hajimehoshi#1502
  • Loading branch information
hajimehoshi committed Feb 21, 2021
1 parent 2d817a1 commit a829f8d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions examples/audiopanning/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (g *Game) initAudio() {
}

// Wrap the raw audio with the StereoPanStream
g.panstream = NewStereoPanStreamFromReader(oggS)
g.panstream = NewStereoPanStreamFromReader(audio.NewInfiniteLoop(oggS, oggS.Length()))

g.player, err = audio.NewPlayer(audioContext, g.panstream)
if err != nil {
Expand Down Expand Up @@ -106,9 +106,6 @@ func (g *Game) Update(screen *ebiten.Image) error {

func (g *Game) Draw(screen *ebiten.Image) {
pos := g.player.Current()
if pos > 5*time.Second {
pos = (g.player.Current()-5*time.Second)%(4*time.Second) + 5*time.Second
}
msg := fmt.Sprintf(`TPS: %0.2f
This is an example using
stereo audio panning.
Expand Down

0 comments on commit a829f8d

Please sign in to comment.