#include "utils.h"
#define PROG_HAS_PITCH 1
+#define PROG_HAS_OUTPUT 1
+#define PROG_HAS_JACK 1
#include "parse_args.h"
aubio_pitch_t *o;
aubio_pitch_do (o, ibuf, pitch);
smpl_t freq = fvec_read_sample(pitch, 0);
aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
- if (freq != 0.0) {
- aubio_wavetable_set_freq ( wavetable, freq );
- } else {
- aubio_wavetable_set_freq ( wavetable, 0.0 );
- }
- aubio_wavetable_do (wavetable, obuf, obuf);
+ aubio_wavetable_set_freq ( wavetable, freq );
+
+ if (mix_input)
+ aubio_wavetable_do (wavetable, ibuf, obuf);
+ else
+ aubio_wavetable_do (wavetable, obuf, obuf);
}
void
fprintf (stream,
" -h --help display this message\n"
" -v --verbose be verbose\n"
-#ifdef HAVE_JACK
+#ifdef PROG_HAS_JACK
" -j --jack use Jack\n"
#endif
" -i --input input type\n"
+#ifdef PROG_HAS_OUTPUT
" -o --output output type\n"
+#endif
" -r --samplerate select samplerate\n"
" -B --bufsize set buffer size\n"
" -H --hopsize set hopsize\n"
" -l --pitch-tolerance select pitch tolerance\n"
#endif /* PROG_HAS_PITCH */
" -s --silence select silence threshold\n"
+#ifdef PROG_HAS_OUTPUT
" -m --mix-input mix input signal with output signal\n"
+#endif
);
exit (exit_code);
}
parse_args (int argc, char **argv)
{
const char *options = "hv"
-#ifdef HAVE_JACK
+ "i:r:B:H:"
+#ifdef PROG_HAS_JACK
"j"
-#endif
- "i:o:r:B:H:"
+#endif /* PROG_HAS_JACK */
+#ifdef PROG_HAS_OUTPUT
+ "o:"
+#endif /* PROG_HAS_OUTPUT */
#ifdef PROG_HAS_ONSET
"O:t:"
#endif /* PROG_HAS_ONSET */
struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"verbose", 0, NULL, 'v'},
-#ifdef HAVE_JACK
- {"jack", 0, NULL, 'j'},
-#endif
{"input", 1, NULL, 'i'},
- {"output", 1, NULL, 'o'},
{"samplerate", 1, NULL, 'r'},
{"bufsize", 1, NULL, 'B'},
{"hopsize", 1, NULL, 'H'},
+#ifdef PROG_HAS_JACK
+ {"jack", 0, NULL, 'j'},
+#endif /* PROG_HAS_JACK */
+#ifdef PROG_HAS_OUTPUT
+ {"output", 1, NULL, 'o'},
+#endif /* PROG_HAS_OUTPUT */
#ifdef PROG_HAS_ONSET
{"onset", 1, NULL, 'O'},
{"onset-threshold", 1, NULL, 't'},
}
while (next_option != -1);
+ // if unique, use the non option argument as the source
if ( source_uri == NULL ) {
if (argc - optind == 1) {
source_uri = argv[optind];
usage ( stderr, 1 );
}
- if (source_uri != NULL) {
- debug ("Input file : %s\n", source_uri);
- } else if (source_uri != NULL && sink_uri != NULL) {
- debug ("Input file : %s\n", source_uri);
- debug ("Output file : %s\n", sink_uri);
- } else {
+ // if no source, show a message
+ if (source_uri == NULL) {
#if HAVE_JACK
- debug ("Jack input output\n");
+ verbmsg("No input source given, using jack\n");
usejack = 1;
#else
errmsg("Error: no arguments given (and no available audio input)\n");