Fix serializing silence flags

We didn't initialize the field, and we also didn't copy the updated
value back (since everything else is a pointer to the original data).
This fixes audio channels in REAPER randomly being silence, as this
field would otherwise be uninitialized.

Thanks a lot to @kytdkut for finding this issue!
This commit is contained in:
Robbert van der Helm
2021-01-26 23:50:48 +01:00
parent cf9ae47f99
commit 04d0ff0949
2 changed files with 20 additions and 8 deletions
@@ -233,6 +233,15 @@ Steinberg::Vst::ProcessData& YaProcessData::get() {
}
YaProcessDataResponse YaProcessData::move_outputs_to_response() {
// NOTE: We _have_ to manually copy over the silence flags from the
// `ProcessData` object generated in `get()` here sicne these of
// course are not references or pointers like all other fields, so
// they're not implicitly copied like all of our other fields
for (int i = 0; i < reconstructed_process_data.numOutputs; i++) {
outputs[i].silence_flags =
reconstructed_process_data.outputs[i].silenceFlags;
}
return YaProcessDataResponse{
.outputs = std::move(outputs),
.output_parameter_changes = std::move(output_parameter_changes),