From 2f5d22ca17a2fc47d852c1409e36e70cdf942713 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 5 Jan 2021 23:04:18 +0100 Subject: [PATCH] Handle effMainsChanged on the main UI thread #75 This fixes EZdrummer not producing any sound, as the plugin presumably schedules some task on the Win32 message loop to load its resources, which won't happen if this is run from any other thread. --- CHANGELOG.md | 7 +++++++ src/wine-host/bridges/vst2.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 165bbf6d..102fed67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,13 @@ TODO: Add an updated screenshot with some fancy VST3-only plugins to the readme with, and it then applies the change conditionally to be able to support building with both older and newer versions of Wine. +### Fixed + +- The function for suspending and resuming audio, `effMainsChanged()`, is now + always executed from the GUI thread. This fixes **EZdrummer** not producing + any sound as it makes the incorrect assumption that `effMainsChanged()` is + always called from the GUI thread. + ### yabridgectl - Updated for the changes in yabridge 3.0. Yabridgectl now allows you to set up diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 7d404b76..410b6ba3 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -40,10 +40,14 @@ std::mutex current_bridge_instance_mutex; /** * Opcodes that should always be handled on the main thread because they may * involve GUI operations. + * + * NOTE: `effMainsChanged` is the odd one here. EZdrummer interacts with the + * Win32 message loop while handling this function. If we don't execute + * this from the main GUI thread, then EZdrummer won't produce any sound. */ -const std::set unsafe_opcodes{effOpen, effClose, effEditGetRect, - effEditOpen, effEditClose, effEditIdle, - effEditTop}; +const std::set unsafe_opcodes{effOpen, effClose, effEditGetRect, + effEditOpen, effEditClose, effEditIdle, + effEditTop, effMainsChanged}; intptr_t VST_CALL_CONV host_callback_proxy(AEffect*, int, int, intptr_t, void*, float);