From a22baa4b553ac08a7f27001fb9a53c441d675727 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Thu, 14 Nov 2024 16:47:51 +0100 Subject: xA: prevent sound playback GC The beep sound could be cut short. --- xA/xA.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xA/xA.go b/xA/xA.go index 17a0400..f501622 100644 --- a/xA/xA.go +++ b/xA/xA.go @@ -281,7 +281,11 @@ func beep() { } go func() { <-otoReady - otoContext.NewPlayer(bytes.NewReader(beepSample)).Play() + p := otoContext.NewPlayer(bytes.NewReader(beepSample)) + p.Play() + for p.IsPlaying() { + time.Sleep(time.Second) + } }() } -- cgit v1.2.3-70-g09d2