-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add a description of the expectation of request_callback timing #422
Conversation
Without making a requirement, indicate the intent of the timing.
Maybe add a note saying that a realtime audio engine can steal all the CPU time if the audio computation is overloaded, and there is nothing the host can do about it. |
OK changed it to this
|
include/clap/host.h
Outdated
@@ -35,6 +35,12 @@ typedef struct clap_host { | |||
void(CLAP_ABI *request_process)(const struct clap_host *host); | |||
|
|||
// Request the host to schedule a call to plugin->on_main_thread(plugin) on the main thread. | |||
// This callback should be called as soon as practicable, usually in the host application's next | |||
// available main thread time slice. Typically callbacks occur at least in the 10s-to-50s-of-milliseconds |
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.
maybe:
Typically callbacks occur within at 33ms (~30Hz).
Maybe just giving an idea of the worst case is enough.
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.
OK pushed
It is not directly the host that will starve the GUI thread but simply the kernel scheduler that won't allocate resource to it. |
I'd argue on modern architectures you can usually avoid that in a well written host, but yeah I changed it from host to environment to make the blame a bit more amorphous |
How would you avoid it? |
Pin your ui thread to an efficiency core and pin your audio thread to the powered cores for instance would help a lot. |
My computer doesn't have efficiency cores :-) But yes, if you reserve some dedicated resources for the GUI, you can achieve it. |
Ha yeah I was just reflecting on how well bitwig and logic do this in Mac honestly when I wrote that comment but that’s just chatter here not what I put in the pr. The pr just points out it might be worse |
In Bitwig we effectively don't use the efficiency cores on macOS M1 because they rarely meet the deadline. We should try again to use them and see if the scheduler is able to do a good job. In theory it could because there's a workgroup (deadline sched) from coreaudio that you can join, and the kernel knows that all the threads that belongs to this group have to meet the audio interface's deadline. So it isn't a specific resource allocation for the GUI that we did but more a workaround. |
gotcha. well logic does according to my cpu meter! and it works great! |
Thank you 👍 |
* Add a description of the expectation of request_callback timing Without making a requirement, indicate the intent of the timing. * Add an apostrophe * Add host can starve feedback from alex * more review feedback * notjusthosts
* Add a description of the expectation of request_callback timing Without making a requirement, indicate the intent of the timing. * Add an apostrophe * Add host can starve feedback from alex * more review feedback * notjusthosts
Without making a requirement, indicate the intent of the timing.