mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +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
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// playing can be false when pausing.
|
||||||
|
if !p.playing {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
const bufSize = 2048
|
const bufSize = 2048
|
||||||
|
|
||||||
var buf []byte
|
var buf []byte
|
||||||
var err error
|
var err error
|
||||||
var proceed int64
|
var proceed int64
|
||||||
if p.playing && p.context.playable() {
|
if p.context.playable() {
|
||||||
newBuf := make([]byte, bufSize-len(p.buf))
|
newBuf := make([]byte, bufSize-len(p.buf))
|
||||||
n := 0
|
n := 0
|
||||||
n, err = p.src.Read(newBuf)
|
n, err = p.src.Read(newBuf)
|
||||||
|
Loading…
Reference in New Issue
Block a user