Use the fancy new variant instead of strings

This commit is contained in:
Robbert van der Helm
2020-03-11 16:04:49 +01:00
parent 8c187e3ca5
commit 6ab7af10f9
2 changed files with 2 additions and 10 deletions
+1 -3
View File
@@ -215,9 +215,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
// returning structs, but in this case the value returned from // returning structs, but in this case the value returned from
// the callback function is actually a pointer to a // the callback function is actually a pointer to a
// `VstTimeInfo` struct! // `VstTimeInfo` struct!
// TODO: Use the fancy new VstTimeInfo variant here return *reinterpret_cast<const VstTimeInfo*>(return_value);
return std::string(reinterpret_cast<const char*>(return_value),
sizeof(VstTimeInfo));
}, },
[&](WantsString&) -> EventResposnePayload { [&](WantsString&) -> EventResposnePayload {
return std::string(static_cast<char*>(data)); return std::string(static_cast<char*>(data));
+1 -7
View File
@@ -230,13 +230,7 @@ class HostCallbackDataConverter : DefaultDataConverter {
case audioMasterGetTime: case audioMasterGetTime:
// Write the returned `VstTimeInfo` struct into a field and make // Write the returned `VstTimeInfo` struct into a field and make
// the function return a poitner to it in the function below // the function return a poitner to it in the function below
// TODO: Use the fancy new `VstTimeINfo` variant here time = std::get<VstTimeInfo>(response.payload);
{
std::string buffer =
std::get<std::string>(response.payload);
time = *static_cast<const VstTimeInfo*>(
static_cast<const void*>(buffer.data()));
}
break; break;
default: default:
DefaultDataConverter::write(opcode, data, response); DefaultDataConverter::write(opcode, data, response);