summaryrefslogtreecommitdiffstats
path: root/src/progs/ingen
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs/ingen')
-rw-r--r--src/progs/ingen/cmdline.c52
-rw-r--r--src/progs/ingen/cmdline.ggo3
-rw-r--r--src/progs/ingen/cmdline.h6
-rw-r--r--src/progs/ingen/main.cpp7
4 files changed, 57 insertions, 11 deletions
diff --git a/src/progs/ingen/cmdline.c b/src/progs/ingen/cmdline.c
index 462c6a3e..a293d127 100644
--- a/src/progs/ingen/cmdline.c
+++ b/src/progs/ingen/cmdline.c
@@ -1,7 +1,7 @@
/*
- File autogenerated by gengetopt version 2.20
+ File autogenerated by gengetopt
generated with the following command:
- gengetopt
+ gengetopt -g
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
@@ -36,8 +36,9 @@ const char *gengetopt_args_info_help[] = {
" -g, --gui Launch the GTK graphical interface (default=on)",
" -C, --client-port=INT Client OSC port",
" -l, --load=STRING Load patch",
- " -p, --path=STRING Target path for loaded patch",
+ " -L, --path=STRING Target path for loaded patch",
" -r, --run=STRING Run script",
+ " -p, --parallelism=INT Number of concurrent process threads (default=`1')",
0
};
@@ -66,6 +67,7 @@ void clear_given (struct gengetopt_args_info *args_info)
args_info->load_given = 0 ;
args_info->path_given = 0 ;
args_info->run_given = 0 ;
+ args_info->parallelism_given = 0 ;
}
static
@@ -84,6 +86,8 @@ void clear_args (struct gengetopt_args_info *args_info)
args_info->path_orig = NULL;
args_info->run_arg = NULL;
args_info->run_orig = NULL;
+ args_info->parallelism_arg = 1;
+ args_info->parallelism_orig = NULL;
}
@@ -100,6 +104,7 @@ void init_args_info(struct gengetopt_args_info *args_info)
args_info->load_help = gengetopt_args_info_help[7] ;
args_info->path_help = gengetopt_args_info_help[8] ;
args_info->run_help = gengetopt_args_info_help[9] ;
+ args_info->parallelism_help = gengetopt_args_info_help[10] ;
}
@@ -189,6 +194,11 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)
free (args_info->run_orig); /* free previous argument */
args_info->run_orig = 0;
}
+ if (args_info->parallelism_orig)
+ {
+ free (args_info->parallelism_orig); /* free previous argument */
+ args_info->parallelism_orig = 0;
+ }
clear_given (args_info);
}
@@ -261,6 +271,13 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_
fprintf(outfile, "%s\n", "run");
}
}
+ if (args_info->parallelism_given) {
+ if (args_info->parallelism_orig) {
+ fprintf(outfile, "%s=\"%s\"\n", "parallelism", args_info->parallelism_orig);
+ } else {
+ fprintf(outfile, "%s\n", "parallelism");
+ }
+ }
fclose (outfile);
@@ -351,13 +368,14 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
{ "gui", 0, NULL, 'g' },
{ "client-port", 1, NULL, 'C' },
{ "load", 1, NULL, 'l' },
- { "path", 1, NULL, 'p' },
+ { "path", 1, NULL, 'L' },
{ "run", 1, NULL, 'r' },
+ { "parallelism", 1, NULL, 'p' },
{ NULL, 0, NULL, 0 }
};
stop_char = 0;
- c = getopt_long (argc, argv, "hVeE:c:gC:l:p:r:", long_options, &option_index);
+ c = getopt_long (argc, argv, "hVeE:c:gC:l:L:r:p:", long_options, &option_index);
if (c == -1) break; /* Exit from `while (1)' loop. */
@@ -475,10 +493,10 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
args_info->load_orig = gengetopt_strdup (optarg);
break;
- case 'p': /* Target path for loaded patch. */
+ case 'L': /* Target path for loaded patch. */
if (local_args_info.path_given)
{
- fprintf (stderr, "%s: `--path' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
+ fprintf (stderr, "%s: `--path' (`-L') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
goto failure;
}
if (args_info->path_given && ! override)
@@ -511,6 +529,26 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
args_info->run_orig = gengetopt_strdup (optarg);
break;
+ case 'p': /* Number of concurrent process threads. */
+ if (local_args_info.parallelism_given)
+ {
+ fprintf (stderr, "%s: `--parallelism' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
+ goto failure;
+ }
+ if (args_info->parallelism_given && ! override)
+ continue;
+ local_args_info.parallelism_given = 1;
+ args_info->parallelism_given = 1;
+ args_info->parallelism_arg = strtol (optarg, &stop_char, 0);
+ if (!(stop_char && *stop_char == '\0')) {
+ fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
+ goto failure;
+ }
+ if (args_info->parallelism_orig)
+ free (args_info->parallelism_orig); /* free previous string */
+ args_info->parallelism_orig = gengetopt_strdup (optarg);
+ break;
+
case 0: /* Long option with no short option */
case '?': /* Invalid option. */
diff --git a/src/progs/ingen/cmdline.ggo b/src/progs/ingen/cmdline.ggo
index f844fa2d..480732e5 100644
--- a/src/progs/ingen/cmdline.ggo
+++ b/src/progs/ingen/cmdline.ggo
@@ -15,6 +15,7 @@ option "connect" c "Connect to existing engine at OSC URI" string no default="os
option "gui" g "Launch the GTK graphical interface" flag on
option "client-port" C "Client OSC port" int no
option "load" l "Load patch" string no
-option "path" p "Target path for loaded patch" string no
+option "path" L "Target path for loaded patch" string no
option "run" r "Run script" string no
+option "parallelism" p "Number of concurrent process threads" int no default="1"
diff --git a/src/progs/ingen/cmdline.h b/src/progs/ingen/cmdline.h
index d96f5adb..1c0bf681 100644
--- a/src/progs/ingen/cmdline.h
+++ b/src/progs/ingen/cmdline.h
@@ -1,6 +1,6 @@
/* cmdline.h */
-/* File autogenerated by gengetopt version 2.20 */
+/* File autogenerated by gengetopt */
#ifndef CMDLINE_H
#define CMDLINE_H
@@ -48,6 +48,9 @@ struct gengetopt_args_info
char * run_arg; /* Run script. */
char * run_orig; /* Run script original value given at command line. */
const char *run_help; /* Run script help description. */
+ int parallelism_arg; /* Number of concurrent process threads (default='1'). */
+ char * parallelism_orig; /* Number of concurrent process threads original value given at command line. */
+ const char *parallelism_help; /* Number of concurrent process threads help description. */
int help_given ; /* Whether help was given. */
int version_given ; /* Whether version was given. */
@@ -59,6 +62,7 @@ struct gengetopt_args_info
int load_given ; /* Whether load was given. */
int path_given ; /* Whether path was given. */
int run_given ; /* Whether run was given. */
+ int parallelism_given ; /* Whether parallelism was given. */
} ;
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index eb93407b..31453315 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -38,6 +38,7 @@
#include "bindings/ingen_bindings.hpp"
#endif
+
using namespace std;
using namespace Ingen;
@@ -136,7 +137,7 @@ main(int argc, char** argv)
engine->start_jack_driver();
- engine->activate();
+ engine->activate(args.parallelism_arg);
}
world->engine = engine_interface.get();
@@ -229,12 +230,14 @@ main(int argc, char** argv)
/* Listen to OSC and do our own main thing. */
} else if (engine && !ran_gui) {
+ size_t parallelism = args.parallelism_arg;
+
signal(SIGINT, catch_int);
signal(SIGTERM, catch_int);
engine->start_osc_driver(args.engine_port_arg);
engine->start_jack_driver();
- engine->activate();
+ engine->activate(parallelism);
engine->main();
}