diff --git a/src/common/serialization/vst3/base.h b/src/common/serialization/vst3/base.h index d1155e35..1d7057e9 100644 --- a/src/common/serialization/vst3/base.h +++ b/src/common/serialization/vst3/base.h @@ -60,6 +60,28 @@ struct Ack { void serialize(S&) {} }; +/** + * A simple wrapper around primitive values for serialization purposes. Bitsery + * doesn't seem to like serializing plain primitives using `s.object()` even if + * you define a serialization function. + */ +template +class PrimitiveWrapper { + public: + PrimitiveWrapper() {} + PrimitiveWrapper(T value) : value(value) {} + + operator T() { return value; } + + template + void serialize(S& s) { + s.template value(value); + } + + private: + T value; +}; + /** * A wrapper around `Steinberg::tresult` that we can safely share between the * native plugin and the Wine process. Depending on the platform and on whether