mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 21:50:11 +02:00
Implement IComponent::GetBusInfo()
This commit is contained in:
@@ -88,6 +88,15 @@ void Vst3Logger::log_request(bool is_host_vst,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_request(bool is_host_vst,
|
||||||
|
const YaComponent::GetBusInfo& request) {
|
||||||
|
log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << "<IComponent* #" << request.instance_id << ">::getBusInfo("
|
||||||
|
<< request.type << ", " << request.dir << ", " << request.index
|
||||||
|
<< ", &bus)";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
@@ -126,6 +135,16 @@ void Vst3Logger::log_response(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
|
const YaComponent::GetBusInfoResponse& response) {
|
||||||
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << response.result.string();
|
||||||
|
if (response.result.native() == Steinberg::kResultOk) {
|
||||||
|
message << ", <BusInfo>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Vst3Logger::log_response(bool is_host_vst,
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
const YaPluginFactory::ConstructArgs& args) {
|
const YaPluginFactory::ConstructArgs& args) {
|
||||||
log_response_base(is_host_vst, [&](auto& message) {
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class Vst3Logger {
|
|||||||
void log_request(bool is_host_vst, const YaComponent::Terminate&);
|
void log_request(bool is_host_vst, const YaComponent::Terminate&);
|
||||||
void log_request(bool is_host_vst, const YaComponent::SetIoMode&);
|
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::GetBusCount&);
|
||||||
|
void log_request(bool is_host_vst, const YaComponent::GetBusInfo&);
|
||||||
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&);
|
||||||
@@ -70,6 +71,7 @@ class Vst3Logger {
|
|||||||
void log_response(
|
void log_response(
|
||||||
bool is_host_vst,
|
bool is_host_vst,
|
||||||
const std::variant<YaComponent::ConstructArgs, UniversalTResult>&);
|
const std::variant<YaComponent::ConstructArgs, UniversalTResult>&);
|
||||||
|
void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&);
|
||||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||||
void log_response(bool is_host_vst, const Configuration&);
|
void log_response(bool is_host_vst, const Configuration&);
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
|
|||||||
YaComponent::Terminate,
|
YaComponent::Terminate,
|
||||||
YaComponent::SetIoMode,
|
YaComponent::SetIoMode,
|
||||||
YaComponent::GetBusCount,
|
YaComponent::GetBusCount,
|
||||||
|
YaComponent::GetBusInfo,
|
||||||
YaPluginFactory::Construct,
|
YaPluginFactory::Construct,
|
||||||
YaPluginFactory::SetHostContext>;
|
YaPluginFactory::SetHostContext>;
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,45 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
|||||||
virtual int32 PLUGIN_API
|
virtual int32 PLUGIN_API
|
||||||
getBusCount(Steinberg::Vst::MediaType type,
|
getBusCount(Steinberg::Vst::MediaType type,
|
||||||
Steinberg::Vst::BusDirection dir) override = 0;
|
Steinberg::Vst::BusDirection dir) override = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The response code and returned bus information for a call to
|
||||||
|
* `IComponent::getBusInfo(type, dir, index, bus <out>)`.
|
||||||
|
*/
|
||||||
|
struct GetBusInfoResponse {
|
||||||
|
UniversalTResult result;
|
||||||
|
Steinberg::Vst::BusInfo updated_bus;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.object(result);
|
||||||
|
s.object(updated_bus);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to `IComponent::getBusInfo(type, dir,
|
||||||
|
* index, bus <out>)` to the Wine plugin host.
|
||||||
|
*/
|
||||||
|
struct GetBusInfo {
|
||||||
|
using Response = GetBusInfoResponse;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
|
||||||
|
Steinberg::Vst::BusType type;
|
||||||
|
Steinberg::Vst::BusDirection dir;
|
||||||
|
int32 index;
|
||||||
|
Steinberg::Vst::BusInfo bus;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
s.value4b(type);
|
||||||
|
s.value4b(dir);
|
||||||
|
s.object(bus);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
getBusInfo(Steinberg::Vst::MediaType type,
|
getBusInfo(Steinberg::Vst::MediaType type,
|
||||||
Steinberg::Vst::BusDirection dir,
|
Steinberg::Vst::BusDirection dir,
|
||||||
@@ -246,3 +285,17 @@ void serialize(
|
|||||||
std::variant<YaComponent::ConstructArgs, UniversalTResult>& result) {
|
std::variant<YaComponent::ConstructArgs, UniversalTResult>& result) {
|
||||||
s.ext(result, bitsery::ext::StdVariant{});
|
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);
|
||||||
|
}
|
||||||
|
} // namespace Vst
|
||||||
|
} // namespace Steinberg
|
||||||
|
|||||||
@@ -94,8 +94,15 @@ YaComponentPluginImpl::getBusInfo(Steinberg::Vst::MediaType type,
|
|||||||
Steinberg::Vst::BusDirection dir,
|
Steinberg::Vst::BusDirection dir,
|
||||||
int32 index,
|
int32 index,
|
||||||
Steinberg::Vst::BusInfo& bus /*out*/) {
|
Steinberg::Vst::BusInfo& bus /*out*/) {
|
||||||
// TODO: Implement
|
const GetBusInfoResponse response = bridge.send_message(
|
||||||
return Steinberg::kNotImplemented;
|
YaComponent::GetBusInfo{.instance_id = arguments.instance_id,
|
||||||
|
.type = type,
|
||||||
|
.dir = dir,
|
||||||
|
.index = index,
|
||||||
|
.bus = bus});
|
||||||
|
|
||||||
|
bus = response.updated_bus;
|
||||||
|
return response.result.native();
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API YaComponentPluginImpl::getRoutingInfo(
|
tresult PLUGIN_API YaComponentPluginImpl::getRoutingInfo(
|
||||||
|
|||||||
@@ -117,6 +117,15 @@ void Vst3Bridge::run() {
|
|||||||
return component_instances[request.instance_id]->getBusCount(
|
return component_instances[request.instance_id]->getBusCount(
|
||||||
request.type, request.dir);
|
request.type, request.dir);
|
||||||
},
|
},
|
||||||
|
[&](YaComponent::GetBusInfo& request)
|
||||||
|
-> YaComponent::GetBusInfo::Response {
|
||||||
|
const tresult result =
|
||||||
|
component_instances[request.instance_id]->getBusInfo(
|
||||||
|
request.type, request.dir, request.index, request.bus);
|
||||||
|
|
||||||
|
return YaComponent::GetBusInfoResponse{
|
||||||
|
.result = result, .updated_bus = request.bus};
|
||||||
|
},
|
||||||
[&](const YaPluginFactory::Construct&)
|
[&](const YaPluginFactory::Construct&)
|
||||||
-> YaPluginFactory::Construct::Response {
|
-> YaPluginFactory::Construct::Response {
|
||||||
return YaPluginFactory::ConstructArgs(
|
return YaPluginFactory::ConstructArgs(
|
||||||
|
|||||||
Reference in New Issue
Block a user