mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
Split YaAudioProcessor from YaComponent
Now all that's left is splitting YaComponent into the IComponent bits and separate YaPluginMonlith that implements everything.
This commit is contained in:
+98
-97
@@ -36,6 +36,82 @@ void Vst3Logger::log_unknown_interface(
|
||||
}
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetBusArrangements& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setBusArrangements(inputs = [SpeakerArrangement; "
|
||||
<< request.inputs.size() << "], numIns = " << request.num_ins
|
||||
<< ", outputs = [SpeakerArrangement; " << request.outputs.size()
|
||||
<< "], numOuts = " << request.num_outs << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetBusArrangement& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getBusArrangement(dir = " << request.dir
|
||||
<< ", index = " << request.index << ", &arr)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::CanProcessSampleSize& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::canProcessSampleSize(symbolicSampleSize = "
|
||||
<< request.symbolic_sample_size << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetLatencySamples& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getLatencySamples()";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetupProcessing& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setupProcessing(setup = <SetupProcessing with mode = "
|
||||
<< request.setup.processMode << ", symbolic_sample_size = "
|
||||
<< request.setup.symbolicSampleSize
|
||||
<< ", max_buffer_size = " << request.setup.maxSamplesPerBlock
|
||||
<< " and sample_rate = " << request.setup.sampleRate << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetProcessing& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setProcessing(state = "
|
||||
<< (request.state ? "true" : "false") << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::Process& request) {
|
||||
// TODO: Only log this on log level 2
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
// TODO: Log about the process data
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::process(TODO)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetTailSamples& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getTailSamples()";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst, const YaComponent::Construct&) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
// TODO: Log the CID on verbosity level 2, and then also report all CIDs
|
||||
@@ -130,82 +206,6 @@ void Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetBusArrangements& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setBusArrangements(inputs = [SpeakerArrangement; "
|
||||
<< request.inputs.size() << "], numIns = " << request.num_ins
|
||||
<< ", outputs = [SpeakerArrangement; " << request.outputs.size()
|
||||
<< "], numOuts = " << request.num_outs << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetBusArrangement& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getBusArrangement(dir = " << request.dir
|
||||
<< ", index = " << request.index << ", &arr)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::CanProcessSampleSize& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::canProcessSampleSize(symbolicSampleSize = "
|
||||
<< request.symbolic_sample_size << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetLatencySamples& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getLatencySamples()";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetupProcessing& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setupProcessing(setup = <SetupProcessing with mode = "
|
||||
<< request.setup.processMode << ", symbolic_sample_size = "
|
||||
<< request.setup.symbolicSampleSize
|
||||
<< ", max_buffer_size = " << request.setup.maxSamplesPerBlock
|
||||
<< " and sample_rate = " << request.setup.sampleRate << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::SetProcessing& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::setProcessing(state = "
|
||||
<< (request.state ? "true" : "false") << ")";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::Process& request) {
|
||||
// TODO: Only log this on log level 2
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
// TODO: Log about the process data
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::process(TODO)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetTailSamples& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IAudioProcessor* #" << request.instance_id
|
||||
<< ">::getTailSamples()";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPluginBase::Initialize& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
@@ -246,6 +246,28 @@ void Vst3Logger::log_request(bool is_host_vst, const WantsConfiguration&) {
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(
|
||||
bool is_host_vst,
|
||||
const YaAudioProcessor::GetBusArrangementResponse& response) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
if (response.result == Steinberg::kResultOk) {
|
||||
message << ", <SpeakerArrangement>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(
|
||||
bool is_host_vst,
|
||||
const YaAudioProcessor::ProcessResponse& response) {
|
||||
// TODO: Only log this on verbosity level 2
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
|
||||
// TODO: Log response
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst, const Ack&) {
|
||||
log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; });
|
||||
}
|
||||
@@ -302,27 +324,6 @@ void Vst3Logger::log_response(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(
|
||||
bool is_host_vst,
|
||||
const YaComponent::GetBusArrangementResponse& response) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
if (response.result == Steinberg::kResultOk) {
|
||||
message << ", <SpeakerArrangement>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaComponent::ProcessResponse& response) {
|
||||
// TODO: Only log this on verbosity level 2
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
|
||||
// TODO: Log response
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPluginFactory::ConstructArgs& args) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
+17
-12
@@ -56,6 +56,19 @@ class Vst3Logger {
|
||||
// flag here indicates whether the request was initiated on the host side
|
||||
// (what we'll call a control message).
|
||||
|
||||
void log_request(bool is_host_vst,
|
||||
const YaAudioProcessor::SetBusArrangements&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaAudioProcessor::GetBusArrangement&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaAudioProcessor::CanProcessSampleSize&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaAudioProcessor::GetLatencySamples&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaAudioProcessor::SetupProcessing&);
|
||||
void log_request(bool is_host_vst, const YaAudioProcessor::SetProcessing&);
|
||||
void log_request(bool is_host_vst, const YaAudioProcessor::Process&);
|
||||
void log_request(bool is_host_vst, const YaAudioProcessor::GetTailSamples&);
|
||||
void log_request(bool is_host_vst, const YaComponent::Construct&);
|
||||
void log_request(bool is_host_vst, const YaComponent::Destruct&);
|
||||
void log_request(bool is_host_vst, const YaComponent::SetIoMode&);
|
||||
@@ -66,15 +79,6 @@ class Vst3Logger {
|
||||
void log_request(bool is_host_vst, const YaComponent::SetActive&);
|
||||
void log_request(bool is_host_vst, const YaComponent::SetState&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetState&);
|
||||
void log_request(bool is_host_vst, const YaComponent::SetBusArrangements&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetBusArrangement&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaComponent::CanProcessSampleSize&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetLatencySamples&);
|
||||
void log_request(bool is_host_vst, const YaComponent::SetupProcessing&);
|
||||
void log_request(bool is_host_vst, const YaComponent::SetProcessing&);
|
||||
void log_request(bool is_host_vst, const YaComponent::Process&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetTailSamples&);
|
||||
void log_request(bool is_host_vst, const YaPluginBase::Initialize&);
|
||||
void log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
||||
void log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
||||
@@ -82,6 +86,10 @@ class Vst3Logger {
|
||||
void log_request(bool is_host_vst, const WantsConfiguration&);
|
||||
|
||||
void log_response(bool is_host_vst, const Ack&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaAudioProcessor::GetBusArrangementResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaAudioProcessor::ProcessResponse&);
|
||||
void log_response(
|
||||
bool is_host_vst,
|
||||
const std::variant<YaComponent::ConstructArgs, UniversalTResult>&);
|
||||
@@ -89,9 +97,6 @@ class Vst3Logger {
|
||||
void log_response(bool is_host_vst,
|
||||
const YaComponent::GetRoutingInfoResponse&);
|
||||
void log_response(bool is_host_vst, const YaComponent::GetStateResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaComponent::GetBusArrangementResponse&);
|
||||
void log_response(bool is_host_vst, const YaComponent::ProcessResponse&);
|
||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||
void log_response(bool is_host_vst, const Configuration&);
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ VST3 interfaces are implemented as follows:
|
||||
|
||||
| Yabridge class | Included in | Interfaces |
|
||||
| ------------------- | ------------- | ------------------------------------------------------ |
|
||||
| `YaComponent` | | `IComponent`, `IAudioProcessor` |
|
||||
| `YaHostApplication` | | `iHostAPplication` |
|
||||
| `YaComponent` | | `IComponent` |
|
||||
| `YaAudioProcessor` | `YaComponent` | `IAudioProcessor` |
|
||||
| `YaPluginBase` | `YaComponent` | `IPluginBase` |
|
||||
| `YaHostApplication` | | `iHostAPplication` |
|
||||
| `YaPluginFactory` | | `IPluginFactory`, `IPluginFactory2`, `IPluginFactory3` |
|
||||
|
||||
The following interfaces are implemented purely fur serialization purposes:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// yabridge: a Wine VST bridge
|
||||
// Copyright (C) 2020 Robbert van der Helm
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "audio-processor.h"
|
||||
|
||||
YaAudioProcessor::ConstructArgs::ConstructArgs() {}
|
||||
|
||||
YaAudioProcessor::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::FUnknown> component)
|
||||
: supported(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor>(component)) {}
|
||||
|
||||
YaAudioProcessor::YaAudioProcessor(const ConstructArgs&& args)
|
||||
: arguments(std::move(args)) {}
|
||||
@@ -0,0 +1,314 @@
|
||||
// yabridge: a Wine VST bridge
|
||||
// Copyright (C) 2020 Robbert van der Helm
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <bitsery/ext/std_optional.h>
|
||||
#include <pluginterfaces/vst/ivstaudioprocessor.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "base.h"
|
||||
#include "host-application.h"
|
||||
#include "process-data.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
|
||||
/**
|
||||
* Wraps around `IAudioProcessor` for serialization purposes. This is
|
||||
* instantiated as part of `YaComponent`.
|
||||
*/
|
||||
class YaAudioProcessor : public Steinberg::Vst::IAudioProcessor {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for creating a `YaAudioProcessor`.
|
||||
*/
|
||||
struct ConstructArgs {
|
||||
ConstructArgs();
|
||||
|
||||
/**
|
||||
* Check whether an existing implementation implements `IPluginBase` and
|
||||
* read arguments from it.
|
||||
*/
|
||||
ConstructArgs(Steinberg::IPtr<Steinberg::FUnknown> object);
|
||||
|
||||
/**
|
||||
* Whether the object supported this interface.
|
||||
*/
|
||||
bool supported;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value1b(supported);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Instantiate this instance with arguments read from another interface
|
||||
* implementation.
|
||||
*/
|
||||
YaAudioProcessor(const ConstructArgs&& args);
|
||||
|
||||
inline bool supported() { return arguments.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::setBusArrangements(inputs, num_ins, outputs, num_outs)`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct SetBusArrangements {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
// These are orginally C-style heap arrays, not normal pointers
|
||||
std::vector<Steinberg::Vst::SpeakerArrangement> inputs;
|
||||
int32 num_ins;
|
||||
std::vector<Steinberg::Vst::SpeakerArrangement> outputs;
|
||||
int32 num_outs;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.container8b(inputs, max_num_speakers);
|
||||
s.value4b(num_ins);
|
||||
s.container8b(outputs, max_num_speakers);
|
||||
s.value4b(num_outs);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
int32 numOuts) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and written state for a call to
|
||||
* `IAudioProcessor::getBusArrangement(dir, index, arr)`.
|
||||
*/
|
||||
struct GetBusArrangementResponse {
|
||||
UniversalTResult result;
|
||||
Steinberg::Vst::SpeakerArrangement updated_arr;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.value8b(updated_arr);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::getBusArrangement(dir, index, arr)` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct GetBusArrangement {
|
||||
using Response = GetBusArrangementResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
Steinberg::Vst::BusDirection dir;
|
||||
int32 index;
|
||||
Steinberg::Vst::SpeakerArrangement arr;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(dir);
|
||||
s.value4b(index);
|
||||
s.value8b(arr);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
getBusArrangement(Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::canProcessSampleSize(symbolic_sample_size)` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct CanProcessSampleSize {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
int32 symbolic_sample_size;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(symbolic_sample_size);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
canProcessSampleSize(int32 symbolicSampleSize) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::getLatencySamples()`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct GetLatencySamples {
|
||||
using Response = PrimitiveWrapper<uint32>;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual uint32 PLUGIN_API getLatencySamples() override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::setupProcessing(setup)` to the Wine plugin host.
|
||||
*/
|
||||
struct SetupProcessing {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
Steinberg::Vst::ProcessSetup setup;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(setup);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setupProcessing(Steinberg::Vst::ProcessSetup& setup) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::setProcessing(state)`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct SetProcessing {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
TBool state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value1b(state);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API setProcessing(TBool state) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and all the output data resulting from a call to
|
||||
* `IAudioProcessor::process(data)`.
|
||||
*/
|
||||
struct ProcessResponse {
|
||||
UniversalTResult result;
|
||||
YaProcessDataResponse output_data;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(output_data);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::process(data)` to the
|
||||
* Wine plugin host. This `YaProcessData` object wraps around all input
|
||||
* audio buffers, parameter changes and events along with all context data
|
||||
* provided by the host so we can send it to the Wine plugin host. We can
|
||||
* then use `YaProcessData::get()` on the Wine plugin host side to
|
||||
* reconstruct the original `ProcessData` object, and we then finally use
|
||||
* `YaProcessData::move_outputs_to_response()` to create a response object
|
||||
* that we can write back to the `ProcessData` object provided by the host.
|
||||
*/
|
||||
struct Process {
|
||||
using Response = ProcessResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
YaProcessData data;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(data);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
process(Steinberg::Vst::ProcessData& data) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::getTailSamples()`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct GetTailSamples {
|
||||
using Response = PrimitiveWrapper<uint32>;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual uint32 PLUGIN_API getTailSamples() override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::BusInfo& info) {
|
||||
s.value4b(info.mediaType);
|
||||
s.value4b(info.direction);
|
||||
s.value4b(info.channelCount);
|
||||
s.container2b(info.name);
|
||||
s.value4b(info.busType);
|
||||
s.value4b(info.flags);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::RoutingInfo& info) {
|
||||
s.value4b(info.mediaType);
|
||||
s.value4b(info.busIndex);
|
||||
s.value4b(info.channel);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::ProcessSetup& setup) {
|
||||
s.value4b(setup.processMode);
|
||||
s.value4b(setup.symbolicSampleSize);
|
||||
s.value4b(setup.maxSamplesPerBlock);
|
||||
s.value8b(setup.sampleRate);
|
||||
}
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
@@ -22,8 +22,8 @@ YaComponent::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::Vst::IComponent> component,
|
||||
size_t instance_id)
|
||||
: instance_id(instance_id),
|
||||
audio_processor_supported(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor>(component)) {
|
||||
audio_processor_args(component),
|
||||
plugin_base_args(component) {
|
||||
// `IComponent::getControllerClassId`
|
||||
Steinberg::TUID cid;
|
||||
if (component->getControllerClassId(cid) == Steinberg::kResultOk) {
|
||||
@@ -32,7 +32,8 @@ YaComponent::ConstructArgs::ConstructArgs(
|
||||
}
|
||||
|
||||
YaComponent::YaComponent(const ConstructArgs&& args)
|
||||
: YaPluginBase(std::move(args.plugin_base_args)),
|
||||
: YaAudioProcessor(std::move(args.audio_processor_args)),
|
||||
YaPluginBase(std::move(args.plugin_base_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
YaComponent::~YaComponent() {
|
||||
@@ -61,7 +62,7 @@ tresult PLUGIN_API YaComponent::queryInterface(Steinberg::FIDString _iid,
|
||||
}
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IComponent::iid,
|
||||
Steinberg::Vst::IComponent)
|
||||
if (arguments.audio_processor_supported) {
|
||||
if (YaAudioProcessor::supported()) {
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IAudioProcessor::iid,
|
||||
Steinberg::Vst::IAudioProcessor)
|
||||
}
|
||||
|
||||
@@ -25,15 +25,14 @@
|
||||
#include <bitsery/ext/std_set.h>
|
||||
#include <bitsery/ext/std_variant.h>
|
||||
#include <bitsery/traits/array.h>
|
||||
#include <pluginterfaces/vst/ivstaudioprocessor.h>
|
||||
#include <pluginterfaces/vst/ivstcomponent.h>
|
||||
|
||||
#include "../../bitsery/ext/vst3.h"
|
||||
#include "../common.h"
|
||||
#include "audio-processor.h"
|
||||
#include "base.h"
|
||||
#include "host-application.h"
|
||||
#include "plugin-base.h"
|
||||
#include "process-data.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
@@ -55,8 +54,8 @@
|
||||
* the SDK's `AudioEffect` component.
|
||||
*/
|
||||
class YaComponent : public Steinberg::Vst::IComponent,
|
||||
public YaPluginBase,
|
||||
public Steinberg::Vst::IAudioProcessor {
|
||||
public YaAudioProcessor,
|
||||
public YaPluginBase {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for creating a `YaComponentPluginImpl`.
|
||||
@@ -77,11 +76,9 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
*/
|
||||
native_size_t instance_id;
|
||||
|
||||
YaAudioProcessor::ConstructArgs audio_processor_args;
|
||||
YaPluginBase::ConstructArgs plugin_base_args;
|
||||
|
||||
// TODO: Remove, transitional
|
||||
bool audio_processor_supported;
|
||||
|
||||
/**
|
||||
* The class ID of this component's corresponding editor controller. You
|
||||
* can't use C-style array in `std::optional`s.
|
||||
@@ -91,8 +88,8 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(audio_processor_args);
|
||||
s.object(plugin_base_args);
|
||||
s.value1b(audio_processor_supported);
|
||||
s.ext(edit_controller_cid, bitsery::ext::StdOptional{},
|
||||
[](S& s, auto& cid) { s.container1b(cid); });
|
||||
}
|
||||
@@ -101,8 +98,7 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
/**
|
||||
* Message to request the Wine plugin host to instantiate a new IComponent
|
||||
* to pass through a call to `IComponent::createInstance(cid,
|
||||
* IComponent::iid,
|
||||
* ...)`.
|
||||
* IComponent::iid, ...)`.
|
||||
*/
|
||||
struct Construct {
|
||||
using Response = std::variant<ConstructArgs, UniversalTResult>;
|
||||
@@ -145,7 +141,6 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
|
||||
DECLARE_FUNKNOWN_METHODS
|
||||
|
||||
// From `IComponent`
|
||||
tresult PLUGIN_API getControllerClassId(Steinberg::TUID classId) override;
|
||||
|
||||
/**
|
||||
@@ -381,222 +376,6 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
virtual tresult PLUGIN_API
|
||||
getState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
// From `IAudioProcessor`
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::setBusArrangements(inputs, num_ins, outputs, num_outs)`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct SetBusArrangements {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
// These are orginally C-style heap arrays, not normal pointers
|
||||
std::vector<Steinberg::Vst::SpeakerArrangement> inputs;
|
||||
int32 num_ins;
|
||||
std::vector<Steinberg::Vst::SpeakerArrangement> outputs;
|
||||
int32 num_outs;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.container8b(inputs, max_num_speakers);
|
||||
s.value4b(num_ins);
|
||||
s.container8b(outputs, max_num_speakers);
|
||||
s.value4b(num_outs);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs,
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
int32 numOuts) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and written state for a call to
|
||||
* `IAudioProcessor::getBusArrangement(dir, index, arr)`.
|
||||
*/
|
||||
struct GetBusArrangementResponse {
|
||||
UniversalTResult result;
|
||||
Steinberg::Vst::SpeakerArrangement updated_arr;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.value8b(updated_arr);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::getBusArrangement(dir, index, arr)` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct GetBusArrangement {
|
||||
using Response = GetBusArrangementResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
Steinberg::Vst::BusDirection dir;
|
||||
int32 index;
|
||||
Steinberg::Vst::SpeakerArrangement arr;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(dir);
|
||||
s.value4b(index);
|
||||
s.value8b(arr);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
getBusArrangement(Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::canProcessSampleSize(symbolic_sample_size)` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct CanProcessSampleSize {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
int32 symbolic_sample_size;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(symbolic_sample_size);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
canProcessSampleSize(int32 symbolicSampleSize) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::getLatencySamples()`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct GetLatencySamples {
|
||||
using Response = PrimitiveWrapper<uint32>;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual uint32 PLUGIN_API getLatencySamples() override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IAudioProcessor::setupProcessing(setup)` to the Wine plugin host.
|
||||
*/
|
||||
struct SetupProcessing {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
Steinberg::Vst::ProcessSetup setup;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(setup);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setupProcessing(Steinberg::Vst::ProcessSetup& setup) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::setProcessing(state)`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct SetProcessing {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
TBool state;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value1b(state);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API setProcessing(TBool state) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and all the output data resulting from a call to
|
||||
* `IAudioProcessor::process(data)`.
|
||||
*/
|
||||
struct ProcessResponse {
|
||||
UniversalTResult result;
|
||||
YaProcessDataResponse output_data;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(output_data);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::process(data)` to the
|
||||
* Wine plugin host. This `YaProcessData` object wraps around all input
|
||||
* audio buffers, parameter changes and events along with all context data
|
||||
* provided by the host so we can send it to the Wine plugin host. We can
|
||||
* then use `YaProcessData::get()` on the Wine plugin host side to
|
||||
* reconstruct the original `ProcessData` object, and we then finally use
|
||||
* `YaProcessData::move_outputs_to_response()` to create a response object
|
||||
* that we can write back to the `ProcessData` object provided by the host.
|
||||
*/
|
||||
struct Process {
|
||||
using Response = ProcessResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
YaProcessData data;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(data);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
process(Steinberg::Vst::ProcessData& data) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IAudioProcessor::getTailSamples()`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct GetTailSamples {
|
||||
using Response = PrimitiveWrapper<uint32>;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
}
|
||||
};
|
||||
|
||||
virtual uint32 PLUGIN_API getTailSamples() override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
@@ -609,32 +388,3 @@ void serialize(
|
||||
std::variant<YaComponent::ConstructArgs, UniversalTResult>& result) {
|
||||
s.ext(result, bitsery::ext::StdVariant{});
|
||||
}
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::BusInfo& info) {
|
||||
s.value4b(info.mediaType);
|
||||
s.value4b(info.direction);
|
||||
s.value4b(info.channelCount);
|
||||
s.container2b(info.name);
|
||||
s.value4b(info.busType);
|
||||
s.value4b(info.flags);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::RoutingInfo& info) {
|
||||
s.value4b(info.mediaType);
|
||||
s.value4b(info.busIndex);
|
||||
s.value4b(info.channel);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::ProcessSetup& setup) {
|
||||
s.value4b(setup.processMode);
|
||||
s.value4b(setup.symbolicSampleSize);
|
||||
s.value4b(setup.maxSamplesPerBlock);
|
||||
s.value8b(setup.sampleRate);
|
||||
}
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
|
||||
@@ -40,9 +40,8 @@ class YaPluginBase : public Steinberg::IPluginBase {
|
||||
ConstructArgs();
|
||||
|
||||
/**
|
||||
* Read arguments from an existing implementation. Depending on the
|
||||
* supported interface function more or less of this struct will be left
|
||||
* empty, and `known_iids` will be set accordingly.
|
||||
* Check whether an existing implementation implements `IPluginBase` and
|
||||
* read arguments from it.
|
||||
*/
|
||||
ConstructArgs(Steinberg::IPtr<Steinberg::FUnknown> object);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user