From 7f8f57728a33d364d8399224e0ad2e27c44f9bcc Mon Sep 17 00:00:00 2001 From: Louis Dalibard Date: Mon, 21 Oct 2024 13:56:50 +0200 Subject: [PATCH] fix: ring buffer race condition issues --- audio/audio.go | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/audio.go b/audio/audio.go index 50b794f..bb041bc 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -16,7 +16,7 @@ var SampleSizeInBytes uint32 const format = malgo.FormatF32 func Init() { - SampleRingBuffer = ringbuffer.New(int(config.Config.RingBufferSize)) + SampleRingBuffer = ringbuffer.New(int(config.Config.RingBufferSize)).SetBlocking(true) SampleSizeInBytes = uint32(malgo.SampleSizeInBytes(format)) } diff --git a/main.go b/main.go index 8414e09..551a65a 100644 --- a/main.go +++ b/main.go @@ -50,7 +50,7 @@ func main() { } //audio.SampleRingBuffer.Reset() if config.Config.FPSCounter { - rl.DrawFPS(16, config.Config.WindowHeight) + rl.DrawFPS(16, config.Config.WindowHeight-32) } rl.DrawTextEx(fonts.FontIosevka32, media.PlayingMediaInfo.Artist+" - "+media.PlayingMediaInfo.Title, rl.NewVector2(16, 16), 32, 2, config.AccentColor) rl.DrawTextEx(fonts.FontIosevka16, media.PlayingMediaInfo.Album, rl.NewVector2(16, 48), 16, 1, config.ThirdColor)