From 852c7877435b5b59f12c78134aa268493e88b017 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 4 Aug 2021 14:54:04 +0900 Subject: [PATCH] examples/flappy: Bug fix: an audio context was created multiple times Closes #1739 --- examples/flappy/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/flappy/main.go b/examples/flappy/main.go index 2e555b8f0..894321d48 100644 --- a/examples/flappy/main.go +++ b/examples/flappy/main.go @@ -175,7 +175,9 @@ func (g *Game) init() { g.pipeTileYs[i] = rand.Intn(6) + 2 } - g.audioContext = audio.NewContext(48000) + if g.audioContext == nil { + g.audioContext = audio.NewContext(48000) + } jumpD, err := vorbis.Decode(g.audioContext, bytes.NewReader(raudio.Jump_ogg)) if err != nil {