Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit fe47896

Browse files
committed
Explicit pause during replace
Signed-off-by: Jesse Millar <[email protected]>
1 parent a438b7a commit fe47896

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

main.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,12 @@ func playSfx(path string, replace bool) error {
228228

229229
if replace {
230230
speaker.Lock()
231-
ctrl = &beep.Ctrl{Streamer: beep.Seq(resampled, beep.Callback(func() { done <- true })), Paused: false}
231+
ctrl.Paused = true
232232
speaker.Unlock()
233+
ctrl = &beep.Ctrl{Streamer: beep.Seq(resampled, beep.Callback(func() { done <- true })), Paused: false}
233234
speaker.Play(ctrl)
234235
} else {
235-
speaker.Lock()
236236
newCtrl := &beep.Ctrl{Streamer: beep.Seq(resampled, beep.Callback(func() { done <- true })), Paused: false}
237-
speaker.Unlock()
238237
speaker.Play(newCtrl)
239238
}
240239

0 commit comments

Comments
 (0)