ChangeLog: update for 0.4.3
[aubio.git] / examples / utils.h
1 /*
2   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
3
4   This file is part of aubio.
5
6   aubio is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   aubio is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include <aubio.h>
22
23 #include "config.h"
24
25 #ifdef HAVE_STDIO_H
26 #include <stdio.h>              // for fprintf
27 #endif
28 #ifdef HAVE_STDLIB_H
29 #include <stdlib.h>             // for exit
30 #endif
31 #ifdef HAVE_UNISTD_H
32 #include <unistd.h>             // for access
33 #elif defined(HAVE_WIN_HACKS)
34 #include <io.h>
35 #define access _access
36 #define F_OK   0
37 #endif
38 #ifdef HAVE_MATH_H
39 #include <math.h>               // for isfinite
40 #endif
41 #ifdef HAVE_STRING_H
42 #include <string.h>             // for strcmp
43 #endif
44
45 #ifdef HAVE_C99_VARARGS_MACROS
46 #ifdef HAVE_DEBUG
47 #define debug(...)                fprintf (stderr, __VA_ARGS__)
48 #else
49 #define debug(...)
50 #endif
51 #define verbmsg(...)              if (verbose) fprintf (stderr, __VA_ARGS__)
52 #define errmsg(...)               fprintf (stderr, __VA_ARGS__)
53 #define outmsg(...)               fprintf (stdout, __VA_ARGS__)
54 #else
55 #ifdef HAVE_DEBUG
56 #define debug(...)                fprintf (stderr, format , **args)
57 #else
58 #define debug(...)
59 #endif
60 #define verbmsg(format, args...)  if (verbose) fprintf(stderr, format , ##args)
61 #define errmsg(format, args...)   fprintf(stderr, format , ##args)
62 #define outmsg(format, args...)   fprintf(stdout, format , ##args)
63 #endif
64
65 typedef void (aubio_print_func_t) (void);
66 void send_noteon (smpl_t pitch, smpl_t velo);
67
68 /** common process function */
69 typedef int (*aubio_process_func_t) (fvec_t * input, fvec_t * output);
70
71 void process_block (fvec_t *ibuf, fvec_t *obuf);
72 void process_print (void);
73
74 void print_time (uint_t samples);