File: audio-ports-activation.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (54 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once

#include "../../plugin.h"

/// @page Audio Ports Activation
///
/// This extension provides a way for the host to activate and de-activate audio ports.
/// Deactivating a port provides the following benefits:
/// - the plugin knows ahead of time that a given input is not present and can choose
///   an optimized computation path,
/// - the plugin knows that an output is not consumed by the host, and doesn't need to
///   compute it.
///
/// Audio ports can only be activated or deactivated when the plugin is deactivated, unless
/// can_activate_while_processing() returns true.
///
/// Audio buffers must still be provided if the audio port is deactivated.
/// In such case, they shall be filled with 0 (or whatever is the neutral value in your context)
/// and the constant_mask shall be set.
///
/// Audio ports are initially in the active state after creating the plugin instance.
/// Audio ports state are not saved in the plugin state, so the host must restore the
/// audio ports state after creating the plugin instance.
///
/// Audio ports state is invalidated by clap_plugin_audio_ports_config.select() and
/// clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_LIST).

static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_ACTIVATION[] =
   "clap.audio-ports-activation/draft-0";

#ifdef __cplusplus
extern "C" {
#endif

typedef struct clap_plugin_audio_ports_activation {
   // Returns true if the plugin supports activation/deactivation while processing.
   // [main-thread]
   bool(CLAP_ABI *can_activate_while_processing)(const clap_plugin_t *plugin);

   // Activate the given port.
   //
   // It is only possible to activate and de-activate on the audio-thread if
   // can_activate_while_processing() returns true.
   //
   // [active ? audio-thread : main-thread]
   void(CLAP_ABI *set_active)(const clap_plugin_t *plugin,
                              bool                 is_input,
                              uint32_t             port_index,
                              bool                 is_active);
} clap_plugin_audio_ports_activation_t;

#ifdef __cplusplus
}
#endif