-
Notifications
You must be signed in to change notification settings - Fork 24
/
audio.h
170 lines (155 loc) · 2.92 KB
/
audio.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include "file.h"
#include "config.h"
#include "common.h"
#define MAXLINE 44100
#define MAX_SOUNDS 512 // includes queue!
// not a hard limit, after this number sounds will start being
// culled (given ROUNDOFF samples to live to avoid
// discontinuities).
#define MAX_PLAYING 8
#define ROUNDOFF 16
#define MAX_DB 12
#ifdef JACK
#include <jack/jack.h>
#include "jack.h"
#define sampletime_t jack_nframes_t
#else
#define sampletime_t double
#endif
typedef struct {
float cutoff;
float res;
float f;
float k;
float p;
float scale;
float r;
float y1;
float y2;
float y3;
float y4;
float oldx;
float oldy1;
float oldy2;
float oldy3;
float x;
} t_vcf;
typedef struct {
int index;
float last;
float sum;
} t_crs;
typedef struct {
float samples[MAXLINE];
int point;
} t_line;
extern t_line* delays;
extern float line_feedback_delay;
typedef struct t_node {
int active;
int is_playing;
sampletime_t startT;
char samplename[MAXPATHSIZE+1];
int is_loop;
union {
t_sample *sample;
t_loop *loop;
};
unsigned int loop_start;
int channels;
float *items;
struct t_node *next, *prev;
float position;
float speed;
int reverse;
float pan;
float offset;
float start;
float end;
float velocity;
double **formant_history;
int formant_vowelnum;
float cutoff;
float resonance;
t_vcf *vcf;
float accelerate;
int shape;
float shape_k;
int kriole_chunk;
int is_kriole;
int started;
int checks;
float delay;
float delaytime;
float delayfeedback;
float gain;
int cutgroup;
int mono;
int crush;
float crush_bits;
int coarse;
t_crs *coarsef;
float hcutoff;
float hresonance;
t_vcf *hpf;
float bandf;
float bandq;
t_vcf *bpf;
int sample_loop;
int cut_continue;
char unit;
float cps;
double when;
float attack;
float hold;
float release;
float playtime;
int orbit;
int played;
} t_sound;
typedef struct {
double when;
float cps;
char *samplename;
float start;
float end;
float speed;
float pan;
float velocity;
int vowelnum;
float cutoff;
float resonance;
float accelerate;
float shape;
int kriole_chunk;
float gain;
int cutgroup;
float delay;
float delaytime;
float delayfeedback;
float crush;
int coarse;
float hcutoff;
float hresonance;
float bandf;
float bandq;
char unit;
int sample_loop;
int sample_n;
float attack;
float hold;
float release;
} t_play_args;
#ifdef SEND_RMS
typedef struct {
int n;
float sum;
float squares[RMS_SZ];
float sum_of_squares;
} t_rms;
#endif
extern int audio_callback(int frames, float *input, float **outputs);
extern void audio_init(bool dirty_compressor, bool autoconnect, bool late_trigger, unsigned int num_workers, char *sampleroot, bool shape_gain_comp, bool preload_flag);
extern void audio_close(void);
extern int audio_play(t_sound*);
t_sound *new_sound();