From 216c6bc4f27211ba7b45457d8d8f12c970bea56a Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 28 Apr 2021 13:35:15 +0200 Subject: [PATCH] Always provide at least some speaker arrangement This works around a bug in the VST3 version of W. A. Production Imperfect as mentioned in #97. Even if it's a synth and numInputs is 0, the plugin will still try to read the input arrangement. --- CHANGELOG.md | 2 ++ src/wine-host/bridges/vst3.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 677a3fb1..71c07f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Prevent _Native Instruments' FM7_ from crashing when processing MIDI. As a fix, MIDI events are now deallocated later then when they normally would have to be. +- Fixed the VST3 version of _W. A. Production ImPerfect_ from crashing during + audio setup. - Fixed _UVI Plugsound Free_ crashing during initialization. - Fixed extreme DSP usage increases in _Kush Audio REDDI_ and _Expressive E Noisy_ caused by denormals. diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 646a9170..054ded63 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -1172,10 +1172,20 @@ size_t Vst3Bridge::register_object_instance( overload{ [&](YaAudioProcessor::SetBusArrangements& request) -> YaAudioProcessor::SetBusArrangements::Response { + // HACK: WA Production Imperfect VST3 somehow requires + // `inputs` to be a valid pointer, even if there + // are no inputs. + Steinberg::Vst::SpeakerArrangement empty_arrangement = + 0; + return object_instances[request.instance_id] .audio_processor->setBusArrangements( - request.inputs.data(), request.num_ins, - request.outputs.data(), request.num_outs); + request.num_ins > 0 ? request.inputs.data() + : &empty_arrangement, + request.num_ins, + request.num_outs > 0 ? request.outputs.data() + : &empty_arrangement, + request.num_outs); }, [&](YaAudioProcessor::GetBusArrangement& request) -> YaAudioProcessor::GetBusArrangement::Response {