-
Notifications
You must be signed in to change notification settings - Fork 396
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
cpal uses macOS specific APIs not supported on iOS #224
Comments
I believe audio is too different on iOS compared to macOS, and that it deserves its own parallel implementation. This will also make sure people updating the macOS backend will not overwrite the iOS backend forgetting about the important special cases. |
I am wondering if cpal could use AVFoundation on iOS. This API is more modern and as far as I can tell offers everything cpal needs, in an easier to use form. |
@Moxinilian How far did you get in your implementation? |
@Moxinilian you should have a look at how SDL2 is doing this for iOS, it would make your job easier |
@mtak- not far at all, I got busy somewhere else. If this is something you want to tackle please do as my experience with Apple audio APIs is limited. But I will have to do it sooner than later. |
@Moxinilian I think I'm going to use OpenAl since that works on android (via openalsoft) and iOS. I'll spend a little time trying to cobble together a cpal backend, but if that fails, I'll roll a custom openal backed sound library. |
Considering cpal does not have an Android backend that could kill two birds with one stone. |
OpenAL soft uses OpenSL ES on the backend on android, so I suspect it'll be pretty fast. My concerns are that some issues discussed here #92 (comment) might apply. I don't fully understand the context of what they were talking about, but basically OpenAL is poll based instead of being callback based so there could be some timing issues. I've just started on the implementation and haven't gotten far enough to test anything. @jpernst or @tomaka might be able to expand more on the potential problems. |
@Moxinilian I'm giving up, and rolling a custom audio lib on top of alto. Here's a somewhat working version of cpal with openal as a backend: https://github.com/mtak-/cpal/tree/openal There's a fair amount to cleanup, but it's a decent start. The current design of cpal has intentional latency which, atleast using openal on iphone5s, is tough to lower enough to be satisfying for sound effects IMHO (e.g. this button was pressed, so make a click noise). If I try to push the latency below around 1/15th-1/20th of a second (every 4th/3rd graphical frame), CPU usage gets high, and iphone5s risks dropping audio frames. There might be a way to fix it, but it seems easier to just roll a custom audio lib at this point. Related: #205 |
While the README argues iOS is supported, it currently is not as a large part of the CoreAudio logic depends on macOS-specific APIs.
Here is a list of the missing bindings:
This breaks compatibility for iOS and therefore breaks all iOS projects depending on cpal.
I am currently working on iOS support for the Amethyst game engine, so I assume I will have to look into that myself. However, I do not have the necessary experience nor time to fix all those issues to bring back iOS support.
The text was updated successfully, but these errors were encountered: