From a829f8d94c607e0264615561015802be661730f4 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 22 Feb 2021 02:00:49 +0900 Subject: [PATCH] examples/audiopanning: Bug fix: Fix several issues * The stream was not looped. * The shown position was wrong. Closes #1502 --- examples/audiopanning/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/audiopanning/main.go b/examples/audiopanning/main.go index 5eb6a0282..734285129 100644 --- a/examples/audiopanning/main.go +++ b/examples/audiopanning/main.go @@ -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 { @@ -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.