mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
audio: Stop the loop when pausing
This change reduces the necessity to fill zero bytes.
This commit is contained in:
parent
5121b072f1
commit
5dd12afd38
@ -447,12 +447,17 @@ func (p *playerImpl) read() ([]byte, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// playing can be false when pausing.
|
||||
if !p.playing {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
const bufSize = 2048
|
||||
|
||||
var buf []byte
|
||||
var err error
|
||||
var proceed int64
|
||||
if p.playing && p.context.playable() {
|
||||
if p.context.playable() {
|
||||
newBuf := make([]byte, bufSize-len(p.buf))
|
||||
n := 0
|
||||
n, err = p.src.Read(newBuf)
|
||||
|
Loading…
Reference in New Issue
Block a user