mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Move the editor handling back to Vst2Bridge
Since we can have multiple editors in Vst3Bridge.
This commit is contained in:
@@ -18,24 +18,3 @@
|
|||||||
|
|
||||||
HostBridge::HostBridge(boost::filesystem::path plugin_path)
|
HostBridge::HostBridge(boost::filesystem::path plugin_path)
|
||||||
: plugin_path(plugin_path) {}
|
: plugin_path(plugin_path) {}
|
||||||
|
|
||||||
void HostBridge::handle_win32_events() {
|
|
||||||
if (editor) {
|
|
||||||
editor->handle_win32_events();
|
|
||||||
} else {
|
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
for (int i = 0; i < max_win32_messages &&
|
|
||||||
PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
|
|
||||||
i++) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HostBridge::handle_x11_events() {
|
|
||||||
if (editor) {
|
|
||||||
editor->handle_x11_events();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../editor.h"
|
#include "../boost-fix.h"
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base for the Wine plugin host bridge interface for all plugin types. This
|
* The base for the Wine plugin host bridge interface for all plugin types. This
|
||||||
@@ -47,7 +49,7 @@ class HostBridge {
|
|||||||
* Handle X11 events for the editor window if it is open. This can safely be
|
* Handle X11 events for the editor window if it is open. This can safely be
|
||||||
* run from any thread.
|
* run from any thread.
|
||||||
*/
|
*/
|
||||||
void handle_x11_events();
|
virtual void handle_x11_events() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the message loop for this plugin. This is only used for the
|
* Run the message loop for this plugin. This is only used for the
|
||||||
@@ -63,25 +65,12 @@ class HostBridge {
|
|||||||
* we have to make sure to always run this loop. The only exception is a in
|
* we have to make sure to always run this loop. The only exception is a in
|
||||||
* specific situation that can cause a race condition in some plugins
|
* specific situation that can cause a race condition in some plugins
|
||||||
* because of incorrect assumptions made by the plugin. See the dostring for
|
* because of incorrect assumptions made by the plugin. See the dostring for
|
||||||
* `HostBridge::editor` for more information.
|
* `Vst2Bridge::editor` for more information.
|
||||||
*/
|
*/
|
||||||
void handle_win32_events();
|
virtual void handle_win32_events() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path to the .dll being loaded in the Wine plugin host.
|
* The path to the .dll being loaded in the Wine plugin host.
|
||||||
*/
|
*/
|
||||||
const boost::filesystem::path plugin_path;
|
const boost::filesystem::path plugin_path;
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* The plugin editor window. Allows embedding the plugin's editor into a
|
|
||||||
* Wine window, and embedding that Wine window into a window provided by the
|
|
||||||
* host. Should be empty when the editor is not open.
|
|
||||||
*
|
|
||||||
* TODO: This should be moved back to `Vst2Bridge`, `handle_x11_events()``
|
|
||||||
* and `handle_win32_events()` should be made pure virtual. A single
|
|
||||||
* `Vst3Bridge` instance will handle multiple plugin instances because
|
|
||||||
* of the way VST3 works.
|
|
||||||
*/
|
|
||||||
std::optional<Editor> editor;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "../common/logging/common.h"
|
#include "../common/logging/common.h"
|
||||||
|
#include "../utils.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -350,6 +350,27 @@ void Vst2Bridge::run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst2Bridge::handle_x11_events() {
|
||||||
|
if (editor) {
|
||||||
|
editor->handle_x11_events();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vst2Bridge::handle_win32_events() {
|
||||||
|
if (editor) {
|
||||||
|
editor->handle_win32_events();
|
||||||
|
} else {
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
for (int i = 0; i < max_win32_messages &&
|
||||||
|
PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
|
||||||
|
i++) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
intptr_t Vst2Bridge::dispatch_wrapper(AEffect* plugin,
|
intptr_t Vst2Bridge::dispatch_wrapper(AEffect* plugin,
|
||||||
int opcode,
|
int opcode,
|
||||||
int index,
|
int index,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "../../common/communication/vst2.h"
|
#include "../../common/communication/vst2.h"
|
||||||
#include "../../common/configuration.h"
|
#include "../../common/configuration.h"
|
||||||
|
#include "../editor.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
@@ -66,6 +67,9 @@ class Vst2Bridge : public HostBridge {
|
|||||||
*/
|
*/
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
|
void handle_x11_events() override;
|
||||||
|
void handle_win32_events() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forward the host callback made by the plugin to the host and return the
|
* Forward the host callback made by the plugin to the host and return the
|
||||||
* results.
|
* results.
|
||||||
@@ -144,6 +148,13 @@ class Vst2Bridge : public HostBridge {
|
|||||||
*/
|
*/
|
||||||
Vst2Sockets<Win32Thread> sockets;
|
Vst2Sockets<Win32Thread> sockets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin editor window. Allows embedding the plugin's editor into a
|
||||||
|
* Wine window, and embedding that Wine window into a window provided by the
|
||||||
|
* host. Should be empty when the editor is not open.
|
||||||
|
*/
|
||||||
|
std::optional<Editor> editor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MIDI events that have been received **and processed** since the last
|
* The MIDI events that have been received **and processed** since the last
|
||||||
* call to `processReplacing()`. 99% of plugins make a copy of the MIDI
|
* call to `processReplacing()`. 99% of plugins make a copy of the MIDI
|
||||||
|
|||||||
@@ -423,6 +423,23 @@ void Vst3Bridge::run() {
|
|||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Bridge::handle_x11_events() {
|
||||||
|
// TODO: Implement editors
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vst3Bridge::handle_win32_events() {
|
||||||
|
// TODO: Implement editors
|
||||||
|
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
for (int i = 0;
|
||||||
|
i < max_win32_messages && PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
|
||||||
|
i++) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t Vst3Bridge::generate_instance_id() {
|
size_t Vst3Bridge::generate_instance_id() {
|
||||||
return current_instance_id.fetch_add(1);
|
return current_instance_id.fetch_add(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "../../common/communication/vst3.h"
|
#include "../../common/communication/vst3.h"
|
||||||
#include "../../common/configuration.h"
|
#include "../../common/configuration.h"
|
||||||
|
#include "../editor.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,6 +104,9 @@ class Vst3Bridge : public HostBridge {
|
|||||||
*/
|
*/
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
|
void handle_x11_events() override;
|
||||||
|
void handle_win32_events() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a callback message to the host return the response. This is a
|
* Send a callback message to the host return the response. This is a
|
||||||
* shorthand for `sockets.vst_host_callback.send_message` for use in VST3
|
* shorthand for `sockets.vst_host_callback.send_message` for use in VST3
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
// Use the native version of xcb
|
// Use the native version of xcb
|
||||||
#pragma push_macro("_WIN32")
|
#pragma push_macro("_WIN32")
|
||||||
#undef _WIN32
|
#undef _WIN32
|
||||||
|
|||||||
Reference in New Issue
Block a user