mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 21:50:11 +02:00
Allow receiving VST3 messages into existing object
This commit is contained in:
@@ -85,6 +85,22 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
|||||||
typename T::Response send_message(
|
typename T::Response send_message(
|
||||||
const T& object,
|
const T& object,
|
||||||
std::optional<std::pair<Vst3Logger&, bool>> logging) {
|
std::optional<std::pair<Vst3Logger&, bool>> logging) {
|
||||||
|
typename T::Response response_object;
|
||||||
|
return send_message(object, response_object, logging);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `Vst3MessageHandler::send_message()`, but deserializing the response into
|
||||||
|
* an existing object.
|
||||||
|
*
|
||||||
|
* TODO: We might also need overloads that reuse buffers
|
||||||
|
*
|
||||||
|
* @overload
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void send_message(const T& object,
|
||||||
|
typename T::Response& response_object,
|
||||||
|
std::optional<std::pair<Vst3Logger&, bool>> logging) {
|
||||||
using TResponse = typename T::Response;
|
using TResponse = typename T::Response;
|
||||||
|
|
||||||
if (logging) {
|
if (logging) {
|
||||||
@@ -99,7 +115,8 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
|||||||
const TResponse response = this->template send<TResponse>(
|
const TResponse response = this->template send<TResponse>(
|
||||||
[&](boost::asio::local::stream_protocol::socket& socket) {
|
[&](boost::asio::local::stream_protocol::socket& socket) {
|
||||||
write_object(socket, Request(object));
|
write_object(socket, Request(object));
|
||||||
const auto response = read_object<Response>(socket);
|
const auto response =
|
||||||
|
read_object<Response>(socket, response_object);
|
||||||
|
|
||||||
// If the other side handled the request correctly, the Response
|
// If the other side handled the request correctly, the Response
|
||||||
// variant should now contain an object of type `T::Response`
|
// variant should now contain an object of type `T::Response`
|
||||||
|
|||||||
Reference in New Issue
Block a user