Mercurial > hg > pub > prymula > com
comparison DPF-Prymula-audioplugins/dpf/distrho/src/clap/audio-buffer.h @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:cf2cb71d31dd | 3:84e66ea83026 |
---|---|
1 #pragma once | |
2 | |
3 #include "private/std.h" | |
4 | |
5 #ifdef __cplusplus | |
6 extern "C" { | |
7 #endif | |
8 | |
9 // Sample code for reading a stereo buffer: | |
10 // | |
11 // bool isLeftConstant = (buffer->constant_mask & (1 << 0)) != 0; | |
12 // bool isRightConstant = (buffer->constant_mask & (1 << 1)) != 0; | |
13 // | |
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 // } | |
18 // | |
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. | |
24 // | |
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; | |
34 | |
35 #ifdef __cplusplus | |
36 } | |
37 #endif |