-
Notifications
You must be signed in to change notification settings - Fork 20
Attempting to get OfflineAudioContext.suspend to work #50
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
Attempting to get OfflineAudioContext.suspend to work #50
Conversation
Note this requires the latest checkout of orottier/web-audio-api-rs#407 to compile. Otherwise we need thread safe jsfunction which complicates things further. Solving this issue might also pave the way for the event listeners? |
Also note that I'm aware this is not spec compliant in its current form, but I have a plan to make |
When I change the rust implementation to run the callback directly when
there is no issue. The JsFunction is executed properly and the result is as expected. So it must have something to do with the async context not having access to the method, I believe. |
Hey, I managed to make the callback run without crashing by using the |
Alright, Indeed strange the callback does not seem to run instantly. The rust lib correctly schedules the callback to execute on render quantum 173 but the next render quantum it does not notice any new audio graph messages to be handled.. Perhaps we need to look into how to make the call context blocking or so.. |
Assuming that the JsFunction is handed to the event loop, which is blocked by the actual execution of However we are between a rock and a hard place here because that means that I have another design up my sleeve where we model the |
Hum yup, that sounds quite logical indeed
No problem for me to go this way if you want to have a try, tokio is already integrated into napi-rs to handle async stuff from what I understand |
Fix/clippy
Just wanted to let you know I am actually working on async rendering, but it is really hard. Async stuff is not my cup of tea |
Seems to work like a charm! Really nice! |
That's great news! I will merge this (after a tiny bit of polishing) into the wpt branch, which we can also clean up a bit further to be merged into the main branch. |
+1 |
Sorry, I just trashed the diff by merging |
Alright, continuing this work in #42 now |
Hey @b-ma I could maybe use your help. I was trying to get
suspend
to work but I'm running intoThis happens when the rust lib is trying to run the JsFunction
It is maybe because the function reference cannot be resolved. I'm trying to read https://nodejs.org/api/n-api.html#references-to-values-with-a-lifespan-longer-than-that-of-the-native-method but not sure if it is related and how to continue. Any ideas?