From 62fb6f63d7a44fc9c2c4300e6332da1fbc5e3d07 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Fri, 30 Oct 2026 19:19:28 +0100 Subject: [PATCH] Fix #35454: Do not activate a VST before its processing is set up An instrument that finishes loading after its track was switched on, as happens when exporting parts, was activated without setupProcessing() and then processed with no output buffers. Assisted-by: Claude Code 2.1.306 (Claude Opus 5.5) --- framework/vst/internal/vstaudioclient.cpp | 9 +++++++++ framework/vst/internal/vstaudioclient.h | 1 + 2 files changed, 10 insertions(+) diff --git a/framework/vst/internal/vstaudioclient.cpp b/framework/vst/internal/vstaudioclient.cpp index be82b789e0..567b594e69 100644 --- a/framework/vst/internal/vstaudioclient.cpp +++ b/framework/vst/internal/vstaudioclient.cpp @@ -436,11 +436,13 @@ void VstAudioClient::updateProcessSetup() setup.sampleRate = m_outputSpec.sampleRate; if (processor->setupProcessing(setup) != Steinberg::kResultOk) { + m_isProcessingSetUp = false; return; } setUpProcessData(); flushBuffers(); + m_isProcessingSetUp = true; ensureActivity(); } @@ -551,6 +553,13 @@ void VstAudioClient::ensureActivity() return; } + //! NOTE: The plugin may finish loading after the track has already been + //! switched on (e.g. right before an export). Activating it before + //! setupProcessing() would let process() run without output buffers + if (!m_isProcessingSetUp) { + return; + } + IAudioProcessorPtr processor = pluginProcessor(); if (!processor) { return; diff --git a/framework/vst/internal/vstaudioclient.h b/framework/vst/internal/vstaudioclient.h index 2c2672ca2a..9251c6d8b9 100644 --- a/framework/vst/internal/vstaudioclient.h +++ b/framework/vst/internal/vstaudioclient.h @@ -99,6 +99,7 @@ class VstAudioClient bool m_needUnprepareProcessData = false; bool m_needUpdateState = false; + bool m_isProcessingSetUp = false; PluginType m_type = PluginType::Undefined; audio::OutputSpec m_outputSpec;