summaryrefslogtreecommitdiff
path: root/drumgizmo
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-02-25 20:53:48 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-02-25 20:53:48 +0100
commitb74eca322abf8d8f6c0eaa4f016f4f9d86c66193 (patch)
treeecde081da34e80882766e13c5c9b22c57cad48d4 /drumgizmo
parentb0cce43add8a29b64d097a95ad7da4624b5b27b6 (diff)
Add hugin filters to command line tool.
Diffstat (limited to 'drumgizmo')
-rw-r--r--drumgizmo/Makefile.am8
-rw-r--r--drumgizmo/drumgizmoc.cc39
2 files changed, 41 insertions, 6 deletions
diff --git a/drumgizmo/Makefile.am b/drumgizmo/Makefile.am
index 5220ae3..137ea7b 100644
--- a/drumgizmo/Makefile.am
+++ b/drumgizmo/Makefile.am
@@ -12,17 +12,21 @@ drumgizmo_LDADD = $(DRUMGIZMO_LIBS) $(PTHREAD_LIBS) -ldl $(JACK_LIBS)
drumgizmo_CXXFLAGS = $(SNDFILE_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) \
-I$(top_srcdir)/include -I$(top_srcdir)/src \
- -I$(top_srcdir)/hugin -DWITH_HUG_MUTEX $(JACK_CFLAGS) $(SSEFLAGS) \
+ -I$(top_srcdir)/hugin -DWITH_HUG_MUTEX -DWITH_HUG_FILTER \
+ $(JACK_CFLAGS) $(SSEFLAGS) \
-DINPUT_PLUGIN_DIR=\"${INPUT_PLUGIN_DIR}\" \
-DOUTPUT_PLUGIN_DIR=\"${OUTPUT_PLUGIN_DIR}\"
+drumgizmo_CFLAGS = -DWITH_HUG_MUTEX -DWITH_HUG_FILTER
+
drumgizmo_SOURCES = \
audioinputenginedl.cc \
audiooutputenginedl.cc \
drumgizmoc.cc \
jackclient.cc \
$(DRUMGIZMO_SOURCES) \
- $(top_srcdir)/hugin/hugin.c
+ $(top_srcdir)/hugin/hugin.c \
+ $(top_srcdir)/hugin/hugin_filter.c
EXTRA_DIST = \
audioinputenginedl.h \
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index 9c5b51c..2532130 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <unistd.h>
+#include <hugin.hpp>
+
#include "drumgizmo.h"
#include "drumgizmoc.h"
@@ -62,6 +64,9 @@ static const char usage_str[] =
" -o, --outputengine dummy|alsa|jackaudio|wavfile Use said audio output engine.\n"
" -O, --outputparms parmlist Set output engine parameters.\n"
" -e, --endpos Number of samples to process, -1: infinite.\n"
+#ifndef DISABLE_HUGIN
+" -D, --debug ddd Enable debug messages on 'ddd'; see hugin documentation for details\n"
+#endif/*DISABLE_HUGIN*/
" -v, --version Print version information and exit.\n"
" -h, --help Print this message and exit.\n"
"\n"
@@ -113,6 +118,9 @@ int CliMain::run(int argc, char *argv[])
{
int c;
+ const char *hugin_filter = "+all";
+ unsigned int hugin_flags = HUG_FLAG_OUTPUT_TO_STDOUT;
+
std::string outputengine;
std::string inputengine;
std::string iparms;
@@ -129,12 +137,19 @@ int CliMain::run(int argc, char *argv[])
{"outputengine", required_argument, 0, 'o'},
{"outputparms", required_argument, 0, 'O'},
{"endpos", required_argument, 0, 'e'},
+#ifndef DISABLE_HUGIN
+ {"debug", required_argument, 0, 'D'},
+#endif/*DISABLE_HUGIN*/
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "hvpo:O:i:I:e:a", long_options, &option_index);
+ c = getopt_long(argc, argv, "hvpo:O:i:I:e:a"
+#ifndef DISABLE_HUGIN
+ "D:"
+#endif/*DISABLE_HUGIN*/
+ , long_options, &option_index);
if (c == -1)
break;
@@ -148,6 +163,13 @@ int CliMain::run(int argc, char *argv[])
}
break;
+#ifndef DISABLE_HUGIN
+ case 'D':
+ hugin_flags |= HUG_FLAG_USE_FILTER;
+ hugin_filter = optarg;
+ break;
+#endif/*DISABLE_HUGIN*/
+
case 'I':
iparms = optarg;
break;
@@ -188,6 +210,14 @@ int CliMain::run(int argc, char *argv[])
}
}
+ hug_status_t status = hug_init(hugin_flags,
+ HUG_OPTION_FILTER, hugin_filter,
+ HUG_OPTION_END);
+ if(status != HUG_STATUS_OK) {
+ printf("Error: %d\n", status);
+ return 1;
+ }
+
if(inputengine == "") {
printf("Missing input engine\n");
return 1;
@@ -269,10 +299,9 @@ int CliMain::run(int argc, char *argv[])
std::string kitfile;
if(option_index < argc) {
- printf("non-option ARGV-elements: ");
while (optind < argc) {
if(kitfile != "") {
- fprintf(stderr, "Can only handle a single kitfile.\n");
+ printf("Can only handle a single kitfile.\n");
printf(usage_str, argv[0]);
return 1;
}
@@ -280,7 +309,7 @@ int CliMain::run(int argc, char *argv[])
}
printf("\n");
} else {
- fprintf(stderr, "Missing kitfile.\n");
+ printf("Missing kitfile.\n");
printf(usage_str, argv[0]);
return 1;
}
@@ -323,6 +352,8 @@ int CliMain::run(int argc, char *argv[])
delete oe;
delete ie;
+ hug_close();
+
return 0;
}