process.h (2081B)
1 #pragma once 2 3 #include "events.h" 4 #include "audio-buffer.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 enum { 11 // Processing failed. The output buffer must be discarded. 12 CLAP_PROCESS_ERROR = 0, 13 14 // Processing succeeded, keep processing. 15 CLAP_PROCESS_CONTINUE = 1, 16 17 // Processing succeeded, keep processing if the output is not quiet. 18 CLAP_PROCESS_CONTINUE_IF_NOT_QUIET = 2, 19 20 // Rely upon the plugin's tail to determine if the plugin should continue to process. 21 // see clap_plugin_tail 22 CLAP_PROCESS_TAIL = 3, 23 24 // Processing succeeded, but no more processing is required, 25 // until the next event or variation in audio input. 26 CLAP_PROCESS_SLEEP = 4, 27 }; 28 typedef int32_t clap_process_status; 29 30 typedef struct clap_process { 31 // A steady sample time counter. 32 // This field can be used to calculate the sleep duration between two process calls. 33 // This value may be specific to this plugin instance and have no relation to what 34 // other plugin instances may receive. 35 // 36 // Set to -1 if not available, otherwise the value must be greater or equal to 0, 37 // and must be increased by at least `frames_count` for the next call to process. 38 int64_t steady_time; 39 40 // Number of frames to process 41 uint32_t frames_count; 42 43 // time info at sample 0 44 // If null, then this is a free running host, no transport events will be provided 45 const clap_event_transport_t *transport; 46 47 // Audio buffers, they must have the same count as specified 48 // by clap_plugin_audio_ports->count(). 49 // The index maps to clap_plugin_audio_ports->get(). 50 // Input buffer and its contents are read-only. 51 const clap_audio_buffer_t *audio_inputs; 52 clap_audio_buffer_t *audio_outputs; 53 uint32_t audio_inputs_count; 54 uint32_t audio_outputs_count; 55 56 // Input and output events. 57 // 58 // Events must be sorted by time. 59 // The input event list can't be modified. 60 const clap_input_events_t *in_events; 61 const clap_output_events_t *out_events; 62 } clap_process_t; 63 64 #ifdef __cplusplus 65 } 66 #endif