diff --git a/src/common/communication.h b/src/common/communication.h index ec1af6c0..51ecc318 100644 --- a/src/common/communication.h +++ b/src/common/communication.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,17 @@ #include #include +// These are for the serialization done by bitsery + +/** + * The maximum number of audio channels supported. + */ +constexpr size_t max_audio_channels = 32; +/** + * The maximum number of samples in a buffer. + */ + +constexpr size_t max_buffer_size = 16384; /** * The maximum size in bytes of a string or buffer passed through a void pointer * in one of the dispatch functions. This is used as a buffer size and also as a @@ -143,6 +155,24 @@ struct ParameterResult { } }; +/** + * A buffer of audio for the plugin to process, or the response of that + * processing. The number of samples is encoded in each audio buffer's length. + */ +struct AudioBuffer { + /** + * An audio buffer for each of the plugin's audio channels. The number of + * samples is equal to `buffers[0].size()`. + */ + std::vector> buffers; + + template + void serialize(S& s) { + s.container(buffers, max_audio_channels, + [](S& s, auto& v) { s.container4b(v, max_buffer_size); }); + } +}; + /** * The serialization function for `AEffect` structs. This will s serialize all * of the values but it will not touch any of the pointer fields. That way you