[beast: 7/9] BSE: move "bsequery synth" to "bsetool standard-synth"



commit eaf57983af4fdeddf17e3c7f78c050c8d3341a64
Author: Tim Janik <timj gnu org>
Date:   Thu Sep 17 20:48:16 2015 +0200

    BSE: move "bsequery synth" to "bsetool standard-synth"

 bse/bsequery.cc |   15 +--------------
 bse/bsetool.cc  |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/bse/bsequery.cc b/bse/bsequery.cc
index fd78f21..ce1e1a3 100644
--- a/bse/bsequery.cc
+++ b/bse/bsequery.cc
@@ -3,7 +3,6 @@
 #include "bsesource.hh"
 #include "bseprocedure.hh"
 #include "bsemain.hh"
-#include "bsestandardsynths.hh"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -165,7 +164,6 @@ help (gchar *arg)
   fprintf (stderr, "       froots     iterate over fundamental roots\n");
   fprintf (stderr, "       tree       print BSE type tree\n");
   fprintf (stderr, "       procdoc    print procedure documentation\n");
-  fprintf (stderr, "       synth <x>  dump standard synth <x> definition\n");
 
   return arg != NULL;
 }
@@ -177,7 +175,6 @@ main (gint   argc,
   gboolean gen_froots = 0;
   gboolean gen_tree = 0;
   gboolean gen_procdoc = 0;
-  gchar *show_synth = NULL;
   gchar *root_name = NULL;
   const char *iindent = "";
   const char *pluginbool = "load-core-plugins=0";
@@ -244,10 +241,6 @@ main (gint   argc,
        {
          gen_froots = 1;
        }
-      else if (strcmp ("synth", argv[i]) == 0 && i + 1 < argc)
-       {
-         show_synth = argv[++i];
-       }
       else if (strcmp ("tree", argv[i]) == 0)
        {
          gen_tree = 1;
@@ -279,7 +272,7 @@ main (gint   argc,
     root = g_type_from_name (root_name);
   else
     root = BSE_TYPE_OBJECT;
-  if (!gen_froots && !gen_tree && !gen_procdoc && !show_synth)
+  if (!gen_froots && !gen_tree && !gen_procdoc)
     return help (argv[i-1]);
   if (!indent_inc)
     {
@@ -304,12 +297,6 @@ main (gint   argc,
     }
   if (gen_procdoc)
     show_procdoc ();
-  if (show_synth)
-    {
-      gchar *text = bse_standard_synth_inflate (show_synth, NULL);
-      g_print ("%s", text);
-      g_free (text);
-    }
 
   return 0;
 }
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index f8a7a0f..8e5fc9d 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -3,6 +3,7 @@
 #include <bse/bseserver.hh>
 #include <bse/bsemathsignal.hh>
 #include <bse/bsecategories.hh>
+#include <bse/bsestandardsynths.hh>
 #include <sys/resource.h>
 #include <unordered_map>
 #include <unistd.h>
@@ -265,6 +266,26 @@ static CommandRegistry dump_categories_cmd (dump_categories_options, dump_catego
                                             "Printout the BSE category registry");
 
 
+// == standard-synth ==
+static ArgDescription standard_synth_options[] = {
+  { "<synth-name>", "", "The BSE synth to show (e.g. 'adsr-wave-1')", "" },
+};
+
+static String
+standard_synth (const ArgParser &ap)
+{
+  const String bsefile = ap["synth-name"];
+  gchar *text = bse_standard_synth_inflate (bsefile.c_str(), NULL);
+  if (!text)
+    return string_format ("no such synth: %s", bsefile);
+  printout ("%s", text);
+  g_free (text);
+  return ""; // success
+}
+
+static CommandRegistry standard_synth_cmd (standard_synth_options, standard_synth, "standard-synth", 
"Display definition of standard synthesizers");
+
+
 // == render2wav ==
 static ArgDescription render2wav_options[] = {
   { "-s, --seconds", "<seconds>", "Number of seconds to record", "0" },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]