mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Implement IAudioProcessor::setBusArrangements()
This commit is contained in:
@@ -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,
|
||||
const YaPluginFactory::Construct&) {
|
||||
log_request_base(is_host_vst,
|
||||
|
||||
@@ -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::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 YaPluginFactory::Construct&);
|
||||
void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&);
|
||||
void log_request(bool is_host_vst, const WantsConfiguration&);
|
||||
|
||||
@@ -69,6 +69,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
|
||||
YaComponent::SetActive,
|
||||
YaComponent::SetState,
|
||||
YaComponent::GetState,
|
||||
YaComponent::SetBusArrangements,
|
||||
YaPluginFactory::Construct,
|
||||
YaPluginFactory::SetHostContext>;
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@ using ArrayUID = std::array<
|
||||
std::remove_reference_t<decltype(std::declval<Steinberg::TUID>()[0])>,
|
||||
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
|
||||
* of preset data. Hopefully no plugin will come anywhere near this limit, but
|
||||
|
||||
@@ -192,7 +192,7 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
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.
|
||||
*/
|
||||
struct SetIoMode {
|
||||
@@ -282,7 +282,7 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
UniversalTResult result;
|
||||
@@ -298,8 +298,8 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponent::getRoutingInfo(inInfo,
|
||||
* outInfo <out>)` to the Wine plugin host.
|
||||
* Message to pass through a call to `IComponent::getRoutingInfo(in_info,
|
||||
* out_info <out>)` to the Wine plugin host.
|
||||
*/
|
||||
struct GetRoutingInfo {
|
||||
using Response = GetRoutingInfoResponse;
|
||||
@@ -425,6 +425,33 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
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,
|
||||
|
||||
@@ -162,9 +162,18 @@ tresult PLUGIN_API YaComponentPluginImpl::setBusArrangements(
|
||||
int32 numIns,
|
||||
Steinberg::Vst::SpeakerArrangement* outputs,
|
||||
int32 numOuts) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO: IAudioProcessor::setBusArrangements()");
|
||||
return Steinberg::kNotImplemented;
|
||||
assert(inputs && outputs);
|
||||
return bridge
|
||||
.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(
|
||||
|
||||
@@ -167,6 +167,14 @@ void Vst3Bridge::run() {
|
||||
return YaComponent::GetStateResponse{
|
||||
.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&)
|
||||
-> YaPluginFactory::Construct::Response {
|
||||
return YaPluginFactory::ConstructArgs(
|
||||
|
||||
Reference in New Issue
Block a user