aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-03-28 17:27:31 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-03-28 17:27:31 +0200
commitb5e03fb5f6a82d3187c7705559dba91c4ce7dada (patch)
treef76e1853521d14a8dbdcd38f850d2d80dcedcac1 /plugins
parentecce2bc5147fc4fcea38cc70c497a2e75a4d20f3 (diff)
downloadairwindows-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')
-rw-r--r--plugins/LV2/lib/makeplugin/plugin_description_template.rb5
-rw-r--r--plugins/LV2/lib/makeplugin/plugin_info.rb25
-rwxr-xr-xplugins/LV2/makeplugin2
3 files changed, 23 insertions, 9 deletions
diff --git a/plugins/LV2/lib/makeplugin/plugin_description_template.rb b/plugins/LV2/lib/makeplugin/plugin_description_template.rb
index 3b990b2..13857b8 100644
--- a/plugins/LV2/lib/makeplugin/plugin_description_template.rb
+++ b/plugins/LV2/lib/makeplugin/plugin_description_template.rb
@@ -41,10 +41,11 @@ module MakePlugin
private
def make_ctrl_port(n, ctrl_port)
+ puts "Adding ctrl port #{n}, #{ctrl_port.inspect}."
%Q{ a lv2:InputPort , lv2:ControlPort ;
lv2:index #{n} ;
- lv2:symbol "#{ctrl_port[:sym]}" ;
- lv2:name "#{ctrl_port[:name]}" ;
+ lv2:symbol "#{ctrl_port[1][:sym]}" ;
+ lv2:name "#{ctrl_port[1][:name]}" ;
lv2:default 0.5 ;
lv2:minimum 0.0 ;
lv2:maximum 1.0 ;}
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
diff --git a/plugins/LV2/makeplugin b/plugins/LV2/makeplugin
index de6aaeb..fc49385 100755
--- a/plugins/LV2/makeplugin
+++ b/plugins/LV2/makeplugin
@@ -7,7 +7,7 @@ require_relative 'lib/makeplugin/plugin_info'
def make_param_assigns(ctrl_ports)
ctrl_ports
- .map.with_index { |p, n| "#{p[:sym]} = *params[#{n}];" }
+ .map.with_index { |p, n| "#{p[1][:sym]} = *params[#{n}];" }
.join("\n ")
end