Create Vst3HostContextProxy from YaHostApplication

This is quite a huge refactor, but note everything is consistent (and
we're going to need one or two more of these `Vst3*Proxy` objects).
Right now nothing extends `IHostApplication`, but this way it will be
trivial to add support for more host context interfaces.
This commit is contained in:
Robbert van der Helm
2020-12-19 17:13:17 +01:00
parent c94089b832
commit 0522f84f4a
21 changed files with 301 additions and 184 deletions
@@ -14,24 +14,25 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "host-application.h"
#include "host-context-proxy.h"
#include <iostream>
YaHostApplicationImpl::YaHostApplicationImpl(
Vst3HostContextProxyImpl::Vst3HostContextProxyImpl(
Vst3Bridge& bridge,
YaHostApplication::ConstructArgs&& args)
: YaHostApplication(std::move(args)), bridge(bridge) {
Vst3HostContextProxy::ConstructArgs&& args)
: Vst3HostContextProxy(std::move(args)), bridge(bridge) {
// The lifecycle is thos object is managed together with that of the plugin
// object instance this belongs to
// object instance instance this belongs to
}
tresult PLUGIN_API
YaHostApplicationImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
Vst3HostContextProxyImpl::queryInterface(const Steinberg::TUID _iid,
void** obj) {
// I don't think it's expected of a host to implement multiple interfaces on
// this object, so if we do get a call here it's important that it's logged
// TODO: Successful queries should also be logged
const tresult result = YaHostApplication::queryInterface(_iid, obj);
const tresult result = Vst3HostContextProxy::queryInterface(_iid, obj);
if (result != Steinberg::kResultOk) {
std::cerr << "TODO: Implement unknown interface logging on Wine side"
<< std::endl;
@@ -40,9 +41,10 @@ YaHostApplicationImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
return result;
}
tresult PLUGIN_API YaHostApplicationImpl::createInstance(Steinberg::TUID cid,
Steinberg::TUID _iid,
void** obj) {
tresult PLUGIN_API
Vst3HostContextProxyImpl::createInstance(Steinberg::TUID cid,
Steinberg::TUID _iid,
void** obj) {
// TODO: Implement
std::cerr << "TODO: IHostApplication::createInstance()" << std::endl;
return Steinberg::kNotImplemented;
@@ -18,10 +18,10 @@
#include "../vst3.h"
class YaHostApplicationImpl : public YaHostApplication {
class Vst3HostContextProxyImpl : public Vst3HostContextProxy {
public:
YaHostApplicationImpl(Vst3Bridge& bridge,
YaHostApplication::ConstructArgs&& args);
Vst3HostContextProxyImpl(Vst3Bridge& bridge,
Vst3HostContextProxy::ConstructArgs&& args);
/**
* We'll override the query interface to log queries for interfaces we do
@@ -30,6 +30,7 @@ class YaHostApplicationImpl : public YaHostApplication {
tresult PLUGIN_API queryInterface(const Steinberg::TUID _iid,
void** obj) override;
// From `IHostApplication`
tresult PLUGIN_API createInstance(Steinberg::TUID cid,
Steinberg::TUID _iid,
void** obj) override;