Cleanup
[carla.git] / source / includes / clap / audio-buffer.h
blob4d78f43a51170567eec68b06134bb85ad6134652
1 #pragma once
3 #include "private/std.h"
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
9 // Sample code for reading a stereo buffer:
11 // bool isLeftConstant = (buffer->constant_mask & (1 << 0)) != 0;
12 // bool isRightConstant = (buffer->constant_mask & (1 << 1)) != 0;
14 // for (int i = 0; i < N; ++i) {
15 // float l = data32[0][isLeftConstant ? 0 : i];
16 // float r = data32[1][isRightConstant ? 0 : i];
17 // }
19 // Note: checking the constant mask is optional, and this implies that
20 // the buffer must be filled with the constant value.
21 // Rationale: if a buffer reader doesn't check the constant mask, then it may
22 // process garbage samples and in result, garbage samples may be transmitted
23 // to the audio interface with all the bad consequences it can have.
25 // The constant mask is a hint.
26 typedef struct clap_audio_buffer {
27 // Either data32 or data64 pointer will be set.
28 float **data32;
29 double **data64;
30 uint32_t channel_count;
31 uint32_t latency; // latency from/to the audio interface
32 uint64_t constant_mask;
33 } clap_audio_buffer_t;
35 #ifdef __cplusplus
37 #endif