mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-10 06:12:14 +02:00
Use our new custom std::variant bitsery extension
This prevents reinitializing `std::variant`s when the variant we want to deserialize is already active. We store audio buffers in variants, so reinitializing them results in a lot of unnecessary memory frees, allocations and writes during every processing cycle.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include <variant>
|
||||
|
||||
#include <bitsery/ext/std_optional.h>
|
||||
#include <bitsery/ext/std_variant.h>
|
||||
#include "../bitsery/ext/in-place-variant.h"
|
||||
#include <bitsery/traits/array.h>
|
||||
#include <bitsery/traits/vector.h>
|
||||
#include <vestige/aeffectx.h>
|
||||
@@ -402,7 +402,7 @@ struct Vst2Event {
|
||||
template <typename S>
|
||||
void serialize(S& s, Vst2Event::Payload& payload) {
|
||||
s.ext(payload,
|
||||
bitsery::ext::StdVariant{
|
||||
bitsery::ext::InPlaceVariant{
|
||||
[](S&, std::nullptr_t&) {},
|
||||
[](S& s, std::string& string) {
|
||||
s.text1b(string, max_string_length);
|
||||
@@ -486,7 +486,7 @@ struct Vst2EventResult {
|
||||
template <typename S>
|
||||
void serialize(S& s, Vst2EventResult::Payload& payload) {
|
||||
s.ext(payload,
|
||||
bitsery::ext::StdVariant{
|
||||
bitsery::ext::InPlaceVariant{
|
||||
[](S&, std::nullptr_t&) {},
|
||||
[](S& s, std::string& string) {
|
||||
s.text1b(string, max_string_length);
|
||||
@@ -585,7 +585,7 @@ struct AudioBuffers {
|
||||
void serialize(S& s) {
|
||||
s.ext(
|
||||
buffers,
|
||||
bitsery::ext::StdVariant{
|
||||
bitsery::ext::InPlaceVariant{
|
||||
[](S& s, std::vector<std::vector<float>>& buffer) {
|
||||
s.container(buffer, max_audio_channels, [](S& s, auto& v) {
|
||||
s.container4b(v, max_buffer_size);
|
||||
|
||||
Reference in New Issue
Block a user