Rename parameters for clarity

This commit is contained in:
Robbert van der Helm
2020-02-26 16:52:54 +01:00
parent 3d12489e58
commit c2e102969e
5 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -27,7 +27,7 @@
* in one of the dispatch functions. This is used as a buffer size and also as a * in one of the dispatch functions. This is used as a buffer size and also as a
* cutoff for checking if c-style strings behind a `char*` have changed. * cutoff for checking if c-style strings behind a `char*` have changed.
*/ */
constexpr size_t max_string_size = 128; constexpr size_t max_string_length = 128;
/** /**
* An event as dispatched by the VST host. These events will get forwarded to * An event as dispatched by the VST host. These events will get forwarded to
@@ -36,7 +36,7 @@ constexpr size_t max_string_size = 128;
*/ */
struct Event { struct Event {
int32_t opcode; int32_t opcode;
int32_t parameter; int32_t index;
// TODO: This is an intptr_t, is this actually a poitner that should be // TODO: This is an intptr_t, is this actually a poitner that should be
// dereferenced? // dereferenced?
intptr_t value; intptr_t value;
@@ -49,7 +49,7 @@ struct Event {
*/ */
std::optional<std::string> data; std::optional<std::string> data;
MSGPACK_DEFINE(opcode, parameter, value, option, data) MSGPACK_DEFINE(opcode, index, value, option, data)
}; };
/** /**
+2 -2
View File
@@ -74,7 +74,7 @@ Bridge::Bridge()
*/ */
intptr_t Bridge::dispatch(AEffect* /*plugin*/, intptr_t Bridge::dispatch(AEffect* /*plugin*/,
int32_t opcode, int32_t opcode,
int32_t parameter, int32_t index,
intptr_t value, intptr_t value,
void* data, void* data,
float option) { float option) {
@@ -102,7 +102,7 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
? std::nullopt ? std::nullopt
: std::make_optional(std::string(static_cast<char*>(data))); : std::make_optional(std::string(static_cast<char*>(data)));
const Event event{opcode, parameter, value, option, payload}; const Event event{opcode, index, value, option, payload};
write_object(host_vst_dispatch, event); write_object(host_vst_dispatch, event);
const auto response = read_object<EventResult>(host_vst_dispatch); const auto response = read_object<EventResult>(host_vst_dispatch);
+1 -1
View File
@@ -50,7 +50,7 @@ class Bridge {
*/ */
intptr_t dispatch(AEffect* plugin, intptr_t dispatch(AEffect* plugin,
int32_t opcode, int32_t opcode,
int32_t parameter, int32_t index,
intptr_t value, intptr_t value,
void* data, void* data,
float option); float option);
+3 -3
View File
@@ -93,12 +93,12 @@ VST_EXPORT AEffect* VSTPluginMain(audioMasterCallback /*audioMaster*/) {
intptr_t dispatch(AEffect* plugin, intptr_t dispatch(AEffect* plugin,
int32_t opcode, int32_t opcode,
int32_t parameter, int32_t index,
intptr_t value, intptr_t value,
void* data, void* data,
float option) { float option) {
return get_bridge_instance(*plugin).dispatch(plugin, opcode, parameter, return get_bridge_instance(*plugin).dispatch(plugin, opcode, index, value,
value, data, option); data, option);
} }
void process(AEffect* plugin, void process(AEffect* plugin,
+4 -4
View File
@@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
// TODO: Remove debug, we're just reporting the plugin's name we retrieved // TODO: Remove debug, we're just reporting the plugin's name we retrieved
// above // above
std::array<char, max_string_size> buffer; std::array<char, max_string_length> buffer;
while (true) { while (true) {
auto event = read_object<Event>(host_vst_dispatch); auto event = read_object<Event>(host_vst_dispatch);
@@ -100,8 +100,8 @@ int main(int argc, char* argv[]) {
} }
const intptr_t return_value = const intptr_t return_value =
plugin->dispatcher(plugin, event.opcode, event.option, plugin->dispatcher(plugin, event.opcode, event.option, event.index,
event.parameter, payload, event.option); payload, event.option);
// Only write back the value from `payload` if we were passed an empty // Only write back the value from `payload` if we were passed an empty
// buffer to write into // buffer to write into
@@ -120,7 +120,7 @@ int main(int argc, char* argv[]) {
// TODO: Placeholder // TODO: Placeholder
intptr_t VST_CALL_CONV host_callback(AEffect* plugin, intptr_t VST_CALL_CONV host_callback(AEffect* plugin,
int32_t opcode, int32_t opcode,
int32_t parameter, int32_t index,
intptr_t value, intptr_t value,
void* data, void* data,
float option) { float option) {