mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Swap read_object arguments to match write_object
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
TODO: Remove the mentions of VST3 support not yet being part of the released version from the readme
|
TODO: Remove the mentions of VST3 support not yet being part of the released version from the readme
|
||||||
TODO: Add an updates screenshot with some fancy VST3-only plugins to the readme
|
TODO: Add an updated screenshot with some fancy VST3-only plugins to the readme
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ inline void write_object(Socket& socket, const T& object) {
|
|||||||
* together with `write_object`. This will block until the object is available.
|
* together with `write_object`. This will block until the object is available.
|
||||||
*
|
*
|
||||||
* @param socket The Boost.Asio socket to read from.
|
* @param socket The Boost.Asio socket to read from.
|
||||||
* @param buffer The buffer to read into. This is useful for sending audio and
|
|
||||||
* chunk data since that can vary in size by a lot.
|
|
||||||
* @param object The object to serialize into. There are also overrides that
|
* @param object The object to serialize into. There are also overrides that
|
||||||
* create a new default initialized `T`
|
* create a new default initialized `T`
|
||||||
|
* @param buffer The buffer to read into. This is useful for sending audio and
|
||||||
|
* chunk data since that can vary in size by a lot.
|
||||||
*
|
*
|
||||||
* @return The deserialized object.
|
* @return The deserialized object.
|
||||||
*
|
*
|
||||||
@@ -103,13 +103,10 @@ inline void write_object(Socket& socket, const T& object) {
|
|||||||
* @throw boost::system::system_error If the socket is closed or gets closed
|
* @throw boost::system::system_error If the socket is closed or gets closed
|
||||||
* while reading.
|
* while reading.
|
||||||
*
|
*
|
||||||
* TODO: Swap these arguments around so they match `write_object`'s argument
|
|
||||||
* order
|
|
||||||
*
|
|
||||||
* @relates write_object
|
* @relates write_object
|
||||||
*/
|
*/
|
||||||
template <typename T, typename Socket>
|
template <typename T, typename Socket>
|
||||||
inline T& read_object(Socket& socket, std::vector<uint8_t>& buffer, T& object) {
|
inline T& read_object(Socket& socket, T& object, std::vector<uint8_t>& buffer) {
|
||||||
// See the note above on the use of `uint64_t` instead of `size_t`
|
// See the note above on the use of `uint64_t` instead of `size_t`
|
||||||
std::array<uint64_t, 1> message_length;
|
std::array<uint64_t, 1> message_length;
|
||||||
boost::asio::read(socket, boost::asio::buffer(message_length),
|
boost::asio::read(socket, boost::asio::buffer(message_length),
|
||||||
@@ -146,7 +143,7 @@ inline T& read_object(Socket& socket, std::vector<uint8_t>& buffer, T& object) {
|
|||||||
template <typename T, typename Socket>
|
template <typename T, typename Socket>
|
||||||
inline T read_object(Socket& socket, std::vector<uint8_t>& buffer) {
|
inline T read_object(Socket& socket, std::vector<uint8_t>& buffer) {
|
||||||
T object;
|
T object;
|
||||||
read_object<T>(socket, buffer, object);
|
read_object<T>(socket, object, buffer);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@@ -160,7 +157,7 @@ inline T read_object(Socket& socket, std::vector<uint8_t>& buffer) {
|
|||||||
template <typename T, typename Socket>
|
template <typename T, typename Socket>
|
||||||
inline T& read_object(Socket& socket, T& object) {
|
inline T& read_object(Socket& socket, T& object) {
|
||||||
std::vector<uint8_t> buffer(64);
|
std::vector<uint8_t> buffer(64);
|
||||||
return read_object<T>(socket, buffer, object);
|
return read_object<T>(socket, object, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,7 +170,7 @@ template <typename T, typename Socket>
|
|||||||
inline T read_object(Socket& socket) {
|
inline T read_object(Socket& socket) {
|
||||||
T object;
|
T object;
|
||||||
std::vector<uint8_t> buffer(64);
|
std::vector<uint8_t> buffer(64);
|
||||||
read_object<T>(socket, buffer, object);
|
read_object<T>(socket, object, buffer);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
|||||||
this->template send<std::monostate>(
|
this->template send<std::monostate>(
|
||||||
[&](boost::asio::local::stream_protocol::socket& socket) {
|
[&](boost::asio::local::stream_protocol::socket& socket) {
|
||||||
write_object(socket, Request(object), buffer);
|
write_object(socket, Request(object), buffer);
|
||||||
read_object<TResponse>(socket, buffer, response_object);
|
read_object<TResponse>(socket, response_object, buffer);
|
||||||
// FIXME: We have to return something here, and ML was not yet
|
// FIXME: We have to return something here, and ML was not yet
|
||||||
// invented when they came up with C++ so void is not
|
// invented when they came up with C++ so void is not
|
||||||
// valid here
|
// valid here
|
||||||
|
|||||||
Reference in New Issue
Block a user