Implement IAudioProcessor::setBusArrangements()

This commit is contained in:
Robbert van der Helm
2020-12-14 16:40:40 +01:00
parent b87c3fe790
commit e3b442de57
7 changed files with 69 additions and 7 deletions
+11
View File
@@ -151,6 +151,17 @@ 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, void Vst3Logger::log_request(bool is_host_vst,
const YaPluginFactory::Construct&) { const YaPluginFactory::Construct&) {
log_request_base(is_host_vst, log_request_base(is_host_vst,
+1
View File
@@ -68,6 +68,7 @@ class Vst3Logger {
void log_request(bool is_host_vst, const YaComponent::SetActive&); 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::SetState&);
void log_request(bool is_host_vst, const YaComponent::GetState&); 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 YaPluginFactory::Construct&); void log_request(bool is_host_vst, const YaPluginFactory::Construct&);
void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&); void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&);
void log_request(bool is_host_vst, const WantsConfiguration&); void log_request(bool is_host_vst, const WantsConfiguration&);
+1
View File
@@ -69,6 +69,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
YaComponent::SetActive, YaComponent::SetActive,
YaComponent::SetState, YaComponent::SetState,
YaComponent::GetState, YaComponent::GetState,
YaComponent::SetBusArrangements,
YaPluginFactory::Construct, YaPluginFactory::Construct,
YaPluginFactory::SetHostContext>; YaPluginFactory::SetHostContext>;
+5
View File
@@ -39,6 +39,11 @@ using ArrayUID = std::array<
std::remove_reference_t<decltype(std::declval<Steinberg::TUID>()[0])>, std::remove_reference_t<decltype(std::declval<Steinberg::TUID>()[0])>,
std::extent_v<Steinberg::TUID>>; std::extent_v<Steinberg::TUID>>;
/**
* The maximum number of speakers or busses we support.
*/
constexpr size_t max_num_speakers = 16384;
/** /**
* The maximum size for an `IBStream` we can serialize. Allows for up to 50 MB * The maximum size for an `IBStream` we can serialize. Allows for up to 50 MB
* of preset data. Hopefully no plugin will come anywhere near this limit, but * of preset data. Hopefully no plugin will come anywhere near this limit, but
+31 -4
View File
@@ -192,7 +192,7 @@ class YaComponent : public Steinberg::Vst::IComponent,
tresult PLUGIN_API getControllerClassId(Steinberg::TUID classId) override; tresult PLUGIN_API getControllerClassId(Steinberg::TUID classId) override;
/** /**
* Message to pass through a call to `IComponent::setIoMode(IoMode)` to the * Message to pass through a call to `IComponent::setIoMode(mode)` to the
* Wine plugin host. * Wine plugin host.
*/ */
struct SetIoMode { struct SetIoMode {
@@ -282,7 +282,7 @@ class YaComponent : public Steinberg::Vst::IComponent,
/** /**
* The response code and returned routing information for a call to * The response code and returned routing information for a call to
* `IComponent::getRoutingInfo(inInfo, outInfo <out>)`. * `IComponent::getRoutingInfo(in_info, out_info <out>)`.
*/ */
struct GetRoutingInfoResponse { struct GetRoutingInfoResponse {
UniversalTResult result; UniversalTResult result;
@@ -298,8 +298,8 @@ class YaComponent : public Steinberg::Vst::IComponent,
}; };
/** /**
* Message to pass through a call to `IComponent::getRoutingInfo(inInfo, * Message to pass through a call to `IComponent::getRoutingInfo(in_info,
* outInfo <out>)` to the Wine plugin host. * out_info <out>)` to the Wine plugin host.
*/ */
struct GetRoutingInfo { struct GetRoutingInfo {
using Response = GetRoutingInfoResponse; using Response = GetRoutingInfoResponse;
@@ -425,6 +425,33 @@ class YaComponent : public Steinberg::Vst::IComponent,
getState(Steinberg::IBStream* state) override = 0; getState(Steinberg::IBStream* state) override = 0;
// From `IAudioProcessor` // 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 virtual tresult PLUGIN_API
setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs, setBusArrangements(Steinberg::Vst::SpeakerArrangement* inputs,
int32 numIns, int32 numIns,
+12 -3
View File
@@ -162,9 +162,18 @@ tresult PLUGIN_API YaComponentPluginImpl::setBusArrangements(
int32 numIns, int32 numIns,
Steinberg::Vst::SpeakerArrangement* outputs, Steinberg::Vst::SpeakerArrangement* outputs,
int32 numOuts) { int32 numOuts) {
// TODO: Implement assert(inputs && outputs);
bridge.logger.log("TODO: IAudioProcessor::setBusArrangements()"); return bridge
return Steinberg::kNotImplemented; .send_message(YaComponent::SetBusArrangements{
.instance_id = arguments.instance_id,
.inputs = std::vector<Steinberg::Vst::SpeakerArrangement>(
inputs, &inputs[numIns]),
.num_ins = numIns,
.outputs = std::vector<Steinberg::Vst::SpeakerArrangement>(
outputs, &outputs[numOuts]),
.num_outs = numOuts,
})
.native();
} }
tresult PLUGIN_API YaComponentPluginImpl::getBusArrangement( tresult PLUGIN_API YaComponentPluginImpl::getBusArrangement(
+8
View File
@@ -167,6 +167,14 @@ void Vst3Bridge::run() {
return YaComponent::GetStateResponse{ return YaComponent::GetStateResponse{
.result = result, .updated_state = std::move(stream)}; .result = result, .updated_state = std::move(stream)};
}, },
[&](YaComponent::SetBusArrangements& request)
-> YaComponent::SetBusArrangements::Response {
VectorStream stream;
return component_instances[request.instance_id]
.audio_processor->setBusArrangements(
request.inputs.data(), request.num_ins,
request.outputs.data(), request.num_outs);
},
[&](const YaPluginFactory::Construct&) [&](const YaPluginFactory::Construct&)
-> YaPluginFactory::Construct::Response { -> YaPluginFactory::Construct::Response {
return YaPluginFactory::ConstructArgs( return YaPluginFactory::ConstructArgs(