diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-08-02 18:57:35 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-08-02 18:57:35 +0200 |
commit | 592e01cd1a572d03a3c79c99a6af7d2e3828c171 (patch) | |
tree | aba1a4660b7108474c44a849fc95145d60c0fdb9 | |
parent | 11e5228c0ac28e5feb3d69173af157f6677aa195 (diff) | |
download | airwindows-lv2-port-592e01cd1a572d03a3c79c99a6af7d2e3828c171.tar.gz airwindows-lv2-port-592e01cd1a572d03a3c79c99a6af7d2e3828c171.tar.bz2 airwindows-lv2-port-592e01cd1a572d03a3c79c99a6af7d2e3828c171.zip |
LV2: makeplugin use cheatsheet db for plugin type mapping.
Only the 'Saturation' type is mapped to lv2::DistortionPlugin for now,
but this is easy to expand as we go. I'll update this for each new
plugin type that's ported for now.
-rw-r--r-- | plugins/LV2/Template/Plugin.ttl | 2 | ||||
-rwxr-xr-x | plugins/LV2/makeplugin | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/plugins/LV2/Template/Plugin.ttl b/plugins/LV2/Template/Plugin.ttl index 1402c9e..1ede09d 100644 --- a/plugins/LV2/Template/Plugin.ttl +++ b/plugins/LV2/Template/Plugin.ttl @@ -7,7 +7,7 @@ <https://www.airwindows.com/@plugin@> a lv2:Plugin , - lv2:EffectPlugin ; + lv2:@TTLPluginType@ ; lv2:project <https://www.airwindows.com> ; lv2:optionalFeature lv2:hardRTCapable ; diff --git a/plugins/LV2/makeplugin b/plugins/LV2/makeplugin index 5fae69f..3dd2782 100755 --- a/plugins/LV2/makeplugin +++ b/plugins/LV2/makeplugin @@ -63,7 +63,47 @@ n_ctrl_ports = ARGV[1] || '1' target_dir = File.join(root, 'src', plugin_name) template_dir = File.join(root, 'Template') +PLUGIN_FIELDS = %w{Type Use Description Comment} + +def find_plugin_info(db, plugin_name) + pi = { name: plugin_name } + found = false + + File.open(db) do |f| + pat = /^\s*(\w+): \"([^"]+)\",/ + f.each_line do |line| + if found && line =~ /^\s*\},$/ + return pi + end + + pat.match(line) do |m| + if m[1] == 'Name' && m[2] == plugin_name + found = true + elsif found && PLUGIN_FIELDS.include?(m[1]) + pi[m[1].downcase.to_sym] = m[2] + end + end + end + end + + return pi +end + +def get_lv2_plugin_type(plugin_info) + case plugin_info[:type] + when 'Saturation' + 'DistortionPlugin' + else + 'EffectsPlugin' + end +end + +puts "Reading plugin info from cheatsheet..." +plugin_info = find_plugin_info(File.join(root, '../../cheatsheet/src/database.js'), plugin_name) + + puts "Creating plugin #{plugin_name}..." +puts "Type: #{plugin_info[:type]}" Templates = %w{ manifest.ttl.in @@ -82,6 +122,7 @@ begin .gsub('@NCtrlPorts@', n_ctrl_ports) .gsub('@AssignParams@', make_param_assigns(n_ctrl_ports.to_i)) .gsub('@TTLPortDefs@', make_lv2_port_defs(n_ctrl_ports.to_i)) + .gsub('@TTLPluginType@', get_lv2_plugin_type(plugin_info)) fname = t.sub('Plugin', plugin_name) |