From 2fc7c7466546538fefde9f030641b08ea8f80278 Mon Sep 17 00:00:00 2001 From: Junior Rantila Date: Fri, 3 Jan 2025 02:35:44 +0100 Subject: [PATCH] vst-dump: Add option to print parameter details --- Tools/vst-dump.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Tools/vst-dump.cpp b/Tools/vst-dump.cpp index d905a64..e4103f5 100644 --- a/Tools/vst-dump.cpp +++ b/Tools/vst-dump.cpp @@ -9,9 +9,7 @@ #include -namespace Main { - -ErrorOr main(int argc, char const* argv[]) +ErrorOr Main::main(int argc, char const* argv[]) { auto argument_parser = CLI::ArgumentParser(); @@ -20,6 +18,11 @@ ErrorOr main(int argc, char const* argv[]) plugin_path = arg; })); + bool print_parameters = false; + TRY(argument_parser.add_flag("--print-parameters", "-pp", "print parameters", [&]{ + print_parameters = true; + })); + if (auto result = argument_parser.run(argc, argv); result.is_error()) { TRY(result.error().show()); return 1; @@ -71,9 +74,17 @@ ErrorOr main(int argc, char const* argv[]) }; printf(" %.*s: %.*s\n", feature.name().size(), feature.name().data(), result.name().size(), result.name().data()); } - printf("\n------------------------------------\n\n"); - + if (print_parameters && plugin.number_of_parameters() > 0) { + printf("\n\n-------------Parameters-------------\n\n"); + for (u32 i = 0; i < plugin.number_of_parameters(); i++) { + char buf[1024]; + printf("%d:\n", i); + printf(" - name: %s\n", plugin.parameter_name(buf, i)); + printf(" - display: %s\n", plugin.parameter_display(buf, i)); + printf(" - label: %s\n", plugin.parameter_label(buf, i)); + printf(" - can be automated: %s\n", plugin.parameter_can_be_automated(i) ? "yes" : "no"); + } + } + printf("------------------------------------\n\n"); return 0; } - -}