Inhibit event loop during VST3 offline processing

This prevents T-RackS 5 from causing the export in Bitwig Studio 4.1.0
beta 2 to freeze.
This commit is contained in:
Robbert van der Helm
2021-11-10 21:29:40 +01:00
parent 9682446fab
commit 5b3210eed6
3 changed files with 27 additions and 2 deletions
+5
View File
@@ -27,6 +27,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- The socket endpoint used by a plugin group host process to accept new - The socket endpoint used by a plugin group host process to accept new
connections now gets removed when the group host process shuts down. connections now gets removed when the group host process shuts down.
Previously this would leave behind a file in the temporary directory. Previously this would leave behind a file in the temporary directory.
- Fixed the VST3 version of _IK Multimedia's T-RackS 5_ causing offline
rendering to stall indefinitely. This could happen when exporting or bouncing
audio in **Bitwig Studio 4.1** or in **REAPER**. That plugin deadlocks when it
receives timer events while doing offline audio processing, so we now prevent
that from happening.
## [3.6.0] - 2021-10-15 ## [3.6.0] - 2021-10-15
+14 -2
View File
@@ -114,8 +114,11 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
bool Vst3Bridge::inhibits_event_loop() noexcept { bool Vst3Bridge::inhibits_event_loop() noexcept {
std::lock_guard lock(object_instances_mutex); std::lock_guard lock(object_instances_mutex);
for (const auto& [instance_id, object] : object_instances) { for (const auto& [instance_id, instance] : object_instances) {
if (!object.is_initialized) { // HACK: IK Multimedia's T-RackS 5 will deadlock if it receives a timer
// proc during offline processing, so we need to prevent that from
// happening.
if (!instance.is_initialized || instance.is_offline_processing) {
return true; return true;
} }
} }
@@ -1429,6 +1432,15 @@ size_t Vst3Bridge::register_object_instance(
}, },
[&](YaAudioProcessor::SetupProcessing& request) [&](YaAudioProcessor::SetupProcessing& request)
-> YaAudioProcessor::SetupProcessing::Response { -> YaAudioProcessor::SetupProcessing::Response {
Vst3PluginInstance& instance =
object_instances.at(request.instance_id);
// See the comment in
// `Vst3Bridge::inhibits_event_loop()`
instance.is_offline_processing =
request.setup.processMode ==
Steinberg::Vst::kOffline;
const tresult result = const tresult result =
object_instances.at(request.instance_id) object_instances.at(request.instance_id)
.interfaces.audio_processor->setupProcessing( .interfaces.audio_processor->setupProcessing(
+8
View File
@@ -244,6 +244,14 @@ struct Vst3PluginInstance {
* have, but we'll just do this out of precaution. * have, but we'll just do this out of precaution.
*/ */
bool is_initialized = false; bool is_initialized = false;
/**
* Whether the plugin instance is currently in offline processing mode or
* not. Needed as a HACK for IK Multimedia's T-RackS 5 because those plugins
* will deadlock if they receive a timer proc on the Win32 message loop
* while doing offline processing.
*/
bool is_offline_processing = false;
}; };
/** /**