/*
- Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
This file is part of aubio.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <math.h> /* for isfinite */
-#include <string.h> /* for strcmp */
#include <aubio.h>
+
#include "config.h"
-#include "sndfileio.h"
-#ifdef HAVE_JACK
-#include "jackio.h"
-#endif /* HAVE_JACK */
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h> // for fprintf
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h> // for exit
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> // for access
+#elif defined(HAVE_WIN_HACKS)
+#include <io.h>
+#define access _access
+#define F_OK 0
+#endif
+#ifdef HAVE_MATH_H
+#include <math.h> // for isfinite
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h> // for strcmp
+#endif
#ifdef HAVE_C99_VARARGS_MACROS
-#define debug(...) if (verbose) fprintf (stderr, __VA_ARGS__)
-#define errmsg(...) fprintf (stderr, __VA_ARGS__)
-#define outmsg(...) fprintf (stdout, __VA_ARGS__)
+#ifdef HAVE_DEBUG
+#define debug(...) fprintf (stderr, __VA_ARGS__)
#else
-#define debug(format, args...) if (verbose) fprintf(stderr, format , ##args)
-#define errmsg(format, args...) fprintf(stderr, format , ##args)
-#define outmsg(format, args...) fprintf(stdout, format , ##args)
+#define debug(...)
#endif
-
-
-extern int frames;
-extern int verbose;
-extern int usejack;
-extern int frames_delay;
-/* defined in utils.c */
-void usage (FILE * stream, int exit_code);
-int parse_args (int argc, char **argv);
-void examples_common_init (int argc, char **argv);
-void examples_common_del (void);
-typedef void (aubio_print_func_t) (void);
-#ifndef HAVE_JACK
-typedef int (*aubio_process_func_t)
- (smpl_t ** input, smpl_t ** output, int nframes);
+#define verbmsg(...) if (verbose) fprintf (stderr, __VA_ARGS__)
+#define errmsg(...) fprintf (stderr, __VA_ARGS__)
+#define outmsg(...) fprintf (stdout, __VA_ARGS__)
+#else
+#ifdef HAVE_DEBUG
+#define debug(...) fprintf (stderr, format , **args)
+#else
+#define debug(...)
+#endif
+#define verbmsg(format, args...) if (verbose) fprintf(stderr, format , ##args)
+#define errmsg(format, args...) fprintf(stderr, format , ##args)
+#define outmsg(format, args...) fprintf(stdout, format , ##args)
#endif
-void examples_common_process (aubio_process_func_t process_func,
- aubio_print_func_t print);
-extern char_t * pitch_unit;
-extern char_t * pitch_mode;
+typedef void (aubio_print_func_t) (void);
+void send_noteon (smpl_t pitch, smpl_t velo);
-void send_noteon (int pitch, int velo);
+/** common process function */
+typedef void (*aubio_process_func_t) (fvec_t * input, fvec_t * output);
-extern const char *output_filename;
-extern char_t * onset_mode;
-extern smpl_t threshold;
-extern smpl_t silence;
-extern int verbose;
-extern int usejack;
-extern uint_t buffer_size;
-extern uint_t overlap_size;
-extern uint_t samplerate;
+void process_block (fvec_t *ibuf, fvec_t *obuf);
+void process_print (void);
-extern fvec_t *ibuf;
-extern fvec_t *obuf;
-extern fvec_t *woodblock;
+void print_time (uint_t samples);