clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 6dd53ffb0c00b2238071e071db2e8daece576b4f
parent 1c596e1604cd3353658d41089d4a347c27ede4a5
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Mon, 24 Jan 2022 16:48:55 +0100

Add comment about constant_mask

Fixes #58

Diffstat:
Minclude/clap/audio-buffer.h | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/clap/audio-buffer.h b/include/clap/audio-buffer.h @@ -8,6 +8,23 @@ extern "C" { #pragma pack(push, CLAP_ALIGN) +// Sample code for reading a stereo buffer: +// +// bool isLeftConstant = (buffer->constant_mask & (1 << 0)) != 0; +// bool isRightConstant = (buffer->constant_mask & (1 << 1)) != 0; +// +// for (int i = 0; i < N; ++i) { +// float l = data32[0][i * isLeftConstant]; +// float r = data32[1][i * isRightConstant]; +// } +// +// Note: checking the constant mask is optional, and this implies that +// the buffer must be filled with the constant value. +// Rationale: if a buffer reader doesn't check the constant mask, then it may +// process garbage samples and in result, garbage samples may be transmitted +// to the audio interface with all the bad consequences it can have. +// +// The constant mask is a hint. typedef struct clap_audio_buffer { // Either data32 or data64 pointer will be set. float **data32;