LMMS
Loading...
Searching...
No Matches
audio-buffer.h
Go to the documentation of this file.
1#pragma once
2
3#include "private/std.h"
4
5#ifdef __cplusplus
6extern "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.
26typedef struct clap_audio_buffer {
27 // Either data32 or data64 pointer will be set.
28 float **data32;
29 double **data64;
31 uint32_t latency; // latency from/to the audio interface
32 uint64_t constant_mask;
34
35#ifdef __cplusplus
36}
37#endif
struct clap_audio_buffer clap_audio_buffer_t
unsigned int uint32_t
Definition mid.cpp:100
Definition audio-buffer.h:26
uint64_t constant_mask
Definition audio-buffer.h:32
float ** data32
Definition audio-buffer.h:28
uint32_t latency
Definition audio-buffer.h:31
uint32_t channel_count
Definition audio-buffer.h:30
double ** data64
Definition audio-buffer.h:29