mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Implement IAudioProcessor::getBusArrangement()
This commit is contained in:
@@ -162,6 +162,15 @@ void Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
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 YaPluginFactory::Construct&) {
|
||||
log_request_base(is_host_vst,
|
||||
@@ -237,6 +246,17 @@ 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.native() == Steinberg::kResultOk) {
|
||||
message << ", <SpeakerArrangement>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPluginFactory::ConstructArgs& args) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -69,6 +69,7 @@ class Vst3Logger {
|
||||
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 YaPluginFactory::Construct&);
|
||||
void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&);
|
||||
void log_request(bool is_host_vst, const WantsConfiguration&);
|
||||
@@ -81,6 +82,8 @@ 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 YaPluginFactory::ConstructArgs&);
|
||||
void log_response(bool is_host_vst, const Configuration&);
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
|
||||
YaComponent::SetState,
|
||||
YaComponent::GetState,
|
||||
YaComponent::SetBusArrangements,
|
||||
YaComponent::GetBusArrangement,
|
||||
YaPluginFactory::Construct,
|
||||
YaPluginFactory::SetHostContext>;
|
||||
|
||||
|
||||
@@ -457,6 +457,45 @@ class YaComponent : public Steinberg::Vst::IComponent,
|
||||
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,
|
||||
|
||||
@@ -180,9 +180,15 @@ tresult PLUGIN_API YaComponentPluginImpl::getBusArrangement(
|
||||
Steinberg::Vst::BusDirection dir,
|
||||
int32 index,
|
||||
Steinberg::Vst::SpeakerArrangement& arr) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO: IAudioProcessor::getBusArrangement()");
|
||||
return Steinberg::kNotImplemented;
|
||||
const GetBusArrangementResponse response = bridge.send_message(
|
||||
YaComponent::GetBusArrangement{.instance_id = arguments.instance_id,
|
||||
.dir = dir,
|
||||
.index = index,
|
||||
.arr = arr});
|
||||
|
||||
arr = response.updated_arr;
|
||||
|
||||
return response.result.native();
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
|
||||
@@ -175,6 +175,16 @@ void Vst3Bridge::run() {
|
||||
request.inputs.data(), request.num_ins,
|
||||
request.outputs.data(), request.num_outs);
|
||||
},
|
||||
[&](YaComponent::GetBusArrangement& request)
|
||||
-> YaComponent::GetBusArrangement::Response {
|
||||
const tresult result =
|
||||
component_instances[request.instance_id]
|
||||
.audio_processor->getBusArrangement(
|
||||
request.dir, request.index, request.arr);
|
||||
|
||||
return YaComponent::GetBusArrangementResponse{
|
||||
.result = result, .updated_arr = request.arr};
|
||||
},
|
||||
[&](const YaPluginFactory::Construct&)
|
||||
-> YaPluginFactory::Construct::Response {
|
||||
return YaPluginFactory::ConstructArgs(
|
||||
|
||||
Reference in New Issue
Block a user