Implement IComponentHandler::performEdit()

This commit is contained in:
Robbert van der Helm
2020-12-19 15:45:24 +01:00
parent 3b06bca95e
commit bb99a539d5
6 changed files with 46 additions and 6 deletions
+10 -1
View File
@@ -450,7 +450,16 @@ bool Vst3Logger::log_request(bool is_host_vst,
const YaComponentHandler::BeginEdit& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.owner_instance_id
<< ": IComponentHandler::beginEdit(" << request.id << ")";
<< ": IComponentHandler::beginEdit(id = " << request.id << ")";
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaComponentHandler::PerformEdit& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.owner_instance_id
<< ": IComponentHandler::performEdit(id = " << request.id
<< ", valueNormalized = " << request.value_normalized << ")";
});
}
+1
View File
@@ -111,6 +111,7 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const WantsConfiguration&);
bool log_request(bool is_host_vst, const YaComponentHandler::BeginEdit&);
bool log_request(bool is_host_vst, const YaComponentHandler::PerformEdit&);
void log_response(bool is_host_vst, const Ack&);
void log_response(
+3 -2
View File
@@ -105,8 +105,9 @@ void serialize(S& s, ControlRequest& payload) {
* information we want or the operation we want to perform. A request of type
* `CallbackRequest(T)` should send back a `T::Response`.
*/
using CallbackRequest =
std::variant<WantsConfiguration, YaComponentHandler::BeginEdit>;
using CallbackRequest = std::variant<WantsConfiguration,
YaComponentHandler::BeginEdit,
YaComponentHandler::PerformEdit>;
template <typename S>
void serialize(S& s, CallbackRequest& payload) {
@@ -81,6 +81,27 @@ class YaComponentHandler : public Steinberg::Vst::IComponentHandler {
virtual tresult PLUGIN_API
beginEdit(Steinberg::Vst::ParamID id) override = 0;
/**
* Message to pass through a call to `IComponentHandler::performEdit(id,
* value_normalized)` to the component handler provided by the host.
*/
struct PerformEdit {
using Response = UniversalTResult;
native_size_t owner_instance_id;
Steinberg::Vst::ParamID id;
Steinberg::Vst::ParamValue value_normalized;
template <typename S>
void serialize(S& s) {
s.value8b(owner_instance_id);
s.value4b(id);
s.value8b(value_normalized);
}
};
virtual tresult PLUGIN_API
performEdit(Steinberg::Vst::ParamID id,
Steinberg::Vst::ParamValue valueNormalized) override = 0;
+7
View File
@@ -89,6 +89,13 @@ Vst3PluginBridge::Vst3PluginBridge()
.get()
.component_handler->beginEdit(request.id);
},
[&](const YaComponentHandler::PerformEdit& request)
-> YaComponentHandler::PerformEdit::Response {
return plugin_proxies.at(request.owner_instance_id)
.get()
.component_handler->performEdit(
request.id, request.value_normalized);
},
});
});
}
@@ -48,9 +48,10 @@ Vst3ComponentHandlerProxyImpl::beginEdit(Steinberg::Vst::ParamID id) {
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::performEdit(
Steinberg::Vst::ParamID id,
Steinberg::Vst::ParamValue valueNormalized) {
// TODO: Implement
std::cerr << "TODO: IComponentHandler::performEdit()" << std::endl;
return Steinberg::kNotImplemented;
return bridge.send_message(YaComponentHandler::PerformEdit{
.owner_instance_id = owner_instance_id(),
.id = id,
.value_normalized = valueNormalized});
}
tresult PLUGIN_API