Add support for effGetMidiKeyName

Not a lot of plugins use it, but it's really nice to have when they do.
This commit is contained in:
Robbert van der Helm
2020-04-28 12:54:36 +02:00
parent fb8fe035d8
commit 7ce42e4306
5 changed files with 43 additions and 0 deletions
+4
View File
@@ -226,6 +226,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
return binary_buffer.data();
},
[&](VstIOProperties& props) -> void* { return &props; },
[&](VstMidiKeyName& key_name) -> void* { return &key_name; },
[&](VstParameterProperties& props) -> void* { return &props; },
[&](WantsVstRect&) -> void* { return string_buffer.data(); },
[&](const WantsVstTimeInfo&) -> void* { return nullptr; },
@@ -276,6 +277,9 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
[&](VstIOProperties& props) -> EventResposnePayload {
return props;
},
[&](VstMidiKeyName& key_name) -> EventResposnePayload {
return key_name;
},
[&](VstParameterProperties& props) -> EventResposnePayload {
return props;
},
+5
View File
@@ -185,6 +185,7 @@ void Logger::log_event(bool is_dispatch,
message << "<writable_buffer>";
},
[&](const VstIOProperties&) { message << "<io_properties>"; },
[&](const VstMidiKeyName&) { message << "<key_name>"; },
[&](const VstParameterProperties&) {
message << "<writable_buffer>";
},
@@ -234,6 +235,7 @@ void Logger::log_event_response(bool is_dispatch,
},
[&](const AEffect&) { message << ", <AEffect_object>"; },
[&](const VstIOProperties&) { message << ", <io_properties>"; },
[&](const VstMidiKeyName&) { message << ", <key_name>"; },
[&](const VstParameterProperties& props) {
message << ", <parameter_properties for '" << props.label
<< "'>";
@@ -404,6 +406,9 @@ std::optional<std::string> opcode_to_string(bool is_dispatch, int opcode) {
case effGetOutputProperties:
return "effGetOutputProperties";
break;
case effGetMidiKeyName:
return "effGetMidiKeyName";
break;
default:
return std::nullopt;
break;
+9
View File
@@ -92,6 +92,11 @@ void serialize(S& s, VstIOProperties& props) {
s.container1b(props.data);
}
template <typename S>
void serialize(S& s, VstMidiKeyName& key_name) {
s.container1b(key_name.data);
}
template <typename S>
void serialize(S& s, VstParameterProperties& props) {
s.value4b(props.stepFloat);
@@ -248,6 +253,7 @@ using EventPayload = std::variant<std::nullptr_t,
DynamicVstEvents,
WantsChunkBuffer,
VstIOProperties,
VstMidiKeyName,
VstParameterProperties,
WantsVstRect,
WantsVstTimeInfo,
@@ -272,6 +278,7 @@ void serialize(S& s, EventPayload& payload) {
[](S& s, VstEvent& event) { s.container1b(event.dump); });
},
[](S& s, VstIOProperties& props) { s.object(props); },
[](S& s, VstMidiKeyName& key_name) { s.object(key_name); },
[](S& s, VstParameterProperties& props) { s.object(props); },
[](S&, WantsChunkBuffer&) {}, [](S&, WantsVstRect&) {},
[](S&, WantsVstTimeInfo&) {}, [](S&, WantsString&) {}});
@@ -333,6 +340,7 @@ using EventResposnePayload = std::variant<std::nullptr_t,
std::vector<uint8_t>,
AEffect,
VstIOProperties,
VstMidiKeyName,
VstParameterProperties,
VstRect,
VstTimeInfo>;
@@ -350,6 +358,7 @@ void serialize(S& s, EventResposnePayload& payload) {
},
[](S& s, AEffect& effect) { s.object(effect); },
[](S& s, VstIOProperties& props) { s.object(props); },
[](S& s, VstMidiKeyName& key_name) { s.object(key_name); },
[](S& s, VstParameterProperties& props) { s.object(props); },
[](S& s, VstRect& rect) { s.object(rect); },
[](S& s, VstTimeInfo& time_info) { s.object(time_info); }});
+16
View File
@@ -29,6 +29,12 @@
constexpr int effGetInputProperties = 33;
constexpr int effGetOutputProperties = 34;
// Found on
// https://github.com/falkTX/Carla/blob/07e876a743c5e15c358be170af2e523eadc7dbfa/source/utils/CarlaVstUtils.hpp#L75
// Used to assign names to MIDI keys, for some reason uses the `VstMidiKeyName`
// struct defined below rather than a simple string.
constexpr int effGetMidiKeyName = 66;
/**
* The struct that's being passed through the data parameter during the
* `effGetInputProperties` and `effGetOutputProperties` opcodes. Reverse
@@ -38,3 +44,13 @@ constexpr int effGetOutputProperties = 34;
struct VstIOProperties {
char data[128];
};
/**
* The struct that's passed during `effGetMidiKeyName`. Will be used to write
* the name of a key to (i.e. the name of a sample for drum machines). Again,
* not sure about the exact contents of this struct, but at least the size is
* right!
*/
struct VstMidiKeyName {
char data[80];
};