Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1KB

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