Skip to content

Cannot Play Two Sounds In Parallel #173

@zarkones

Description

@zarkones

Hello. The following code would crash the process with this stack trace:
stacktrace.txt

I might be missing something obvious, however, just not to me. :)

The code:
package main

import (
"bytes"
"fmt"
"time"
"ui/assets"

"github.com/faiface/beep/speaker"
"github.com/faiface/beep/wav"

)

func play() {
streamer, format, err := wav.Decode(bytes.NewReader(assets.ButtonClick))
if err != nil {
fmt.Println("failed to wav decide sfx:", err)
return
}

if err := speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10)); err != nil {
	fmt.Println("failed to speaker.Init sfx:", err)
	return
}

speaker.Play(streamer)

}

func main() {
play()
play()

time.Sleep(time.Second * 3)

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions