💥 Reimplement VST3 audio processing

In the same way as 50c25c1cf0 did it for
VST2 plugins. Input and output audio data is now stored in a shared
memory buffer instead of being sent over the sockets. This reduces the
bridging overhead to a minimum since copying data was the most expensive
operation we were doing and we now only need to copy the entire buffer
once per processing cycle.
This commit is contained in:
Robbert van der Helm
2021-06-11 13:56:42 +02:00
parent a7d8063db4
commit dec19dc12a
8 changed files with 444 additions and 363 deletions
+37
View File
@@ -139,6 +139,34 @@ struct InstanceInterfaces {
*/
std::optional<InstancePlugView> plug_view_instance;
/**
* A shared memory object we'll write the input audio buffers to on the
* native plugin side. We'll then let the plugin write its outputs here on
* the Wine side. The buffer will be configured during
* `IAudioProcessor::setupProcessing()`. At that point we'll build the
* configuration for the object here, on the Wine side, and then we'll
* initialize the buffers using that configuration. This same configuration
* is then used on the native plugin side to connect to this same shared
* memory object for the matching plugin instance.
*/
std::optional<AudioShmBuffer> process_buffers;
/**
* Pointers to the per-bus input channels in process_buffers so we can pass
* them to the plugin after a call to `YaProcessData::reconstruct()`. These
* can be either `float*` or `double*`, so we sadly have to use void
* pointers here.
*/
std::vector<std::vector<void*>> process_buffers_input_pointers;
/**
* Pointers to the per-bus output channels in process_buffers so we can pass
* them to the plugin after a call to `YaProcessData::reconstruct()`. These
* can be either `float*` or `double*`, so we sadly have to use void
* pointers here.
*/
std::vector<std::vector<void*>> process_buffers_output_pointers;
/**
* This instance's editor, if it has an open editor. Embedding here works
* exactly the same as how it works for VST2 plugins.
@@ -348,6 +376,15 @@ class Vst3Bridge : public HostBridge {
*/
size_t generate_instance_id() noexcept;
/**
* Sets up the shared memory audio buffers for a plugin instance plugin
* instance and return the configuration so the native plugin can connect to
* it as well.
*/
AudioShmBuffer::Config setup_shared_audio_buffers(
size_t instance_id,
const Steinberg::Vst::ProcessSetup& setup);
/**
* Assign a unique identifier to an object and add it to `object_instances`.
* This will also set up listeners for `IAudioProcessor` and `IComponent`