New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples/flappy: SE sometimes doesn't play on macOS #1680
Comments
I could reproduce this issue with examples/wav. |
There is a race condition: there are two |
git bisect says 72d8d77 is the culprit. |
So I thought diff --git a/audio/internal/readerdriver/driver_darwin.go b/audio/internal/readerdriver/driver_darwin.go
index bcb36a7e..c96e6bee 100644
--- a/audio/internal/readerdriver/driver_darwin.go
+++ b/audio/internal/readerdriver/driver_darwin.go
@@ -33,7 +33,7 @@ import (
)
func IsAvailable() bool {
- return false
+ return true
}
type audioQueuePoolItem struct {
@@ -495,11 +495,12 @@ func (p *playerImpl) resetImpl() {
return
}
+ if osstatus := C.AudioQueuePause(p.audioQueue); osstatus != C.noErr && p.err == nil {
+ p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueuePause failed: %d", osstatus))
+ return
+ }
+
if len(p.unqueuedBufs) < 2 {
- if osstatus := C.AudioQueuePause(p.audioQueue); osstatus != C.noErr && p.err == nil {
- p.setErrorImpl(fmt.Errorf("readerdriver: AudioQueuePause failed: %d", osstatus))
- return
- }
// AudioQueueReset invokes the callback directry.
q := p.audioQueue
p.m.Unlock() |
Note: let's try AudioUnit for lower latency EDIT: 🤔 https://discourse.libsdl.org/t/ios-why-use-audioqueue-instead-of-audiounit/22011 |
CC @wasedaigo
The text was updated successfully, but these errors were encountered: