From b5e03fb5f6a82d3187c7705559dba91c4ce7dada Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 28 Mar 2021 17:27:31 +0200 Subject: LV2/makeplugin: Capture sym names for params. Not all plugins use the symbolic names A,B,C, etc for params, so we need to capture the real names for those that don't. --- plugins/LV2/lib/makeplugin/plugin_info.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'plugins/LV2/lib/makeplugin/plugin_info.rb') diff --git a/plugins/LV2/lib/makeplugin/plugin_info.rb b/plugins/LV2/lib/makeplugin/plugin_info.rb index 686a8e8..0cb945c 100644 --- a/plugins/LV2/lib/makeplugin/plugin_info.rb +++ b/plugins/LV2/lib/makeplugin/plugin_info.rb @@ -32,12 +32,13 @@ module MakePlugin def initialize(root, name) @name = name - @ctrl_ports = [] + @ctrl_ports = {} @var_decls = [] @var_inits = [] self.find_plugin_info(root) if @n_ctrl_ports != @ctrl_ports.length - raise "Expected #{@n_ctrl_ports} but found #{@ctrl_ports.length}" + pp @ctrl_ports + raise "Expected #{@n_ctrl_ports} control ports, but found #{@ctrl_ports.length}" end end @@ -121,12 +122,10 @@ module MakePlugin File.open(class_file) do |f| f.each_line do |line| - if line =~ /void #{@name}::(\w+)/ - fun = $1 + if line =~ /^(void|float) #{@name}::(\w+)/ + fun = $2 elsif line =~ /^#{@name}::#{@name}/ fun = 'constructor_' - elsif fun == 'getParameterName' and line =~ /case\s+kParam([A-Z])\:\s+vst_strncpy\s*\([^,]*,\s*\"([^"]+)\",/ - @ctrl_ports << { sym: $1, name: $2 } elsif fun == 'constructor_' and line =~ /\{\s*$/ fun = 'constructor' elsif fun == 'constructor' @@ -135,6 +134,20 @@ module MakePlugin else @var_inits << line.chomp end + elsif fun == 'getParameterName' and line =~ /case\s+kParam([A-Z])\:\s+vst_strncpy\s*\([^,]*,\s*\"([^"]+)\",/ + puts "getParameterName(#{$1}, #{$2})" + if @ctrl_ports.has_key?($1) + @ctrl_ports[$1][:name] = $2 + else + @ctrl_ports[$1] = { name: $2 } + end + elsif fun == 'getParameter' and line =~ /case\s+kParam([A-Z])\: return (\w+);/ + puts "getParameter(#{$1}, #{$2})" + if @ctrl_ports.has_key?($1) + @ctrl_ports[$1][:sym] = $2 + else + @ctrl_ports[$1] = { sym: $2 } + end end end end -- cgit v1.2.3