aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/LV2/Template/Plugin.ttl2
-rwxr-xr-xplugins/LV2/makeplugin41
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)