mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-19 18:03:56 +02:00
Clean up YaHostApplication
This commit is contained in:
@@ -20,8 +20,8 @@ YaHostApplication::ConstructArgs::ConstructArgs() {}
|
|||||||
|
|
||||||
YaHostApplication::ConstructArgs::ConstructArgs(
|
YaHostApplication::ConstructArgs::ConstructArgs(
|
||||||
Steinberg::IPtr<Steinberg::Vst::IHostApplication> context,
|
Steinberg::IPtr<Steinberg::Vst::IHostApplication> context,
|
||||||
std::optional<size_t> component_instance_id)
|
std::optional<size_t> owner_instance_id)
|
||||||
: component_instance_id(component_instance_id) {
|
: owner_instance_id(owner_instance_id) {
|
||||||
Steinberg::Vst::String128 name_array;
|
Steinberg::Vst::String128 name_array;
|
||||||
if (context->getName(name_array) == Steinberg::kResultOk) {
|
if (context->getName(name_array) == Steinberg::kResultOk) {
|
||||||
name = tchar_pointer_to_u16string(name_array);
|
name = tchar_pointer_to_u16string(name_array);
|
||||||
|
|||||||
@@ -29,14 +29,12 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps around `IHostApplication` for serialization purposes. See `README.md`
|
* Wraps around `IHostApplication` for serialization purposes. An instance of
|
||||||
* for more information on how this works. This is used both to proxy the host
|
* this proxy object will be initialized on the Wine plugin host side after the
|
||||||
* application context passed during `IPluginBase::intialize()` as well as for
|
* host passes an actual instance to the plugin, and all function calls made to
|
||||||
* `IPluginFactory3::setHostContext()`. This interface is thus implemented on
|
* this proxy will be passed through to the actual object. This is used to proxy
|
||||||
* both the native plugin side as well as the Wine plugin host side.
|
* both the host application context passed during `IPluginBase::intialize()` as
|
||||||
*
|
* well as for the 'global' context in `IPluginFactory3::setHostContext()`.
|
||||||
* TODO: When implementing more host interfaces, also rework this into a
|
|
||||||
* monolithic proxy class like with the plugin.
|
|
||||||
*/
|
*/
|
||||||
class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
||||||
public:
|
public:
|
||||||
@@ -50,15 +48,14 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
|||||||
* Read arguments from an existing implementation.
|
* Read arguments from an existing implementation.
|
||||||
*/
|
*/
|
||||||
ConstructArgs(Steinberg::IPtr<Steinberg::Vst::IHostApplication> context,
|
ConstructArgs(Steinberg::IPtr<Steinberg::Vst::IHostApplication> context,
|
||||||
std::optional<size_t> component_instance_id);
|
std::optional<size_t> owner_instance_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique instance identifier of the component this host context has
|
* The unique instance identifier of the proxy object instance this host
|
||||||
* been passed to and thus belongs to, if we are handling
|
* context has been passed to and thus belongs to. If we are handling
|
||||||
* `IpluginBase::initialize()`. When handling
|
* When handling `IPluginFactory::setHostContext()` this will be empty.
|
||||||
* `IPluginFactory::setHostContext()` this will be empty.
|
|
||||||
*/
|
*/
|
||||||
std::optional<native_size_t> component_instance_id;
|
std::optional<native_size_t> owner_instance_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For `IHostApplication::getName`.
|
* For `IHostApplication::getName`.
|
||||||
@@ -67,7 +64,7 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
|||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.ext(component_instance_id, bitsery::ext::StdOptional{},
|
s.ext(owner_instance_id, bitsery::ext::StdOptional{},
|
||||||
[](S& s, native_size_t& instance_id) {
|
[](S& s, native_size_t& instance_id) {
|
||||||
s.value8b(instance_id);
|
s.value8b(instance_id);
|
||||||
});
|
});
|
||||||
@@ -87,8 +84,6 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
|||||||
* `Destruct` messages. This object's lifetime is bound to that of the
|
* `Destruct` messages. This object's lifetime is bound to that of the
|
||||||
* objects they are passed to. If those objects get dropped, then the host
|
* objects they are passed to. If those objects get dropped, then the host
|
||||||
* contexts should also be dropped.
|
* contexts should also be dropped.
|
||||||
*
|
|
||||||
* TODO: Check if this ends up working out this way
|
|
||||||
*/
|
*/
|
||||||
YaHostApplication(const ConstructArgs&& args);
|
YaHostApplication(const ConstructArgs&& args);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
class YaHostApplicationImpl : public YaHostApplication {
|
class YaHostApplicationImpl : public YaHostApplication {
|
||||||
public:
|
public:
|
||||||
YaHostApplicationImpl(Vst3Bridge& bridge,
|
YaHostApplicationImpl(Vst3Bridge& bridge,
|
||||||
YaHostApplication::ConstructArgs&& args);
|
YaHostApplication::ConstructArgs&& args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We'll override the query interface to log queries for interfaces we do
|
* We'll override the query interface to log queries for interfaces we do
|
||||||
|
|||||||
Reference in New Issue
Block a user