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
@@ -178,32 +178,12 @@ class YaAudioProcessor : public Steinberg::Vst::IAudioProcessor {
virtual uint32 PLUGIN_API getLatencySamples() override = 0;
/**
* The response code and written state for a call to
* `IAudioProcessor::setupProcessing(setup)`.
*/
struct SetupProcessingResponse {
UniversalTResult result;
AudioShmBuffer::Config audio_buffers_config;
template <typename S>
void serialize(S& s) {
s.object(result);
s.object(audio_buffers_config);
}
};
/**
* Message to pass through a call to
* `IAudioProcessor::setupProcessing(setup)` to the Wine plugin host.
*
* Here Wine plugin host will set up the shared memory buffers.
*
* NOTE: This process is repeated as part of `SetActive`. Apparently REAPER
* can change bus arrangements after the processing has been set up.
*/
struct SetupProcessing {
using Response = SetupProcessingResponse;
using Response = UniversalTResult;
native_size_t instance_id;
@@ -256,7 +256,7 @@ class YaComponent : public Steinberg::Vst::IComponent {
/**
* The response code and written state for a call to
* `IAudioProcessor::setupProcessing(setup)`.
* `IAudioProcessor::setActive(state)`.
*/
struct SetActiveResponse {
UniversalTResult result;
@@ -276,7 +276,7 @@ class YaComponent : public Steinberg::Vst::IComponent {
*
* NOTE: REAPER may change a plugin's bus arrangements after the processing
* has been set up, so we need to check for this on every
* `setActive()` call
* `setActive()` call.
*/
struct SetActive {
using Response = SetActiveResponse;
@@ -142,7 +142,7 @@ Steinberg::Vst::ProcessData& YaProcessData::reconstruct(
// The actual audio data is contained within a shared memory object, and the
// input and output pointers point to regions in that object. These pointers
// are calculated while handling `IAudioProcessor::setupProcessing()`.
// are calculated while handling `IAudioProcessor::setActive()`.
// NOTE: The 32-bit and 64-bit audio pointers are a union, and since this is
// a raw memory buffer we can set either `channelBuffers32` or
// `channelBuffers64` to point at that buffer as long as we do the
+1 -1
View File
@@ -83,7 +83,7 @@ class YaProcessData {
* difficult for us to mess this up, we'll store those bus-channel pointers
* in `Vst3Bridge::InstanceInterfaces` and we'll point the pointers in our
* `inputs` and `outputs` fields directly to those pointers. They will have
* been set up during `IAudioProcessor::setupProcessing()`.
* been set up during `IAudioProcessor::setActive()`.
*
* These can be either float or double pointers. Since a pointer is a
* pointer and they're stored using a union the actual type doesn't matter,