From 0b40953cf50393e6d9082ea9bad3f5f67d3e8b8b Mon Sep 17 00:00:00 2001 From: grey Date: Thu, 23 Mar 2023 21:52:25 +0100 Subject: [PATCH] - fixes loop not working --- handlerFunctions.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handlerFunctions.go b/handlerFunctions.go index 6c979af..85ad7ba 100644 --- a/handlerFunctions.go +++ b/handlerFunctions.go @@ -99,11 +99,12 @@ func PlaySound(file string, index int, loop bool) int { amountOfLoops := 1 if loop { amountOfLoops = -1 + fmt.Println("Looping sound: " + file) } - shot := buffer.Streamer(amountOfLoops, buffer.Len()) + shot := buffer.Streamer(0, buffer.Len()) done := make(chan bool) - ctrl := &beep.Ctrl{Streamer: shot, Paused: false} + ctrl := &beep.Ctrl{Streamer: beep.Loop(amountOfLoops, shot), Paused: false} playbacks[index] = playback{ File: file,