mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
audio: Refactoring: Add loop
This commit is contained in:
parent
d6dee0815e
commit
ca2f85f3d1
@ -219,7 +219,11 @@ func NewPlayer(sampleRate, channelNum, bytesPerSample int) (*Player, error) {
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
go func() {
|
||||
go p.loop()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (p *Player) loop() {
|
||||
for bufInBytes := range p.chBuffer {
|
||||
var bufInShorts []int16
|
||||
if p.bytesPerSample == 2 {
|
||||
@ -250,8 +254,6 @@ func NewPlayer(sampleRate, channelNum, bytesPerSample int) (*Player, error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (p *Player) Proceed(data []byte) error {
|
||||
|
Loading…
Reference in New Issue
Block a user