-
Notifications
You must be signed in to change notification settings - Fork 31
/
dsp.h
56 lines (47 loc) · 1.64 KB
/
dsp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* This file is part of dsp.
*
* Copyright (c) 2013-2024 Michael Barbour <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef DSP_DSP_H
#define DSP_DSP_H
#include <stdio.h>
#include <sys/types.h>
enum {
LL_SILENT = 0,
LL_ERROR,
LL_OPEN_ERROR,
LL_NORMAL,
LL_VERBOSE,
};
#define LOGLEVEL(l) (dsp_globals.loglevel >= (l))
#define LOG_FMT(l, fmt, ...) do { if (LOGLEVEL(l)) dsp_log_printf("%s: " fmt "\n", dsp_globals.prog_name, __VA_ARGS__); } while (0)
#define LOG_S(l, s) do { if (LOGLEVEL(l)) dsp_log_printf("%s: %s\n", dsp_globals.prog_name, s); } while (0)
#define DEFAULT_FS 44100
#define DEFAULT_CHANNELS 1
#define DEFAULT_BLOCK_FRAMES 2048
#define DEFAULT_BUF_RATIO 32
#define BIT_PERFECT 1
typedef double sample_t;
struct dsp_globals {
int loglevel;
const char *prog_name;
};
struct stream_info {
int fs, channels;
};
extern struct dsp_globals dsp_globals;
extern int dsp_log_printf(const char *, ...);
#endif