Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow generate default-preset tool to generate preset for given plugname only. #4

Open
brummer10 opened this issue Nov 29, 2016 · 0 comments

Comments

@brummer10
Copy link
Contributor

Hi
While working on deploying some plugs on the MOD, this little tool is very useful. Just, I prefer to generate the default-preset.ttl file only for the plug I'm working on, instead regenerate it for the complete folder I'm working in. The attached patch add this functionality to generate-default.cpp
This is dune with respect the previous behave, so new usage with this patch will be
usage: generate <lv2-folder> [lv2-plugnamer]
were lv2-plugname is optional.


diff --git a/generate-default-preset/generate.cpp b/generate-default-preset/generate.cpp
index 9215a9a..80a3f11 100644
--- a/generate-default-preset/generate.cpp
+++ b/generate-default-preset/generate.cpp
@@ -388,11 +388,12 @@ int main(int argc, char* argv[])
 {
     if (argc < 2)
     {
-        fprintf(stdout, "usage: %s <lv2-folder>\n", argv[0]);
+        fprintf(stdout, "usage: %s <lv2-folder>  [lv2-plugnamer]\n", argv[0]);
         return 1;
     }
 
     char* lv2_folder = argv[1];
+    char* lv2_plug = argv[2];
 
 #if 0
     stat(s);
@@ -415,11 +416,26 @@ int main(int argc, char* argv[])
 
     const LilvPlugins* const plugins = lilv_world_get_all_plugins(world);
 
-    LILV_FOREACH(plugins, iter, plugins)
+    if (lv2_plug != 0) {
+        LILV_FOREACH(plugins, iter, plugins)
+        {
+            const LilvPlugin* plugin = lilv_plugins_get(plugins, iter);
+            if (plugin)
+            {
+                if (strcmp(lilv_node_as_string(lilv_plugin_get_name(plugin)),lv2_plug) ==0)
+                {
+                    create_plugin_preset(world, plugin);
+                }
+            }
+        }
+    }
+    else
     {
-        create_plugin_preset(world, lilv_plugins_get(plugins, iter));
+        LILV_FOREACH(plugins, iter, plugins)
+        {
+            create_plugin_preset(world, lilv_plugins_get(plugins, iter));
+        }
     }
-
     lilv_world_free(world);
     free(lv2_folder);
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant