mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Implement IComponent::getRoutingInfo()
This commit is contained in:
@@ -99,6 +99,19 @@ void Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaComponent::GetRoutingInfo& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IComponent* #" << request.instance_id
|
||||
<< ">::getRoutingInfo(inInfo = <RoutingInfo& for bus "
|
||||
<< request.in_info.busIndex << " and channel "
|
||||
<< request.in_info.channel
|
||||
<< ">, outInfo = <RoutingInfo& for bus "
|
||||
<< request.out_info.busIndex << " and channel "
|
||||
<< request.out_info.channel << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPluginFactory::Construct&) {
|
||||
log_request_base(is_host_vst,
|
||||
@@ -147,6 +160,22 @@ void Vst3Logger::log_response(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(
|
||||
bool is_host_vst,
|
||||
const YaComponent::GetRoutingInfoResponse& response) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
if (response.result.native() == Steinberg::kResultOk) {
|
||||
message << ", <RoutingInfo& for bus "
|
||||
<< response.updated_in_info.busIndex << " and channel "
|
||||
<< response.updated_in_info.channel
|
||||
<< ", <RoutingInfo& for bus "
|
||||
<< response.updated_out_info.busIndex << " and channel "
|
||||
<< response.updated_out_info.channel << ">";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPluginFactory::ConstructArgs& args) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -63,6 +63,7 @@ class Vst3Logger {
|
||||
void log_request(bool is_host_vst, const YaComponent::SetIoMode&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetBusCount&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetBusInfo&);
|
||||
void log_request(bool is_host_vst, const YaComponent::GetRoutingInfo&);
|
||||
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&);
|
||||
@@ -72,6 +73,8 @@ class Vst3Logger {
|
||||
bool is_host_vst,
|
||||
const std::variant<YaComponent::ConstructArgs, UniversalTResult>&);
|
||||
void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaComponent::GetRoutingInfoResponse&);
|
||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||
void log_response(bool is_host_vst, const Configuration&);
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
|
||||
YaComponent::SetIoMode,
|
||||
YaComponent::GetBusCount,
|
||||
YaComponent::GetBusInfo,
|
||||
YaComponent::GetRoutingInfo,
|
||||
YaPluginFactory::Construct,
|
||||
YaPluginFactory::SetHostContext>;
|
||||
|
||||
|
||||
@@ -260,6 +260,44 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::BusInfo& bus /*out*/) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and returned routing information for a call to
|
||||
* `IComponent::getRoutingInfo(inInfo, outInfo <out>)`.
|
||||
*/
|
||||
struct GetRoutingInfoResponse {
|
||||
UniversalTResult result;
|
||||
Steinberg::Vst::RoutingInfo updated_in_info;
|
||||
Steinberg::Vst::RoutingInfo updated_out_info;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(updated_in_info);
|
||||
s.object(updated_out_info);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponent::getRoutingInfo(inInfo,
|
||||
* outInfo <out>)` to the Wine plugin host.
|
||||
*/
|
||||
struct GetRoutingInfo {
|
||||
using Response = GetRoutingInfoResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
Steinberg::Vst::RoutingInfo in_info;
|
||||
Steinberg::Vst::RoutingInfo out_info;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(in_info);
|
||||
s.object(out_info);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
getRoutingInfo(Steinberg::Vst::RoutingInfo& inInfo,
|
||||
Steinberg::Vst::RoutingInfo& outInfo /*out*/) override = 0;
|
||||
@@ -297,5 +335,12 @@ void serialize(S& s, Steinberg::Vst::BusInfo& info) {
|
||||
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);
|
||||
}
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
|
||||
@@ -108,9 +108,14 @@ YaComponentPluginImpl::getBusInfo(Steinberg::Vst::MediaType type,
|
||||
tresult PLUGIN_API YaComponentPluginImpl::getRoutingInfo(
|
||||
Steinberg::Vst::RoutingInfo& inInfo,
|
||||
Steinberg::Vst::RoutingInfo& outInfo /*out*/) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO: IComponent::getRoutingInfo()");
|
||||
return Steinberg::kNotImplemented;
|
||||
const GetRoutingInfoResponse response = bridge.send_message(
|
||||
YaComponent::GetRoutingInfo{.instance_id = arguments.instance_id,
|
||||
.in_info = inInfo,
|
||||
.out_info = outInfo});
|
||||
|
||||
inInfo = response.updated_in_info;
|
||||
outInfo = response.updated_out_info;
|
||||
return response.result.native();
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
|
||||
@@ -130,6 +130,18 @@ void Vst3Bridge::run() {
|
||||
return YaComponent::GetBusInfoResponse{
|
||||
.result = result, .updated_bus = request.bus};
|
||||
},
|
||||
[&](YaComponent::GetRoutingInfo& request)
|
||||
-> YaComponent::GetRoutingInfo::Response {
|
||||
const tresult result =
|
||||
component_instances[request.instance_id]
|
||||
.component->getRoutingInfo(request.in_info,
|
||||
request.out_info);
|
||||
|
||||
return YaComponent::GetRoutingInfoResponse{
|
||||
.result = result,
|
||||
.updated_in_info = request.in_info,
|
||||
.updated_out_info = request.out_info};
|
||||
},
|
||||
[&](const YaPluginFactory::Construct&)
|
||||
-> YaPluginFactory::Construct::Response {
|
||||
return YaPluginFactory::ConstructArgs(
|
||||
|
||||
Reference in New Issue
Block a user