projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
466dff3
)
examples/: remove -o and -j when unused
author
Paul Brossier
<piem@piem.org>
Sat, 7 Dec 2013 04:22:21 +0000
(23:22 -0500)
committer
Paul Brossier
<piem@piem.org>
Sat, 7 Dec 2013 04:22:21 +0000
(23:22 -0500)
examples/aubionotes.c
patch
|
blob
|
history
examples/aubioonset.c
patch
|
blob
|
history
examples/aubiopitch.c
patch
|
blob
|
history
examples/aubiotrack.c
patch
|
blob
|
history
examples/parse_args.h
patch
|
blob
|
history
examples/utils.c
patch
|
blob
|
history
diff --git
a/examples/aubionotes.c
b/examples/aubionotes.c
index
0aafabf
..
dc57ce8
100644
(file)
--- a/
examples/aubionotes.c
+++ b/
examples/aubionotes.c
@@
-22,6
+22,8
@@
#include "utils.h"
#define PROG_HAS_PITCH 1
#define PROG_HAS_ONSET 1
#include "utils.h"
#define PROG_HAS_PITCH 1
#define PROG_HAS_ONSET 1
+#define PROG_HAS_JACK 1
+// TODO add PROG_HAS_OUTPUT
#include "parse_args.h"
uint_t median = 6;
#include "parse_args.h"
uint_t median = 6;
diff --git
a/examples/aubioonset.c
b/examples/aubioonset.c
index
7a80acc
..
d8c7987
100644
(file)
--- a/
examples/aubioonset.c
+++ b/
examples/aubioonset.c
@@
-20,6
+20,8
@@
#include "utils.h"
#define PROG_HAS_ONSET 1
#include "utils.h"
#define PROG_HAS_ONSET 1
+#define PROG_HAS_OUTPUT 1
+#define PROG_HAS_JACK 1
#include "parse_args.h"
aubio_onset_t *o;
#include "parse_args.h"
aubio_onset_t *o;
@@
-35,7
+37,10
@@
process_block(fvec_t *ibuf, fvec_t *obuf) {
} else {
aubio_wavetable_stop ( wavetable );
}
} else {
aubio_wavetable_stop ( wavetable );
}
- aubio_wavetable_do (wavetable, obuf, obuf);
+ if (mix_input)
+ aubio_wavetable_do (wavetable, ibuf, obuf);
+ else
+ aubio_wavetable_do (wavetable, obuf, obuf);
}
void
}
void
diff --git
a/examples/aubiopitch.c
b/examples/aubiopitch.c
index
dd615bd
..
cf10bab
100644
(file)
--- a/
examples/aubiopitch.c
+++ b/
examples/aubiopitch.c
@@
-20,6
+20,8
@@
#include "utils.h"
#define PROG_HAS_PITCH 1
#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;
#include "parse_args.h"
aubio_pitch_t *o;
@@
-32,12
+34,12
@@
process_block(fvec_t * ibuf, fvec_t * obuf) {
aubio_pitch_do (o, ibuf, pitch);
smpl_t freq = fvec_read_sample(pitch, 0);
aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
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
}
void
diff --git
a/examples/aubiotrack.c
b/examples/aubiotrack.c
index
b862c2b
..
48d4cdc
100644
(file)
--- a/
examples/aubiotrack.c
+++ b/
examples/aubiotrack.c
@@
-20,6
+20,8
@@
#include "utils.h"
#define PROG_HAS_TEMPO 1
#include "utils.h"
#define PROG_HAS_TEMPO 1
+#define PROG_HAS_OUTPUT 1
+#define PROG_HAS_JACK 1
#include "parse_args.h"
aubio_tempo_t * tempo;
#include "parse_args.h"
aubio_tempo_t * tempo;
@@
-38,7
+40,10
@@
void process_block(fvec_t * ibuf, fvec_t *obuf) {
} else {
aubio_wavetable_stop ( wavetable );
}
} else {
aubio_wavetable_stop ( wavetable );
}
- aubio_wavetable_do (wavetable, obuf, obuf);
+ if (mix_input)
+ aubio_wavetable_do (wavetable, ibuf, obuf);
+ else
+ aubio_wavetable_do (wavetable, obuf, obuf);
}
void process_print (void) {
}
void process_print (void) {
diff --git
a/examples/parse_args.h
b/examples/parse_args.h
index
003f32f
..
d016dd1
100644
(file)
--- a/
examples/parse_args.h
+++ b/
examples/parse_args.h
@@
-62,11
+62,13
@@
usage (FILE * stream, int exit_code)
fprintf (stream,
" -h --help display this message\n"
" -v --verbose be verbose\n"
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"
" -j --jack use Jack\n"
#endif
" -i --input input type\n"
+#ifdef PROG_HAS_OUTPUT
" -o --output output type\n"
" -o --output output type\n"
+#endif
" -r --samplerate select samplerate\n"
" -B --bufsize set buffer size\n"
" -H --hopsize set hopsize\n"
" -r --samplerate select samplerate\n"
" -B --bufsize set buffer size\n"
" -H --hopsize set hopsize\n"
@@
-80,7
+82,9
@@
usage (FILE * stream, int exit_code)
" -l --pitch-tolerance select pitch tolerance\n"
#endif /* PROG_HAS_PITCH */
" -s --silence select silence threshold\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"
" -m --mix-input mix input signal with output signal\n"
+#endif
);
exit (exit_code);
}
);
exit (exit_code);
}
@@
-89,10
+93,13
@@
int
parse_args (int argc, char **argv)
{
const char *options = "hv"
parse_args (int argc, char **argv)
{
const char *options = "hv"
-#ifdef HAVE_JACK
+ "i:r:B:H:"
+#ifdef PROG_HAS_JACK
"j"
"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 */
#ifdef PROG_HAS_ONSET
"O:t:"
#endif /* PROG_HAS_ONSET */
@@
-104,14
+111,16
@@
parse_args (int argc, char **argv)
struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"verbose", 0, NULL, 'v'},
struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"verbose", 0, NULL, 'v'},
-#ifdef HAVE_JACK
- {"jack", 0, NULL, 'j'},
-#endif
{"input", 1, NULL, 'i'},
{"input", 1, NULL, 'i'},
- {"output", 1, NULL, 'o'},
{"samplerate", 1, NULL, 'r'},
{"bufsize", 1, NULL, 'B'},
{"hopsize", 1, NULL, 'H'},
{"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'},
#ifdef PROG_HAS_ONSET
{"onset", 1, NULL, 'O'},
{"onset-threshold", 1, NULL, 't'},
@@
-190,6
+199,7
@@
parse_args (int argc, char **argv)
}
while (next_option != -1);
}
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];
if ( source_uri == NULL ) {
if (argc - optind == 1) {
source_uri = argv[optind];
@@
-202,14
+212,10
@@
parse_args (int argc, char **argv)
usage ( stderr, 1 );
}
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
#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");
usejack = 1;
#else
errmsg("Error: no arguments given (and no available audio input)\n");
diff --git
a/examples/utils.c
b/examples/utils.c
index
f014f85
..
a3a7277
100644
(file)
--- a/
examples/utils.c
+++ b/
examples/utils.c
@@
-185,9
+185,9
@@
send_noteon (int pitch, int velo)
} else
#endif
if (velo == 0) {
} else
#endif
if (velo == 0) {
-
out
msg ("%f\n", blocks * hop_size / (float) samplerate);
+
verb
msg ("%f\n", blocks * hop_size / (float) samplerate);
} else {
} else {
-
out
msg ("%f\t%f\t", mpitch, blocks * hop_size / (float) samplerate);
+
verb
msg ("%f\t%f\t", mpitch, blocks * hop_size / (float) samplerate);
}
}
}
}