audio: Use (*Context).NewPlayer

This commit is contained in:
Hajime Hoshi 2021-10-07 22:34:59 +09:00
parent 3f5d1762bb
commit 69087cdc40

View File

@ -39,7 +39,7 @@ func TestGC(t *testing.T) {
setup() setup()
defer teardown() defer teardown()
p, _ := audio.NewPlayer(context, bytes.NewReader(make([]byte, 4))) p, _ := context.NewPlayer(bytes.NewReader(make([]byte, 4)))
got := audio.PlayersNumForTesting() got := audio.PlayersNumForTesting()
if want := 0; got != want { if want := 0; got != want {
t.Errorf("PlayersNum(): got: %d, want: %d", got, want) t.Errorf("PlayersNum(): got: %d, want: %d", got, want)
@ -76,11 +76,11 @@ func TestSameSourcePlayers(t *testing.T) {
defer teardown() defer teardown()
src := bytes.NewReader(make([]byte, 4)) src := bytes.NewReader(make([]byte, 4))
p0, err := audio.NewPlayer(context, src) p0, err := context.NewPlayer(src)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
p1, err := audio.NewPlayer(context, src) p1, err := context.NewPlayer(src)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -103,7 +103,7 @@ func TestPauseBeforeInit(t *testing.T) {
defer teardown() defer teardown()
src := bytes.NewReader(make([]byte, 4)) src := bytes.NewReader(make([]byte, 4))
p, err := audio.NewPlayer(context, src) p, err := context.NewPlayer(src)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }