diff --git a/src/plugin/bridges/clap-impls/plugin-proxy.cpp b/src/plugin/bridges/clap-impls/plugin-proxy.cpp
new file mode 100644
index 00000000..72a6931b
--- /dev/null
+++ b/src/plugin/bridges/clap-impls/plugin-proxy.cpp
@@ -0,0 +1,133 @@
+// yabridge: a Wine plugin bridge
+// Copyright (C) 2020-2022 Robbert van der Helm
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#include "plugin-proxy.h"
+
+#include "../clap.h"
+
+clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
+ size_t instance_id,
+ clap::plugin::Descriptor descriptor)
+ : bridge_(bridge),
+ instance_id_(instance_id),
+ descriptor_(std::move(descriptor)),
+ plugin_vtable_(clap_plugin_t{
+ .desc = descriptor_.get(),
+ .plugin_data = this,
+ .init = plugin_init,
+ .destroy = plugin_destroy,
+ .activate = plugin_activate,
+ .deactivate = plugin_deactivate,
+ .start_processing = plugin_start_processing,
+ .stop_processing = plugin_stop_processing,
+ .reset = plugin_reset,
+ .process = plugin_process,
+ .get_extension = plugin_get_extension,
+ .on_main_thread = plugin_on_main_thread,
+ }) {}
+
+bool CLAP_ABI clap_plugin_proxy::plugin_init(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+ return false;
+}
+
+void CLAP_ABI
+clap_plugin_proxy::plugin_destroy(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Destroy on the Wine side
+
+ // This deallocates and destroys `self`
+ self->bridge_.unregister_plugin_proxy(self->instance_id());
+}
+
+bool CLAP_ABI clap_plugin_proxy::plugin_activate(
+ const struct clap_plugin* plugin,
+ // NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
+ double sample_rate,
+ uint32_t min_frames_count,
+ uint32_t max_frames_count) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+ return false;
+}
+
+void CLAP_ABI
+clap_plugin_proxy::plugin_deactivate(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+}
+
+bool CLAP_ABI
+clap_plugin_proxy::plugin_start_processing(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+ return false;
+}
+
+void CLAP_ABI
+clap_plugin_proxy::plugin_stop_processing(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+}
+
+void CLAP_ABI
+clap_plugin_proxy::plugin_reset(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+}
+
+clap_process_status CLAP_ABI
+clap_plugin_proxy::plugin_process(const struct clap_plugin* plugin,
+ const clap_process_t* process) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+ return CLAP_PROCESS_ERROR;
+}
+
+const void* CLAP_ABI
+clap_plugin_proxy::plugin_get_extension(const struct clap_plugin* plugin,
+ const char* id) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Implement
+ return nullptr;
+}
+
+void CLAP_ABI
+clap_plugin_proxy::plugin_on_main_thread(const struct clap_plugin* plugin) {
+ assert(plugin && plugin->plugin_data);
+ auto self = static_cast(plugin->plugin_data);
+
+ // TODO: Use this for spooling main thread callbacks
+}
diff --git a/src/plugin/bridges/clap-impls/plugin-proxy.h b/src/plugin/bridges/clap-impls/plugin-proxy.h
new file mode 100644
index 00000000..6ed68857
--- /dev/null
+++ b/src/plugin/bridges/clap-impls/plugin-proxy.h
@@ -0,0 +1,91 @@
+// yabridge: a Wine plugin bridge
+// Copyright (C) 2020-2022 Robbert van der Helm
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#pragma once
+
+#include
+
+#include
+
+#include "../../common/serialization/clap/plugin.h"
+
+// Forward declaration to avoid circular includes
+class ClapPluginBridge;
+
+/**
+ * A proxy for a `clap_plugin`.
+ */
+class clap_plugin_proxy {
+ public:
+ /**
+ * Construct a proxy for a plugin that has already been created on the Wine
+ * side. This is done in our `clap_plugin_factory::create()` implementation.
+ * The instance ID lets us link calls the host makes on a plugin object to a
+ * Windows CLAP plugin running under the Wine plugin host.
+ */
+ clap_plugin_proxy(ClapPluginBridge& bridge,
+ size_t instance_id,
+ clap::plugin::Descriptor descriptor);
+
+ clap_plugin_proxy(const clap_plugin_proxy&) = delete;
+ clap_plugin_proxy& operator=(const clap_plugin_proxy&) = delete;
+ clap_plugin_proxy(clap_plugin_proxy&&) = delete;
+ clap_plugin_proxy& operator=(clap_plugin_proxy&&) = delete;
+
+ /**
+ * Get a `clap_plugin` vtable that can be passed to the host when creating a
+ * plugin instance.
+ */
+ inline const clap_plugin_t* plugin_vtable() const {
+ return &plugin_vtable_;
+ }
+ /**
+ * The instance ID of the plugin instance this proxy belongs to.
+ */
+ inline size_t instance_id() const { return instance_id_; }
+
+ static bool CLAP_ABI plugin_init(const struct clap_plugin* plugin);
+ static void CLAP_ABI plugin_destroy(const struct clap_plugin* plugin);
+ static bool CLAP_ABI plugin_activate(const struct clap_plugin* plugin,
+ double sample_rate,
+ uint32_t min_frames_count,
+ uint32_t max_frames_count);
+ static void CLAP_ABI plugin_deactivate(const struct clap_plugin* plugin);
+ static bool CLAP_ABI
+ plugin_start_processing(const struct clap_plugin* plugin);
+ static void CLAP_ABI
+ plugin_stop_processing(const struct clap_plugin* plugin);
+ static void CLAP_ABI plugin_reset(const struct clap_plugin* plugin);
+ static clap_process_status CLAP_ABI
+ plugin_process(const struct clap_plugin* plugin,
+ const clap_process_t* process);
+ static const void* CLAP_ABI
+ plugin_get_extension(const struct clap_plugin* plugin, const char* id);
+ static void CLAP_ABI
+ plugin_on_main_thread(const struct clap_plugin* plugin);
+
+ private:
+ ClapPluginBridge& bridge_;
+ size_t instance_id_;
+ clap::plugin::Descriptor descriptor_;
+
+ /**
+ * The vtable for `clap_plugin`, requires that this object is never moved or
+ * copied. We'll use the host data pointer instead of placing this vtable at
+ * the start of the struct and directly casting the `clap_plugin_t*`.
+ */
+ const clap_plugin_t plugin_vtable_;
+};