Open duysqubix opened 1 year ago
I made it compile and work under wasm - main issue is bufferSize
- it must be 0 or a power of two between 256 and 16384.
I didn't investigate what happens under hood, but by brute force managed to make it work.
if you setup buffer size to 8194 (that then in browser becomes 4096, everything works (or at least "hello beep")
speaker.Init(format.SampleRate, 8194)
Hi ! I've been toying a little with Beep under Mac OS with success. Great lib !
Then I tried to compile my little hello world for wasm with
GOOS=js GOARCH=wasm go build -o tstbeep
and I got these errors
Most, if not all, of these functions have been deprecated for a while.
At first I thought it could be a problem related with Oto, so I compiled https://github.com/hajimehoshi/oto/blob/master/example/main.go to wasm and go it working (at least for Firefox, Chrome is more restrictive but that's not the point)
My tstbeep go.mod is simple as
I really don't see where gopherjs comes into the dance. Oto doesn't seems to use it, neither Beep...
So, because I had installed (and never used) gopherjs :
rm -rf gopherjs ~/go/bin directory
andrm -rf gopherjs ~/go/pkg/mod/github.com/gopherjs
And issuing a
GOOS=js GOARCH=wasm go build -o tstbeep
resurrected ~/go/pkg/mod/github.com/gopherjs
Any clue ?
Original issue: https://github.com/faiface/beep/issues/113