diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-03-28 17:27:31 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-03-28 17:27:31 +0200 |
commit | b5e03fb5f6a82d3187c7705559dba91c4ce7dada (patch) | |
tree | f76e1853521d14a8dbdcd38f850d2d80dcedcac1 /plugins/LV2/lib/makeplugin/plugin_info.rb | |
parent | ecce2bc5147fc4fcea38cc70c497a2e75a4d20f3 (diff) | |
download | airwindows-lv2-port-b5e03fb5f6a82d3187c7705559dba91c4ce7dada.tar.gz airwindows-lv2-port-b5e03fb5f6a82d3187c7705559dba91c4ce7dada.tar.bz2 airwindows-lv2-port-b5e03fb5f6a82d3187c7705559dba91c4ce7dada.zip |
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.
Diffstat (limited to 'plugins/LV2/lib/makeplugin/plugin_info.rb')
-rw-r--r-- | plugins/LV2/lib/makeplugin/plugin_info.rb | 25 |
1 files changed, 19 insertions, 6 deletions
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 |