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:
Robbert van der Helm
2020-04-14 15:59:23 +02:00
parent a2ba001e2f
commit eed4677ed3
6 changed files with 38 additions and 15 deletions
+9 -2
View File
@@ -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));