1
0
Fork 0

Allow marking CLAP plugins as hard realtime

This commit is contained in:
Robbert van der Helm 2022-05-22 01:01:59 +02:00
parent 2ac013df64
commit 985db44503
2 changed files with 7 additions and 2 deletions

View file

@ -160,6 +160,11 @@ pub trait ClapPlugin: Plugin {
const CLAP_MANUAL_URL: &'static str;
/// A URL to the plugin's support page, CLAP does not specify what to do when there is none.
const CLAP_SUPPORT_URL: &'static str;
/// If this is set to true, then the plugin will report itself as having a hard realtime
/// processing requirement when the host asks for it. Supported hosts will never ask the plugin
/// to do offline processing.
const CLAP_HARD_REALTIME: bool = false;
}
/// Provides auxiliary metadata needed for a VST3 plugin.

View file

@ -2636,8 +2636,7 @@ impl<P: ClapPlugin> Wrapper<P> {
unsafe extern "C" fn ext_render_has_hard_realtime_requirement(
_plugin: *const clap_plugin,
) -> bool {
// TODO: Add a constant on the CLapPlugin trait
false
P::CLAP_HARD_REALTIME
}
unsafe extern "C" fn ext_render_set(
@ -2649,6 +2648,7 @@ impl<P: ClapPlugin> Wrapper<P> {
let mode = match mode {
CLAP_RENDER_REALTIME => ProcessMode::Realtime,
// Even if the plugin has a hard realtime requirement, we'll still honor this
CLAP_RENDER_OFFLINE => ProcessMode::Offline,
n => {
nih_debug_assert_failure!("Unknown rendering mode '{}', defaulting to realtime", n);