-
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
Getting rid of the EventLoop #301
Conversation
f5d76a6
to
bd59fd6
Compare
Examples are updated. |
5012fe5
to
737acca
Compare
The ALSA backend is ready for review. Breaking change: when an error happens, the error callback will be called but that doesn't destroy the stream or thread. The user will have to drop the |
Nice @ishitatsuyuki! I've only had a chance to look at the examples so far and I think they're looking great! I haven't had a chance to dig into the ALSA implementation just yet, but in the meantime a couple things that come to mind are:
I will aim to do a more thorough review of the ALSA backend soon! |
No, I intentionally exclude some of the platforms. In general, the synchronization story is unclear on many platforms, and I think it's the best to code in a style that uses message passing to serialize access to the underlying API.
My stance doesn't change from before, but I think that there is no problem doing that. Effectively we submit a task to the web event loop, instead of spawning a thread, and that perfectly fits into how the web API was supposed to work. And a disclaimer: I made some pretty wild refactor when modifying the ALSA backend (the code moved isn't preserved as-is), sorry if it seems hard to review. |
f4eeaa5
to
0ee93de
Compare
Rebased, but... I'm still struggling to motivate myself to work on the other backends. |
I may try to help with Windows platform. I have a machine with Win 10. Though please expect that there may be many questions :-D |
This is my first try at writing mentoring instructions, sorry if it's not detailed enough! Feel free to ask any questions. So the API changes are like this:
We first start with changing the main loop:
And now let's go on to the other API changes:
At this point I think I've covered most of the changes. There might be other compile errors so fix them if they're straightforward. I'll be ready to answer questions otherwise. |
woah, great writeup! This will help a lot! Thanks |
Just to let you know. I'm working on that, and the instruction is really helpful 👍 |
I haven't tested the WASAPI backend, I will get to that next time I use Windows if you don't beat me to it. |
I'm actually happy to contribute! Maybe I'll have a chance to have a look at it today. Thank you! |
I've fixed all the warning raised by Clippy in the Clippy also throws 2 errors (while
|
I guess I could help with ASIO too. Will try to update it using the same instruction |
Merged that. I removed the first assertion warned by clippy. We shouldn't rely on Windows constants being a particular value, but in this case the debug assertion is useless because a subtraction happens afterward which is checked in debug. So this justify the change. Regarding the second alignment error, this is pretty much a hack and I think we'd better leave it as-is. I looked up a bit and it seems that API is old so hopefully we can replace that with calls to newer APIs that requires less hacky conversion. If you can help with the ASIO backend too, great and thanks a lot! I'll check later if there's anything that need special handling. |
I fixed the WASAPI backend to the point that beep works. Others are unverified. |
Hi there! I'm newbie with Rust and I have a Mac machine. I'd like to help you with this cpal project, because I believe, it will help me to learn Rust more deeply :) |
8559c2f
to
4c3b7ef
Compare
4c3b7ef
to
025a5af
Compare
I finished the CoreAudio backend myself since it's quite different from other platforms and somewhat more simple to do. @crusadergo Sorry I've already finished the code, but if you can please help with testing! Checkout the PR as described here and then run |
Tested the current branch on Windows 10, it seems to work but with caveats. The beep example works fine, trying to port it to a Tested on Linux, on Ubuntu it seems to work fine (even my |
@icefoxen I inspected your code and it seems to be calling When getting no audio, the thing I usually do is to insert a debug println inside the callback. Although if you're getting mixer indicators that might be useless. |
The beep example has been glitchy for ages; see #272. |
It was, until I'd forgotten I'd written that way. Unfortunately, fixing it only makes the sound differently wrong. XD I'll investigate more later when I have time. |
Closing in favor of #354. |
Close #278. I rushed for a buildable version so you can see it, there's still a lot of thing to do.
can_pause
and optionally return an error!Sync
,!Send