Add a second payload value to events

This is for data passed through the `value` `intptr_t` parameter. The
only two events that use this are `effSetSpeakerArrangement` and
`effGetSpeakerArrangement`. Since this is such a rare occurrence we'll
leave the regular `value` field as it is.
This commit is contained in:
Robbert van der Helm
2020-05-07 16:45:11 +02:00
parent ff9f151639
commit 044b7fa9a2
+8 -3
View File
@@ -389,18 +389,23 @@ struct Event {
* Bitsery can do all the hard work for us.
*/
EventPayload payload;
/**
* The same as the above value, but for values passed through the `intptr_t`
* value parameter. `effGetSpeakerArrangement` and
* `effSetSpeakerArrangement` are the only events that use this.
*/
std::optional<EventPayload> value_payload;
template <typename S>
void serialize(S& s) {
s.value4b(opcode);
s.value4b(index);
// Hard coding pointer sizes to 8 bytes should be fine, right? Even if
// we're hosting a 32 bit plugin the native VST plugin will still use 64
// bit large pointers.
s.value8b(value);
s.value4b(option);
s.object(payload);
s.ext(value_payload, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.object(v); });
}
};