mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-14 04:52:04 +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
|
runLoop = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf := make([]byte, p.context.maxBufferSize())
|
||||||
for len(p.buf) < p.context.maxBufferSize() {
|
for len(p.buf) < p.context.maxBufferSize() {
|
||||||
buf := make([]byte, p.context.maxBufferSize())
|
|
||||||
n, err := p.src.Read(buf)
|
n, err := p.src.Read(buf)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
p.setErrorImpl(err)
|
p.setErrorImpl(err)
|
||||||
@ -363,12 +363,12 @@ func (p *playerImpl) Reset() {
|
|||||||
}
|
}
|
||||||
// AudioQueueReset invokes the callback directry.
|
// AudioQueueReset invokes the callback directry.
|
||||||
p.cond.L.Unlock()
|
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.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueReset failed: %d", osstatus))
|
||||||
p.cond.L.Lock()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.cond.L.Lock()
|
|
||||||
if osstatus := C.AudioQueueFlush(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
if osstatus := C.AudioQueueFlush(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
||||||
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueFlush failed: %d", osstatus))
|
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueFlush failed: %d", osstatus))
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user