Implement effGetParameterProperties

This commit is contained in:
Robbert van der Helm
2020-04-26 16:53:34 +02:00
parent aee890fbf6
commit aeac8e87fa
4 changed files with 45 additions and 2 deletions
+4 -2
View File
@@ -210,6 +210,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
},
[&](WantsChunkBuffer&) -> void* { return string_buffer.data(); },
[&](VstIOProperties& props) -> void* { return &props; },
[&](VstParameterProperties& props) -> void* { return &props; },
[&](WantsVstRect&) -> void* { return string_buffer.data(); },
[&](const WantsVstTimeInfo&) -> void* { return nullptr; },
[&](WantsString&) -> void* { return string_buffer.data(); }},
@@ -259,8 +260,9 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
return_value);
},
[&](VstIOProperties& props) -> EventResposnePayload {
// The plugin has written a pointer to a VstRect struct
// into the data poitner
return props;
},
[&](VstParameterProperties& props) -> EventResposnePayload {
return props;
},
[&](WantsVstRect&) -> EventResposnePayload {
+7
View File
@@ -182,6 +182,9 @@ void Logger::log_event(bool is_dispatch,
message << "<writable_buffer>";
},
[&](const VstIOProperties&) { message << "<io_properties>"; },
[&](const VstParameterProperties&) {
message << "<writable_buffer>";
},
[&](const WantsVstRect&) { message << "<writable_buffer>"; },
[&](const WantsVstTimeInfo&) { message << "<nullptr>"; },
[&](const WantsString&) { message << "<writable_string>"; }},
@@ -225,6 +228,10 @@ void Logger::log_event_response(bool is_dispatch,
},
[&](const AEffect&) { message << ", <AEffect_object>"; },
[&](const VstIOProperties&) { message << ", <io_properties>"; },
[&](const VstParameterProperties& props) {
message << ", <parameter_properties for '" << props.label
<< "'>";
},
[&](const VstRect& rect) {
message << ", {l: " << rect.left << ", t: " << rect.top
<< ", r: " << rect.right << ", b: " << rect.bottom
+24
View File
@@ -92,6 +92,26 @@ void serialize(S& s, VstIOProperties& props) {
s.container1b(props.data);
}
template <typename S>
void serialize(S& s, VstParameterProperties& props) {
s.value4b(props.stepFloat);
s.value4b(props.smallStepFloat);
s.value4b(props.largeStepFloat);
s.container1b(props.label);
s.value4b(props.flags);
s.value4b(props.minInteger);
s.value4b(props.maxInteger);
s.value4b(props.stepInteger);
s.value4b(props.largeStepInteger);
s.container1b(props.shortLabel);
s.value2b(props.displayIndex);
s.value2b(props.category);
s.value2b(props.numParametersInCategory);
s.value2b(props.reserved);
s.container1b(props.categoryLabel);
s.container1b(props.future);
}
template <typename S>
void serialize(S& s, VstRect& rect) {
s.value2b(rect.top);
@@ -220,6 +240,7 @@ using EventPayload = std::variant<std::nullptr_t,
DynamicVstEvents,
WantsChunkBuffer,
VstIOProperties,
VstParameterProperties,
WantsVstRect,
WantsVstTimeInfo,
WantsString>;
@@ -242,6 +263,7 @@ void serialize(S& s, EventPayload& payload) {
[](S& s, VstEvent& event) { s.container1b(event.dump); });
},
[](S& s, VstIOProperties& props) { s.object(props); },
[](S& s, VstParameterProperties& props) { s.object(props); },
[](S&, WantsChunkBuffer&) {}, [](S&, WantsVstRect&) {},
[](S&, WantsVstTimeInfo&) {}, [](S&, WantsString&) {}});
}
@@ -302,6 +324,7 @@ using EventResposnePayload = std::variant<std::nullptr_t,
std::string,
AEffect,
VstIOProperties,
VstParameterProperties,
VstRect,
VstTimeInfo>;
@@ -318,6 +341,7 @@ void serialize(S& s, EventResposnePayload& payload) {
},
[](S& s, AEffect& effect) { s.object(effect); },
[](S& s, VstIOProperties& props) { s.object(props); },
[](S& s, VstParameterProperties& props) { s.object(props); },
[](S& s, VstRect& rect) { s.object(rect); },
[](S& s, VstTimeInfo& time_info) { s.object(time_info); }});
}
+10
View File
@@ -221,6 +221,9 @@ class DispatchDataConverter : DefaultDataConverter {
// data (or at least Bitwig does this)
return *static_cast<const VstIOProperties*>(data);
break;
case effGetParameterProperties:
return *static_cast<const VstParameterProperties*>(data);
break;
default:
return DefaultDataConverter::read(opcode, index, value, data);
break;
@@ -256,6 +259,13 @@ class DispatchDataConverter : DefaultDataConverter {
*static_cast<VstIOProperties*>(data) = properties;
} break;
case effGetParameterProperties: {
// Same as the above
const auto properties =
std::get<VstParameterProperties>(response.payload);
*static_cast<VstParameterProperties*>(data) = properties;
} break;
default:
DefaultDataConverter::write(opcode, data, response);
break;