Rename EventHandler to Vst2EventHandler

This commit is contained in:
Robbert van der Helm
2021-05-20 13:54:31 +02:00
parent e4ca520b64
commit a194765696
4 changed files with 21 additions and 20 deletions
+2 -2
View File
@@ -134,8 +134,8 @@ over:
below) are already in fairly easily serializable format, we use the below) are already in fairly easily serializable format, we use the
`*DataConverter` classes to read and write payload data depending on the `*DataConverter` classes to read and write payload data depending on the
opcode (or to make a best guess estimate if we're dealing with some unknown opcode (or to make a best guess estimate if we're dealing with some unknown
undocumented function), and we then `EventHandler::send_event()`, undocumented function), and we then `Vst2EventHandler::send_event()`,
`EventHandler::receive_events()`, and `passthrough_event()` to pass through `Vst2EventHandler::receive_events()`, and `passthrough_event()` to pass through
these function calls. these function calls.
- For callbacks made by the Windows plugin using the provided `audioMaster()` - For callbacks made by the Windows plugin using the provided `audioMaster()`
function we do exactly the same as the above, but the other way around. function we do exactly the same as the above, but the other way around.
+15 -14
View File
@@ -97,17 +97,18 @@ class DefaultDataConverter {
* - Aside from that the listening side will have a second thread asynchronously * - Aside from that the listening side will have a second thread asynchronously
* listening for new connections on the socket endpoint. * listening for new connections on the socket endpoint.
* *
* The `EventHandler::send_event()` method is used to send events. If the socket * The `Vst2EventHandler::send_event()` method is used to send events. If the
* is currently being written to, we'll first create a new socket connection as * socket is currently being written to, we'll first create a new socket
* described above. Similarly, the `EventHandler::receive_events()` method first * connection as described above. Similarly, the
* sets up asynchronous listeners for the socket endpoint, and then block and * `Vst2EventHandler::receive_events()` method first sets up asynchronous
* handle events until the main socket is closed. * listeners for the socket endpoint, and then block and handle events until the
* main socket is closed.
* *
* @tparam Thread The thread implementation to use. On the Linux side this * @tparam Thread The thread implementation to use. On the Linux side this
* should be `std::jthread` and on the Wine side this should be `Win32Thread`. * should be `std::jthread` and on the Wine side this should be `Win32Thread`.
*/ */
template <typename Thread> template <typename Thread>
class EventHandler : public AdHocSocketHandler<Thread> { class Vst2EventHandler : public AdHocSocketHandler<Thread> {
public: public:
/** /**
* Sets up a single main socket for this type of events. The sockets won't * Sets up a single main socket for this type of events. The sockets won't
@@ -123,9 +124,9 @@ class EventHandler : public AdHocSocketHandler<Thread> {
* *
* @see Sockets::connect * @see Sockets::connect
*/ */
EventHandler(boost::asio::io_context& io_context, Vst2EventHandler(boost::asio::io_context& io_context,
boost::asio::local::stream_protocol::endpoint endpoint, boost::asio::local::stream_protocol::endpoint endpoint,
bool listen) bool listen)
: AdHocSocketHandler<Thread>(io_context, endpoint, listen) {} : AdHocSocketHandler<Thread>(io_context, endpoint, listen) {}
/** /**
@@ -148,7 +149,7 @@ class EventHandler : public AdHocSocketHandler<Thread> {
* this is for sending `dispatch()` events or host callbacks. Optional * this is for sending `dispatch()` events or host callbacks. Optional
* since it doesn't have to be done on both sides. * since it doesn't have to be done on both sides.
* *
* @relates EventHandler::receive_events * @relates Vst2EventHandler::receive_events
* @relates passthrough_event * @relates passthrough_event
*/ */
template <typename D> template <typename D>
@@ -220,7 +221,7 @@ class EventHandler : public AdHocSocketHandler<Thread> {
* @param callback The function used to generate a response out of an event. * @param callback The function used to generate a response out of an event.
* See the definition of `F` for more information. * See the definition of `F` for more information.
* *
* @relates EventHandler::send_event * @relates Vst2EventHandler::send_event
* @relates passthrough_event * @relates passthrough_event
*/ */
template <invocable_returning<EventResult, Event&, bool> F> template <invocable_returning<EventResult, Event&, bool> F>
@@ -341,12 +342,12 @@ class Vst2Sockets : public Sockets {
* The socket that forwards all `dispatcher()` calls from the VST host to * The socket that forwards all `dispatcher()` calls from the VST host to
* the plugin. * the plugin.
*/ */
EventHandler<Thread> host_vst_dispatch; Vst2EventHandler<Thread> host_vst_dispatch;
/** /**
* The socket that forwards all `audioMaster()` calls from the Windows VST * The socket that forwards all `audioMaster()` calls from the Windows VST
* plugin to the host. * plugin to the host.
*/ */
EventHandler<Thread> vst_host_callback; Vst2EventHandler<Thread> vst_host_callback;
/** /**
* Used for both `getParameter` and `setParameter` since they mostly * Used for both `getParameter` and `setParameter` since they mostly
* overlap. * overlap.
@@ -384,7 +385,7 @@ class Vst2Sockets : public Sockets {
* @return The result of the operation. If necessary the `DataConverter` will * @return The result of the operation. If necessary the `DataConverter` will
* unmarshall the payload again and write it back. * unmarshall the payload again and write it back.
* *
* @relates EventHandler::receive_events * @relates Vst2EventHandler::receive_events
*/ */
template < template <
invocable_returning<intptr_t, AEffect*, int, int, intptr_t, void*, float> F> invocable_returning<intptr_t, AEffect*, int, int, intptr_t, void*, float> F>
+3 -3
View File
@@ -29,7 +29,7 @@
* request of type `T`, where `T` is in `{Control,Callback}Request`, should be * request of type `T`, where `T` is in `{Control,Callback}Request`, should be
* answered with an object of type `T::Response`. * answered with an object of type `T::Response`.
* *
* See the docstrings on `EventHandler` and `AdHocSocketHandler` for more * See the docstrings on `Vst2EventHandler` and `AdHocSocketHandler` for more
* information on how this works internally and why it works the way it does. * information on how this works internally and why it works the way it does.
* *
* @note The name of this class is not to be confused with VST3's `IMessage` as * @note The name of this class is not to be confused with VST3's `IMessage` as
@@ -475,7 +475,7 @@ class Vst3Sockets : public Sockets {
/** /**
* For sending messages from the host to the plugin. After we have a better * For sending messages from the host to the plugin. After we have a better
* idea of what our communication model looks like we'll probably want to * idea of what our communication model looks like we'll probably want to
* provide an abstraction similar to `EventHandler`. For optimization * provide an abstraction similar to `Vst2EventHandler`. For optimization
* reasons calls to `IAudioProcessor` or `IComponent` are handled using the * reasons calls to `IAudioProcessor` or `IComponent` are handled using the
* dedicated sockets in `audio_processor_sockets`. * dedicated sockets in `audio_processor_sockets`.
* *
@@ -487,7 +487,7 @@ class Vst3Sockets : public Sockets {
/** /**
* For sending callbacks from the plugin back to the host. After we have a * For sending callbacks from the plugin back to the host. After we have a
* better idea of what our communication model looks like we'll probably * better idea of what our communication model looks like we'll probably
* want to provide an abstraction similar to `EventHandler`. * want to provide an abstraction similar to `Vst2EventHandler`.
*/ */
Vst3MessageHandler<Thread, CallbackRequest> vst_host_callback; Vst3MessageHandler<Thread, CallbackRequest> vst_host_callback;
+1 -1
View File
@@ -138,7 +138,7 @@ class Vst2PluginBridge : PluginBridge<Vst2Sockets<std::jthread>> {
* A mutex to prevent multiple simultaneous calls to `getParameter()` and * A mutex to prevent multiple simultaneous calls to `getParameter()` and
* `setParameter()`. This likely won't happen, but better safe than sorry. * `setParameter()`. This likely won't happen, but better safe than sorry.
* For `dispatch()` and `audioMaster()` there's some more complex logic for * For `dispatch()` and `audioMaster()` there's some more complex logic for
* this in `EventHandler`. * this in `Vst2EventHandler`.
*/ */
std::mutex parameters_mutex; std::mutex parameters_mutex;