summaryrefslogtreecommitdiff
path: root/xA/xA.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-11-14 16:47:51 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-11-14 16:48:44 +0100
commita22baa4b553ac08a7f27001fb9a53c441d675727 (patch)
tree60999173ecd9da6cbe1bc353658e8ee686c6e331 /xA/xA.go
parentb3e545e0bb5c56cefaa0848ac6471a3139e15a75 (diff)
downloadxK-a22baa4b553ac08a7f27001fb9a53c441d675727.tar.gz
xK-a22baa4b553ac08a7f27001fb9a53c441d675727.tar.xz
xK-a22baa4b553ac08a7f27001fb9a53c441d675727.zip
xA: prevent sound playback GC
The beep sound could be cut short.
Diffstat (limited to 'xA/xA.go')
-rw-r--r--xA/xA.go6
1 files changed, 5 insertions, 1 deletions
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)
+ }
}()
}