Only set up VST3 SHM audio buffers in setActive()

This avoids doing the duplicate check (since both `setProcessing()` and
`setActive()` would be called), and this also gets rid of the assumption
added a couple commits ago that `setupProcessing()` is only ever called
once, which is not true.
This commit is contained in:
Robbert van der Helm
2022-05-19 14:43:59 +02:00
parent 8c10edf861
commit 162aeed661
11 changed files with 21 additions and 78 deletions
+6 -19
View File
@@ -186,19 +186,9 @@ uint32 PLUGIN_API Vst3PluginProxyImpl::getLatencySamples() {
tresult PLUGIN_API
Vst3PluginProxyImpl::setupProcessing(Steinberg::Vst::ProcessSetup& setup) {
const YaAudioProcessor::SetupProcessingResponse response =
bridge_.send_audio_processor_message(YaAudioProcessor::SetupProcessing{
.instance_id = instance_id(), .setup = setup});
// We have now set up the shared audio buffers on the Wine side, and we'll
// be able to able to connect to them by using the same audio configuration
if (!process_buffers_) {
process_buffers_.emplace(response.audio_buffers_config);
} else {
process_buffers_->resize(response.audio_buffers_config);
}
return response.result;
return bridge_.send_audio_processor_message(
YaAudioProcessor::SetupProcessing{.instance_id = instance_id(),
.setup = setup});
}
tresult PLUGIN_API Vst3PluginProxyImpl::setProcessing(TBool state) {
@@ -427,13 +417,10 @@ tresult PLUGIN_API Vst3PluginProxyImpl::setActive(TBool state) {
YaComponent::SetActive{.instance_id = instance_id(), .state = state});
// NOTE: REAPER may (and will) change a plugin's channel layout after
// calling `setupProcessing()`. Because of that, we need to test
// whether this has happened any time the plugin gets reactivated.
// It's technically legal, so we need to support it.
// calling `IAudioProcessor::setupProcessing()`. Because of that, we
// need to test whether this has happened any time the plugin gets
// reactivated. It's technically legal, so we need to support it.
if (response.updated_audio_buffers_config) {
// The host should absolutely not call this function before
// `setupProcessing()` so this should already contain a value, but you
// never know...
if (!process_buffers_) {
process_buffers_.emplace(*response.updated_audio_buffers_config);
} else {
+1 -1
View File
@@ -468,7 +468,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
* amount of copies required to only once for the input audio, and one more
* copy when copying the results back to the host.
*
* This will be set up during `IAudioProcessor::setupProcessing()`.
* This will be set up during `IAudioProcessor::setActive()`.
*/
std::optional<AudioShmBuffer> process_buffers_;