mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/readerdriver: Refactoring
This commit is contained in:
parent
f9b8238cd6
commit
383bceddd5
@ -268,8 +268,8 @@ func (p *playerImpl) Play() {
|
||||
runLoop = true
|
||||
}
|
||||
|
||||
buf := make([]byte, p.context.maxBufferSize())
|
||||
for len(p.buf) < p.context.maxBufferSize() {
|
||||
buf := make([]byte, p.context.maxBufferSize())
|
||||
n, err := p.src.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
p.setErrorImpl(err)
|
||||
@ -363,12 +363,12 @@ func (p *playerImpl) Reset() {
|
||||
}
|
||||
// AudioQueueReset invokes the callback directry.
|
||||
p.cond.L.Unlock()
|
||||
if osstatus := C.AudioQueueReset(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
||||
osstatus := C.AudioQueueReset(p.audioQueue)
|
||||
p.cond.L.Lock()
|
||||
if osstatus != C.noErr && p.err == nil {
|
||||
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueReset failed: %d", osstatus))
|
||||
p.cond.L.Lock()
|
||||
return
|
||||
}
|
||||
p.cond.L.Lock()
|
||||
if osstatus := C.AudioQueueFlush(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
||||
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueFlush failed: %d", osstatus))
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user