faiface / beep

A little package that brings sound to any Go application. Suitable for playback and audio-processing.
MIT License
2.07k stars 152 forks source link

speaker.Init function shoud add recover to deal panic? #155

Open ttmars opened 2 years ago

ttmars commented 2 years ago
go func() {
    for {
        select {
        default:
            update()
        case <-done:
            return
        }
    }
}()

panic: runtime error: index out of range [-111848]

goroutine 155 [running]: github.com/faiface/beep.(Resampler).Stream(0xc00084d880, {0xc00083e000?, 0x67?, 0xc0000c9ee0?}) C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/resample.go:96 +0x3d3 github.com/faiface/beep.(Ctrl).Stream(0x1000000000067?, {0xc00083e000?, 0xc00047dcd8?, 0x1010000000000?}) C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/ctrl.go:43 +0x65 github.com/faiface/beep.Seq.func1({0xc00083e000?, 0x7ff76a618320?, 0x7ff769398701?}) C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/compositors.go:86 +0xb4 github.com/faiface/beep.StreamerFunc.Stream(0x44e8?, {0xc00083e000?, 0xc0000c9f80?, 0x7ff76972a996?}) C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/interface.go:100 +0x2a github.com/faiface/beep.(*Mixer).Stream(0x7ff76aa36d80, {0xc002310000, 0x113a, 0x113a}) C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/mixer.go:42 +0x194 github.com/faiface/beep/speaker.update() C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/speaker/speaker.go:109 +0x65 github.com/faiface/beep/speaker.Init.func1() C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/speaker/speaker.go:52 +0x1b created by github.com/faiface/beep/speaker.Init C:/Users/Ares/go/pkg/mod/github.com/faiface/beep@v1.1.0/speaker/speaker.go:48 +0x1e9

Process finished with the exit code 2