mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-12 15:22:14 +02:00
Implement IComponent::getState()
With this the basic IComponent interface is fully implemented. Next will be `IAudioProcessor` and `IConnectionPoint` as additions to IComponent. We'll use the same `known_iids` mechanism as used in the plugin factory.
This commit is contained in:
@@ -17,11 +17,13 @@ imcomplete list of things that still have to be done before this can be used:
|
|||||||
|
|
||||||
- Left to implement:
|
- Left to implement:
|
||||||
- `YaHostApplicationHostImpl::createComponent`.
|
- `YaHostApplicationHostImpl::createComponent`.
|
||||||
- The rest of `IComponent`'s functions
|
- `IAudioProcessor` and `IConnectionPoint` to supplement `IComponent`
|
||||||
|
- `IEditController{,2}`
|
||||||
- All other mandatory interfaces
|
- All other mandatory interfaces
|
||||||
- All other optional interfaces
|
- All other optional interfaces
|
||||||
- Fully implemented:
|
- Fully implemented:
|
||||||
- `GetPluginFactory()` and `IPluginFactory{,2,3}`
|
- `GetPluginFactory()` and `IPluginFactory{,2,3}`
|
||||||
|
- `IComponent`
|
||||||
- Update the GitHub Actions workflows.
|
- Update the GitHub Actions workflows.
|
||||||
- Update yabridgectl to handle buth VST2 and VST3 plugins.
|
- Update yabridgectl to handle buth VST2 and VST3 plugins.
|
||||||
- Update all documentation to refer to VST2 and VST3 support separately, and
|
- Update all documentation to refer to VST2 and VST3 support separately, and
|
||||||
|
|||||||
@@ -142,6 +142,14 @@ void Vst3Logger::log_request(bool is_host_vst,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_request(bool is_host_vst,
|
||||||
|
const YaComponent::GetState& request) {
|
||||||
|
log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << "<IComponent* #" << request.instance_id
|
||||||
|
<< ">::getState(state = <IBStream*>)";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
@@ -206,6 +214,17 @@ void Vst3Logger::log_response(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
|
const YaComponent::GetStateResponse& response) {
|
||||||
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << response.result.string();
|
||||||
|
if (response.result.native() == Steinberg::kResultOk) {
|
||||||
|
message << ", <IBStream* containing "
|
||||||
|
<< response.updated_state.size() << " bytes>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class Vst3Logger {
|
|||||||
void log_request(bool is_host_vst, const YaComponent::ActivateBus&);
|
void log_request(bool is_host_vst, const YaComponent::ActivateBus&);
|
||||||
void log_request(bool is_host_vst, const YaComponent::SetActive&);
|
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::SetState&);
|
||||||
|
void log_request(bool is_host_vst, const YaComponent::GetState&);
|
||||||
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&);
|
||||||
@@ -78,6 +79,7 @@ class Vst3Logger {
|
|||||||
void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&);
|
void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&);
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaComponent::GetRoutingInfoResponse&);
|
const YaComponent::GetRoutingInfoResponse&);
|
||||||
|
void log_response(bool is_host_vst, const YaComponent::GetStateResponse&);
|
||||||
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&);
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ using ControlRequest = std::variant<YaComponent::Construct,
|
|||||||
YaComponent::ActivateBus,
|
YaComponent::ActivateBus,
|
||||||
YaComponent::SetActive,
|
YaComponent::SetActive,
|
||||||
YaComponent::SetState,
|
YaComponent::SetState,
|
||||||
|
YaComponent::GetState,
|
||||||
YaPluginFactory::Construct,
|
YaPluginFactory::Construct,
|
||||||
YaPluginFactory::SetHostContext>;
|
YaPluginFactory::SetHostContext>;
|
||||||
|
|
||||||
|
|||||||
@@ -175,15 +175,15 @@ tresult PLUGIN_API VectorStream::queryInterface(Steinberg::FIDString _iid,
|
|||||||
return Steinberg::kNoInterface;
|
return Steinberg::kNoInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult VectorStream::write_back(Steinberg::IBStream* stream) {
|
tresult VectorStream::write_back(Steinberg::IBStream* stream) const {
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
return Steinberg::kInvalidArgument;
|
return Steinberg::kInvalidArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 num_bytes_written;
|
int32 num_bytes_written;
|
||||||
assert(stream->seek(0, kIBSeekSet) == Steinberg::kResultOk);
|
assert(stream->seek(0, kIBSeekSet) == Steinberg::kResultOk);
|
||||||
assert(stream->write(buffer.data(), buffer.size(), &num_bytes_written) ==
|
assert(stream->write(const_cast<uint8_t*>(buffer.data()), buffer.size(),
|
||||||
Steinberg::kResultOk);
|
&num_bytes_written) == Steinberg::kResultOk);
|
||||||
|
|
||||||
assert(num_bytes_written == 0 ||
|
assert(num_bytes_written == 0 ||
|
||||||
static_cast<size_t>(num_bytes_written) == buffer.size());
|
static_cast<size_t>(num_bytes_written) == buffer.size());
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class VectorStream : public Steinberg::IBStream,
|
|||||||
* Write the vector buffer back to an IBStream. After writing the seek
|
* Write the vector buffer back to an IBStream. After writing the seek
|
||||||
* position will be left at the end of the stream.
|
* position will be left at the end of the stream.
|
||||||
*/
|
*/
|
||||||
tresult write_back(Steinberg::IBStream* stream);
|
tresult write_back(Steinberg::IBStream* stream) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the buffer's, used in the logging messages.
|
* Return the buffer's, used in the logging messages.
|
||||||
|
|||||||
@@ -371,6 +371,37 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
|||||||
|
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
setState(Steinberg::IBStream* state) override = 0;
|
setState(Steinberg::IBStream* state) override = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The response code and written state for a call to
|
||||||
|
* `IComponent::getState(state)`.
|
||||||
|
*/
|
||||||
|
struct GetStateResponse {
|
||||||
|
UniversalTResult result;
|
||||||
|
VectorStream updated_state;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.object(result);
|
||||||
|
s.object(updated_state);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to `IComponent::getState(state)` to the
|
||||||
|
* Wine plugin host.
|
||||||
|
*/
|
||||||
|
struct GetState {
|
||||||
|
using Response = GetStateResponse;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
getState(Steinberg::IBStream* state) override = 0;
|
getState(Steinberg::IBStream* state) override = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,10 @@ tresult PLUGIN_API YaComponentPluginImpl::setState(Steinberg::IBStream* state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API YaComponentPluginImpl::getState(Steinberg::IBStream* state) {
|
tresult PLUGIN_API YaComponentPluginImpl::getState(Steinberg::IBStream* state) {
|
||||||
// TODO: Implement
|
const GetStateResponse response = bridge.send_message(
|
||||||
bridge.logger.log("TODO: IComponent::getState()");
|
YaComponent::GetState{.instance_id = arguments.instance_id});
|
||||||
return Steinberg::kNotImplemented;
|
|
||||||
|
assert(response.updated_state.write_back(state) == Steinberg::kResultOk);
|
||||||
|
|
||||||
|
return response.result.native();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,15 @@ void Vst3Bridge::run() {
|
|||||||
return component_instances[request.instance_id]
|
return component_instances[request.instance_id]
|
||||||
.component->setState(&request.state);
|
.component->setState(&request.state);
|
||||||
},
|
},
|
||||||
|
[&](YaComponent::GetState& request)
|
||||||
|
-> YaComponent::GetState::Response {
|
||||||
|
VectorStream stream;
|
||||||
|
const tresult result = component_instances[request.instance_id]
|
||||||
|
.component->getState(&stream);
|
||||||
|
|
||||||
|
return YaComponent::GetStateResponse{
|
||||||
|
.result = result, .updated_state = std::move(stream)};
|
||||||
|
},
|
||||||
[&](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