From 777f3406871ec6ea488602c108182444366d9137 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 14 Mar 2021 14:11:22 +0100 Subject: LV2/makeplugin: Move type mapping to PluginInfo class. --- plugins/LV2/lib/makeplugin/plugin_info.rb | 16 +++++++++++++++- plugins/LV2/makeplugin | 14 ++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/plugins/LV2/lib/makeplugin/plugin_info.rb b/plugins/LV2/lib/makeplugin/plugin_info.rb index b9cae0d..0cbc896 100644 --- a/plugins/LV2/lib/makeplugin/plugin_info.rb +++ b/plugins/LV2/lib/makeplugin/plugin_info.rb @@ -24,7 +24,6 @@ module MakePlugin attr_reader :name attr_reader :n_ctrl_ports attr_reader :ctrl_ports - attr_reader :type attr_reader :use attr_reader :desc attr_reader :comment @@ -38,6 +37,21 @@ module MakePlugin end end + def type + case @type + when 'Saturation' + 'DistortionPlugin' + when 'EQ' + 'EQPlugin' + else + 'EffectsPlugin' + end + end + + def raw_type + @type + end + private def find_plugin_info(root) diff --git a/plugins/LV2/makeplugin b/plugins/LV2/makeplugin index ac9c353..809b967 100755 --- a/plugins/LV2/makeplugin +++ b/plugins/LV2/makeplugin @@ -63,23 +63,13 @@ plugin_slug = plugin_name.downcase target_dir = File.join(root, 'src', plugin_name) template_dir = File.join(root, 'Template') -def get_lv2_plugin_type(plugin_info) - case plugin_info.type - when 'Saturation' - 'DistortionPlugin' - when 'EQ' - 'EQPlugin' - else - 'EffectsPlugin' - end -end puts "Reading plugin info from cheatsheet..." pi = MakePlugin::PluginInfo.new(root, plugin_name) puts "Creating plugin #{pi.name}..." -puts "Type: #{pi.type}" +puts "Type: #{pi.type} (#{pi.raw_type})" puts "CTRL ports: #{pi.ctrl_ports.length}" Templates = %w{ @@ -99,7 +89,7 @@ begin .gsub('@NCtrlPorts@', pi.n_ctrl_ports.to_s) .gsub('@AssignParams@', make_param_assigns(pi.n_ctrl_ports)) .gsub('@TTLPortDefs@', make_lv2_port_defs(pi)) - .gsub('@TTLPluginType@', get_lv2_plugin_type(pi)) + .gsub('@TTLPluginType@', pi.type) fname = t.sub('Plugin', pi.name) -- cgit v1.2.3