-
Notifications
You must be signed in to change notification settings - Fork 68
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
Refactored audio stack with PortAudio #497
base: master
Are you sure you want to change the base?
Conversation
(cherry picked from commit 1f1ad69)
Awesome, will try it asap... |
Can you replace openal-soft by portaudio in the osx sections of ci.yml and cd.yml? |
Windows part needs more tests
Needs more tests on windows
Correction
Correction
I think I know what's wrong with the test on OSX. Not sure why it happens on this PR and not on others though. Doing this in SetPixelFormat seems to workaround the bug. There is a division by 0 or of 0.
Edit: forget what I said, the test did fail on something portaudio related, in portaudio.(*Stream).Close(0x0) in audio.Reconfigure(0xac44) in audio.go:112 |
You can just call audio.Init() after Init(&video.Video{}) in Test_coreLoadGame |
audio/audio.go
Outdated
paStream.Close() | ||
h, _ := portaudio.DefaultOutputDevice() | ||
paStream, _ = portaudio.OpenStream(NewParameters(h), paCallback) | ||
paStream.Start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can do some basic error management like
if paStream != nil {
if err := paStream.Close(); err != nil {
log.Fatalln(err)
}
}
h, err := portaudio.DefaultOutputDevice()
if err != nil {
log.Fatalln(err)
}
paStream, err = portaudio.OpenStream(NewParameters(h), paCallback)
if err != nil {
log.Fatalln(err)
}
if err = paStream.Start(); err != nil {
log.Fatalln(err)
}
BTW is there any package manager other than choco in windows env of github workflow? |
There may be another one, I see portaudio on a package manager called vcpkg here PortAudio/portaudio#578 I tried your branch on OSX, I noticed 2 things:
|
I think the crackling occurrs when the core sends data slower than sample rate, causing 0 filled in the interval. |
Here' how mine work: |
Hmm.. Hey, maybe we can just turn off blocking in write() when it is fast-forwarding, instead of returning size and letting it muted. And volume may be reduced when fast-forwarding. |
Changing build tools of portaudio to cmake
Change build tools of portaudio to cmake
Improvement
Add support to F-Fwd
stereo test
Weird enough... Only right channel is played even though PA stream opened with 2 channels. I'll go to stackoverflow <:-/ |
Finally I found the right way to output stereo
Stereo stuff
Okay finally it is stereo now :-) |
minor fix
BTW I want to know if the patch will pass ci/cd now :-) |
It seems that github workflow env has no audio device, causing the failure 'cause portaudio works with audio hardware. We have to do something to the tests <:-/ |
Built with OpenAL, Ludo has audible audio latency (hundreds of milliseconds!), which is unbearable for retro gaming.
I managed to refactor it with PortAudio, which is as much portable as OpenAL, and has much lower latency.