From 9c30d64975c5bbe82d861ce6dc010ed32a5ef59f Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 11 Jun 2021 17:22:46 +0200 Subject: [PATCH] Fix speaker arrangement bitsets The sizes were wrong, and Blue Cat Audio's VST3 plugins seem to use the upper bits to store the channel configuration, which thus got read out incorrectly. --- src/common/logging/vst3.cpp | 23 +++++++++++++---------- src/wine-host/bridges/vst3.cpp | 12 +++++++++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index e0192fcc..aab33efc 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -915,9 +915,10 @@ bool Vst3Logger::log_request( if (!first) { message << ", "; } - message << "SpeakerArrangement: 0b" - << std::bitset( - arrangement); + message + << "SpeakerArrangement: 0b" + << std::bitset( + arrangement); first = false; } @@ -927,9 +928,10 @@ bool Vst3Logger::log_request( if (!first) { message << ", "; } - message << "SpeakerArrangement: 0b" - << std::bitset( - arrangement); + message + << "SpeakerArrangement: 0b" + << std::bitset( + arrangement); first = false; } @@ -1778,10 +1780,11 @@ void Vst3Logger::log_response( log_response_base(is_host_vst, [&](auto& message) { message << response.result.string(); if (response.result == Steinberg::kResultOk) { - message << ", ( - response.arr) - << ">"; + message + << ", ( + response.arr) + << ">"; } }); } diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index a4e48ea5..0a6139d4 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -34,6 +34,8 @@ * `IComponent` pointer into an `IPluginBase` smart pointer. This way we can * keep the rest of yabridge's design in tact. */ +using std::endl; + Steinberg::FUnknownPtr hack_init_plugin_base( Steinberg::IPtr object, Steinberg::IPtr component); @@ -1174,12 +1176,20 @@ AudioShmBuffer::Config Vst3Bridge::setup_shared_audio_buffers( audio_processor->getBusArrangement(direction, bus, speaker_arrangement); + std::cout << speaker_arrangement << std::endl; + std::cout + << std::bitset( + speaker_arrangement) + << endl; + const size_t num_channels = - std::bitset( + std::bitset( speaker_arrangement) .count(); bus_offsets[bus].resize(num_channels); + std::cout << num_channels << " channels" << std::endl; + for (size_t channel = 0; channel < num_channels; channel++) { bus_offsets[bus][channel] = current_offset; current_offset += setup.maxSamplesPerBlock;