audio/internal/go2cpp: Refactoring

This commit is contained in:
Hajime Hoshi 2021-05-10 03:35:21 +09:00
parent 52c609459c
commit 9585c1e09a

View File

@ -21,10 +21,6 @@ import (
"syscall/js" "syscall/js"
) )
const (
readChunkSize = 4096
)
type Context struct { type Context struct {
v js.Value v js.Value
sampleRate int sampleRate int
@ -294,6 +290,8 @@ func (p *Player) writeImpl(dst js.Value, src []byte) {
} }
func (p *Player) loop() { func (p *Player) loop() {
const readChunkSize = 4096
buf := make([]byte, readChunkSize) buf := make([]byte, readChunkSize)
dst := js.Global().Get("Uint8Array").New(readChunkSize) dst := js.Global().Get("Uint8Array").New(readChunkSize)