mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-28 03:32:45 +01:00
audio: Bug fix: newPlayer should return error in JS
This commit is contained in:
parent
72e0080f65
commit
797bd04b1f
@ -49,7 +49,7 @@ func initialize() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPlayer(src io.ReadSeeker, sampleRate int) *Player {
|
func newPlayer(src io.ReadSeeker, sampleRate int) (*Player, error) {
|
||||||
if context == nil {
|
if context == nil {
|
||||||
if !initialize() {
|
if !initialize() {
|
||||||
panic("audio couldn't be initialized")
|
panic("audio couldn't be initialized")
|
||||||
@ -62,7 +62,7 @@ func newPlayer(src io.ReadSeeker, sampleRate int) *Player {
|
|||||||
position: context.Get("currentTime").Float(),
|
position: context.Get("currentTime").Float(),
|
||||||
bufferSource: nil,
|
bufferSource: nil,
|
||||||
}
|
}
|
||||||
return &Player{p}
|
return &Player{p}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func toLR(data []byte) ([]int16, []int16) {
|
func toLR(data []byte) ([]int16, []int16) {
|
||||||
|
Loading…
Reference in New Issue
Block a user