mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +01:00
audio/internal/readerdriver: Bug fix: AudioQueuePause/Reset might take long time
This issue has existed since ae14caee93
.
This change fixes the issue by skipping the C function calls when
possible.
Updates #1650
This commit is contained in:
parent
a4d28198f4
commit
72d8d77173
@ -449,6 +449,7 @@ func (p *playerImpl) resetImpl() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(p.unqueuedBufs) < 2 {
|
||||||
if osstatus := C.AudioQueuePause(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
if osstatus := C.AudioQueuePause(p.audioQueue); osstatus != C.noErr && p.err == nil {
|
||||||
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueuePause failed: %d", osstatus))
|
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueuePause failed: %d", osstatus))
|
||||||
return
|
return
|
||||||
@ -462,6 +463,7 @@ func (p *playerImpl) resetImpl() {
|
|||||||
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueReset failed: %d", osstatus))
|
p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueueReset failed: %d", osstatus))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p.state = playerPaused
|
p.state = playerPaused
|
||||||
p.buf = p.buf[:0]
|
p.buf = p.buf[:0]
|
||||||
|
Loading…
Reference in New Issue
Block a user