diff options
Diffstat (limited to 'plugins/LV2/makeplugin')
-rwxr-xr-x | plugins/LV2/makeplugin | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/LV2/makeplugin b/plugins/LV2/makeplugin index 8fc98eb..5b11a87 100755 --- a/plugins/LV2/makeplugin +++ b/plugins/LV2/makeplugin @@ -1,7 +1,13 @@ #!/usr/bin/env ruby -unless ARGV[0] - puts "Give me the name of a plugin to make." +def make_param_assigns(num) + (0 ... num) + .map { |n| "#{('A'.ord + n).chr} = *param[#{n}];" } + .join("\n ") +end + +if ARGV.length < 1 + puts "Usage: #{__FILE__} <PluginName> [<NCtrlPorts>]" exit end @@ -10,6 +16,8 @@ root = File.dirname(__FILE__) plugin_name = ARGV[0] plugin_slug = plugin_name.downcase +n_ctrl_ports = ARGV[1] || '1' + target_dir = File.join(root, 'src', plugin_name) template_dir = File.join(root, 'Template') @@ -29,6 +37,8 @@ begin tpl = IO.read(File.join(template_dir, t)) .gsub('@Plugin@', plugin_name) .gsub('@plugin@', plugin_slug) + .gsub('@NCtrlPorts@', n_ctrl_ports) + .gsub('@AssignParams@', make_param_assigns(n_ctrl_ports.to_i)) fname = t.sub('Plugin', plugin_name) |