mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-10 06:12:14 +02:00
Fix VstTimeinfo responses and allow null responses
The host is allowed to return a null pointer if it doesn't support the query.
This commit is contained in:
+9
-2
@@ -285,8 +285,15 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
// Not sure why the VST API has twenty different ways of
|
||||
// returning structs, but in this case the value returned
|
||||
// from the callback function is actually a pointer to a
|
||||
// `VstTimeInfo` struct!
|
||||
return *reinterpret_cast<const VstTimeInfo*>(return_value);
|
||||
// `VstTimeInfo` struct! It can also be a null pointer if
|
||||
// the host doesn't support this.
|
||||
const auto time_info =
|
||||
reinterpret_cast<const VstTimeInfo*>(return_value);
|
||||
if (time_info == nullptr) {
|
||||
return std::monostate{};
|
||||
} else {
|
||||
return *time_info;
|
||||
}
|
||||
},
|
||||
[&](WantsString&) -> EventResposnePayload {
|
||||
return std::string(static_cast<char*>(data));
|
||||
|
||||
@@ -295,6 +295,9 @@ struct Event {
|
||||
* - A specific struct in response to an event such as `audioMasterGetTime` or
|
||||
* `audioMasterIOChanged`.
|
||||
* - An X11 window pointer for the editor window.
|
||||
*
|
||||
* TODO: Replace `std::monostate` with `std::nullptr_t` as it's more expressive
|
||||
* in what it actually represents.
|
||||
*/
|
||||
using EventResposnePayload = std::variant<std::monostate,
|
||||
std::string,
|
||||
|
||||
Reference in New Issue
Block a user