diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_stuff.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/s_stuff.h | 430 |
1 files changed, 430 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_stuff.h b/apps/plugins/pdbox/PDa/src/s_stuff.h new file mode 100644 index 0000000000..6dc9a88c4b --- /dev/null +++ b/apps/plugins/pdbox/PDa/src/s_stuff.h | |||
@@ -0,0 +1,430 @@ | |||
1 | /* Copyright (c) 1997-1999 Miller Puckette. | ||
2 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
3 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ | ||
4 | |||
5 | /* Audio and MIDI I/O, and other scheduling and system stuff. */ | ||
6 | |||
7 | /* NOTE: this file describes Pd implementation details which may change | ||
8 | in future releases. The public (stable) API is in m_pd.h. */ | ||
9 | |||
10 | /* in s_file.c */ | ||
11 | typedef struct _namelist | ||
12 | { | ||
13 | struct _namelist *nl_next; | ||
14 | char *nl_string; | ||
15 | } t_namelist; | ||
16 | |||
17 | t_namelist *namelist_append(t_namelist *listwas, const char *s); | ||
18 | void namelist_free(t_namelist *listwas); | ||
19 | |||
20 | /* s_main.c */ | ||
21 | extern int sys_debuglevel; | ||
22 | extern int sys_verbose; | ||
23 | extern int sys_noloadbang; | ||
24 | extern int sys_nogui; | ||
25 | extern char *sys_guicmd; | ||
26 | |||
27 | EXTERN int sys_nearestfontsize(int fontsize); | ||
28 | EXTERN int sys_hostfontsize(int fontsize); | ||
29 | |||
30 | extern int sys_defaultfont; | ||
31 | extern t_symbol *sys_libdir; /* library directory for auxilliary files */ | ||
32 | |||
33 | /* s_loader.c */ | ||
34 | int sys_load_lib(char *dirname, char *filename); | ||
35 | |||
36 | /* s_audio.c */ | ||
37 | |||
38 | #define SENDDACS_NO 0 /* return values for sys_send_dacs() */ | ||
39 | #define SENDDACS_YES 1 | ||
40 | #define SENDDACS_SLEPT 2 | ||
41 | |||
42 | #define DEFDACBLKSIZE 64 | ||
43 | extern int sys_schedblocksize; /* audio block size for scheduler */ | ||
44 | extern int sys_hipriority; /* real-time flag, true if priority boosted */ | ||
45 | extern t_sample *sys_soundout; | ||
46 | extern t_sample *sys_soundin; | ||
47 | extern int sys_inchannels; | ||
48 | extern int sys_outchannels; | ||
49 | extern int sys_advance_samples; /* scheduler advance in samples */ | ||
50 | extern int sys_blocksize; /* audio I/O block size in sample frames */ | ||
51 | extern float sys_dacsr; | ||
52 | extern int sys_schedadvance; | ||
53 | extern int sys_sleepgrain; | ||
54 | void sys_open_audio(int naudioindev, int *audioindev, | ||
55 | int nchindev, int *chindev, | ||
56 | int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, | ||
57 | int srate, int advance, int enable); | ||
58 | void sys_close_audio(void); | ||
59 | |||
60 | /* s_midi.c */ | ||
61 | void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec); | ||
62 | |||
63 | /* implemented in the system dependent MIDI code (s_midi_pm.c, etc. ) */ | ||
64 | void sys_do_open_midi(int nmidiin, int *midiinvec, | ||
65 | int nmidiout, int *midioutvec); | ||
66 | void sys_close_midi(void); | ||
67 | void midi_getdevs(char *indevlist, int *nindevs, | ||
68 | char *outdevlist, int *noutdevs, int maxndev, int devdescsize); | ||
69 | |||
70 | int sys_send_dacs(void); | ||
71 | void sys_reportidle(void); | ||
72 | void sys_set_priority(int higher); | ||
73 | void sys_audiobuf(int nbufs); | ||
74 | void sys_getmeters(float *inmax, float *outmax); | ||
75 | void sys_listdevs(void); | ||
76 | void sys_setblocksize(int n); | ||
77 | |||
78 | /* s_midi.c */ | ||
79 | #define MAXMIDIINDEV 16 /* max. number of input ports */ | ||
80 | #define MAXMIDIOUTDEV 16 /* max. number of output ports */ | ||
81 | extern int sys_nmidiin; | ||
82 | extern int sys_nmidiout; | ||
83 | extern int sys_midiindevlist[]; | ||
84 | extern int sys_midioutdevlist[]; | ||
85 | |||
86 | EXTERN void sys_putmidimess(int portno, int a, int b, int c); | ||
87 | EXTERN void sys_putmidibyte(int portno, int a); | ||
88 | EXTERN void sys_poll_midi(void); | ||
89 | EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime); | ||
90 | EXTERN void sys_midibytein(int portno, int byte); | ||
91 | |||
92 | /* m_sched.c */ | ||
93 | EXTERN void sys_log_error(int type); | ||
94 | #define ERR_NOTHING 0 | ||
95 | #define ERR_ADCSLEPT 1 | ||
96 | #define ERR_DACSLEPT 2 | ||
97 | #define ERR_RESYNC 3 | ||
98 | #define ERR_DATALATE 4 | ||
99 | void sched_set_using_dacs(int flag); | ||
100 | |||
101 | /* s_inter.c */ | ||
102 | |||
103 | EXTERN void sys_microsleep(int microsec); | ||
104 | |||
105 | EXTERN void sys_bail(int exitcode); | ||
106 | EXTERN int sys_pollgui(void); | ||
107 | |||
108 | EXTERN_STRUCT _socketreceiver; | ||
109 | #define t_socketreceiver struct _socketreceiver | ||
110 | |||
111 | typedef void (*t_socketnotifier)(void *x); | ||
112 | typedef void (*t_socketreceivefn)(void *x, t_binbuf *b); | ||
113 | |||
114 | EXTERN t_socketreceiver *socketreceiver_new(void *owner, | ||
115 | t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp); | ||
116 | EXTERN void socketreceiver_read(t_socketreceiver *x, int fd); | ||
117 | EXTERN void sys_sockerror(char *s); | ||
118 | EXTERN void sys_closesocket(int fd); | ||
119 | |||
120 | typedef void (*t_fdpollfn)(void *ptr, int fd); | ||
121 | EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); | ||
122 | EXTERN void sys_rmpollfn(int fd); | ||
123 | #ifdef UNIX | ||
124 | void sys_setalarm(int microsec); | ||
125 | void sys_setvirtualalarm( void); | ||
126 | #endif | ||
127 | |||
128 | #define API_ALSA 1 | ||
129 | #define API_OSS 2 | ||
130 | #define API_MMIO 3 | ||
131 | #define API_PORTAUDIO 4 | ||
132 | #define API_JACK 5 | ||
133 | |||
134 | #ifdef __linux__ | ||
135 | #define API_DEFAULT API_OSS | ||
136 | #define API_DEFSTRING "OSS" | ||
137 | #endif | ||
138 | #ifdef MSW | ||
139 | #define API_DEFAULT API_MMIO | ||
140 | #define API_DEFSTRING "MMIO" | ||
141 | #endif | ||
142 | #ifdef MACOSX | ||
143 | #define API_DEFAULT API_PORTAUDIO | ||
144 | #define API_DEFSTRING "portaudio" | ||
145 | #endif | ||
146 | #define DEFAULTAUDIODEV 0 | ||
147 | |||
148 | #define MAXAUDIOINDEV 4 | ||
149 | #define MAXAUDIOOUTDEV 4 | ||
150 | |||
151 | #define DEFMIDIDEV 0 | ||
152 | |||
153 | #define DEFAULTSRATE 44100 | ||
154 | #ifdef MSW | ||
155 | #define DEFAULTADVANCE 70 | ||
156 | #else | ||
157 | #define DEFAULTADVANCE 50 | ||
158 | #endif | ||
159 | |||
160 | int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, | ||
161 | t_sample *soundout, int framesperbuf, int nbuffers, | ||
162 | int indeviceno, int outdeviceno); | ||
163 | void pa_close_audio(void); | ||
164 | int pa_send_dacs(void); | ||
165 | void sys_reportidle(void); | ||
166 | void pa_listdevs(void); | ||
167 | void pa_getdevs(char *indevlist, int *nindevs, | ||
168 | char *outdevlist, int *noutdevs, int *canmulti, | ||
169 | int maxndev, int devdescsize); | ||
170 | |||
171 | int oss_open_audio(int naudioindev, int *audioindev, int nchindev, | ||
172 | int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, | ||
173 | int *choutdev, int rate); /* IOhannes */ | ||
174 | void oss_close_audio(void); | ||
175 | int oss_send_dacs(void); | ||
176 | void oss_reportidle(void); | ||
177 | void oss_getdevs(char *indevlist, int *nindevs, | ||
178 | char *outdevlist, int *noutdevs, int *canmulti, | ||
179 | int maxndev, int devdescsize); | ||
180 | |||
181 | int alsa_open_audio(int naudioindev, int *audioindev, int nchindev, | ||
182 | int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, | ||
183 | int *choutdev, int rate); | ||
184 | void alsa_close_audio(void); | ||
185 | int alsa_send_dacs(void); | ||
186 | void alsa_reportidle(void); | ||
187 | void alsa_getdevs(char *indevlist, int *nindevs, | ||
188 | char *outdevlist, int *noutdevs, int *canmulti, | ||
189 | int maxndev, int devdescsize); | ||
190 | |||
191 | int jack_open_audio(int wantinchans, int wantoutchans, int srate); | ||
192 | void jack_close_audio(void); | ||
193 | int jack_send_dacs(void); | ||
194 | void jack_reportidle(void); | ||
195 | void jack_listdevs(void); | ||
196 | |||
197 | void mmio_open_audio(int naudioindev, int *audioindev, | ||
198 | int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, | ||
199 | int nchoutdev, int *choutdev, int rate); | ||
200 | void mmio_close_audio( void); | ||
201 | void mmio_reportidle(void); | ||
202 | int mmio_send_dacs(void); | ||
203 | void mmio_getdevs(char *indevlist, int *nindevs, | ||
204 | char *outdevlist, int *noutdevs, int *canmulti, | ||
205 | int maxndev, int devdescsize); | ||
206 | |||
207 | void sys_listmididevs(void); | ||
208 | void sys_set_audio_api(int whichapi); | ||
209 | void sys_get_audio_apis(char *buf); | ||
210 | extern int sys_audioapi; | ||
211 | void sys_set_audio_state(int onoff); | ||
212 | |||
213 | /* API dependent audio flags and settings */ | ||
214 | void oss_set32bit( void); | ||
215 | void linux_alsa_devname(char *devname); | ||
216 | /* Copyright (c) 1997-1999 Miller Puckette. | ||
217 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
218 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ | ||
219 | |||
220 | /* Audio and MIDI I/O, and other scheduling and system stuff. */ | ||
221 | |||
222 | /* NOTE: this file describes Pd implementation details which may change | ||
223 | in future releases. The public (stable) API is in m_pd.h. */ | ||
224 | |||
225 | /* in s_file.c */ | ||
226 | typedef struct _namelist | ||
227 | { | ||
228 | struct _namelist *nl_next; | ||
229 | char *nl_string; | ||
230 | } t_namelist; | ||
231 | |||
232 | t_namelist *namelist_append(t_namelist *listwas, const char *s); | ||
233 | void namelist_free(t_namelist *listwas); | ||
234 | |||
235 | /* s_main.c */ | ||
236 | extern int sys_debuglevel; | ||
237 | extern int sys_verbose; | ||
238 | extern int sys_noloadbang; | ||
239 | extern int sys_nogui; | ||
240 | extern char *sys_guicmd; | ||
241 | |||
242 | EXTERN int sys_nearestfontsize(int fontsize); | ||
243 | EXTERN int sys_hostfontsize(int fontsize); | ||
244 | |||
245 | extern int sys_defaultfont; | ||
246 | extern t_symbol *sys_libdir; /* library directory for auxilliary files */ | ||
247 | |||
248 | /* s_loader.c */ | ||
249 | int sys_load_lib(char *dirname, char *filename); | ||
250 | |||
251 | /* s_audio.c */ | ||
252 | |||
253 | #define SENDDACS_NO 0 /* return values for sys_send_dacs() */ | ||
254 | #define SENDDACS_YES 1 | ||
255 | #define SENDDACS_SLEPT 2 | ||
256 | |||
257 | #define DEFDACBLKSIZE 64 | ||
258 | extern int sys_schedblocksize; /* audio block size for scheduler */ | ||
259 | extern int sys_hipriority; /* real-time flag, true if priority boosted */ | ||
260 | extern t_sample *sys_soundout; | ||
261 | extern t_sample *sys_soundin; | ||
262 | extern int sys_inchannels; | ||
263 | extern int sys_outchannels; | ||
264 | extern int sys_advance_samples; /* scheduler advance in samples */ | ||
265 | extern int sys_blocksize; /* audio I/O block size in sample frames */ | ||
266 | extern float sys_dacsr; | ||
267 | extern int sys_schedadvance; | ||
268 | extern int sys_sleepgrain; | ||
269 | void sys_open_audio(int naudioindev, int *audioindev, | ||
270 | int nchindev, int *chindev, | ||
271 | int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, | ||
272 | int srate, int advance, int enable); | ||
273 | void sys_close_audio(void); | ||
274 | |||
275 | /* s_midi.c */ | ||
276 | void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec); | ||
277 | |||
278 | /* implemented in the system dependent MIDI code (s_midi_pm.c, etc. ) */ | ||
279 | void sys_do_open_midi(int nmidiin, int *midiinvec, | ||
280 | int nmidiout, int *midioutvec); | ||
281 | void sys_close_midi(void); | ||
282 | void midi_getdevs(char *indevlist, int *nindevs, | ||
283 | char *outdevlist, int *noutdevs, int maxndev, int devdescsize); | ||
284 | |||
285 | int sys_send_dacs(void); | ||
286 | void sys_reportidle(void); | ||
287 | void sys_set_priority(int higher); | ||
288 | void sys_audiobuf(int nbufs); | ||
289 | void sys_getmeters(float *inmax, float *outmax); | ||
290 | void sys_listdevs(void); | ||
291 | void sys_setblocksize(int n); | ||
292 | |||
293 | /* s_midi.c */ | ||
294 | #define MAXMIDIINDEV 16 /* max. number of input ports */ | ||
295 | #define MAXMIDIOUTDEV 16 /* max. number of output ports */ | ||
296 | extern int sys_nmidiin; | ||
297 | extern int sys_nmidiout; | ||
298 | extern int sys_midiindevlist[]; | ||
299 | extern int sys_midioutdevlist[]; | ||
300 | |||
301 | EXTERN void sys_putmidimess(int portno, int a, int b, int c); | ||
302 | EXTERN void sys_putmidibyte(int portno, int a); | ||
303 | EXTERN void sys_poll_midi(void); | ||
304 | EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime); | ||
305 | EXTERN void sys_midibytein(int portno, int byte); | ||
306 | |||
307 | /* m_sched.c */ | ||
308 | EXTERN void sys_log_error(int type); | ||
309 | #define ERR_NOTHING 0 | ||
310 | #define ERR_ADCSLEPT 1 | ||
311 | #define ERR_DACSLEPT 2 | ||
312 | #define ERR_RESYNC 3 | ||
313 | #define ERR_DATALATE 4 | ||
314 | void sched_set_using_dacs(int flag); | ||
315 | |||
316 | /* s_inter.c */ | ||
317 | |||
318 | EXTERN void sys_microsleep(int microsec); | ||
319 | |||
320 | EXTERN void sys_bail(int exitcode); | ||
321 | EXTERN int sys_pollgui(void); | ||
322 | |||
323 | EXTERN_STRUCT _socketreceiver; | ||
324 | #define t_socketreceiver struct _socketreceiver | ||
325 | |||
326 | typedef void (*t_socketnotifier)(void *x); | ||
327 | typedef void (*t_socketreceivefn)(void *x, t_binbuf *b); | ||
328 | |||
329 | EXTERN t_socketreceiver *socketreceiver_new(void *owner, | ||
330 | t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp); | ||
331 | EXTERN void socketreceiver_read(t_socketreceiver *x, int fd); | ||
332 | EXTERN void sys_sockerror(char *s); | ||
333 | EXTERN void sys_closesocket(int fd); | ||
334 | |||
335 | typedef void (*t_fdpollfn)(void *ptr, int fd); | ||
336 | EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); | ||
337 | EXTERN void sys_rmpollfn(int fd); | ||
338 | #ifdef UNIX | ||
339 | void sys_setalarm(int microsec); | ||
340 | void sys_setvirtualalarm( void); | ||
341 | #endif | ||
342 | |||
343 | #define API_ALSA 1 | ||
344 | #define API_OSS 2 | ||
345 | #define API_MMIO 3 | ||
346 | #define API_PORTAUDIO 4 | ||
347 | #define API_JACK 5 | ||
348 | |||
349 | #ifdef __linux__ | ||
350 | #define API_DEFAULT API_OSS | ||
351 | #define API_DEFSTRING "OSS" | ||
352 | #endif | ||
353 | #ifdef MSW | ||
354 | #define API_DEFAULT API_MMIO | ||
355 | #define API_DEFSTRING "MMIO" | ||
356 | #endif | ||
357 | #ifdef MACOSX | ||
358 | #define API_DEFAULT API_PORTAUDIO | ||
359 | #define API_DEFSTRING "portaudio" | ||
360 | #endif | ||
361 | #define DEFAULTAUDIODEV 0 | ||
362 | |||
363 | #define MAXAUDIOINDEV 4 | ||
364 | #define MAXAUDIOOUTDEV 4 | ||
365 | |||
366 | #define DEFMIDIDEV 0 | ||
367 | |||
368 | #define DEFAULTSRATE 44100 | ||
369 | #ifdef MSW | ||
370 | #define DEFAULTADVANCE 70 | ||
371 | #else | ||
372 | #define DEFAULTADVANCE 50 | ||
373 | #endif | ||
374 | |||
375 | int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, | ||
376 | t_sample *soundout, int framesperbuf, int nbuffers, | ||
377 | int indeviceno, int outdeviceno); | ||
378 | void pa_close_audio(void); | ||
379 | int pa_send_dacs(void); | ||
380 | void sys_reportidle(void); | ||
381 | void pa_listdevs(void); | ||
382 | void pa_getdevs(char *indevlist, int *nindevs, | ||
383 | char *outdevlist, int *noutdevs, int *canmulti, | ||
384 | int maxndev, int devdescsize); | ||
385 | |||
386 | int oss_open_audio(int naudioindev, int *audioindev, int nchindev, | ||
387 | int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, | ||
388 | int *choutdev, int rate); /* IOhannes */ | ||
389 | void oss_close_audio(void); | ||
390 | int oss_send_dacs(void); | ||
391 | void oss_reportidle(void); | ||
392 | void oss_getdevs(char *indevlist, int *nindevs, | ||
393 | char *outdevlist, int *noutdevs, int *canmulti, | ||
394 | int maxndev, int devdescsize); | ||
395 | |||
396 | int alsa_open_audio(int naudioindev, int *audioindev, int nchindev, | ||
397 | int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, | ||
398 | int *choutdev, int rate); | ||
399 | void alsa_close_audio(void); | ||
400 | int alsa_send_dacs(void); | ||
401 | void alsa_reportidle(void); | ||
402 | void alsa_getdevs(char *indevlist, int *nindevs, | ||
403 | char *outdevlist, int *noutdevs, int *canmulti, | ||
404 | int maxndev, int devdescsize); | ||
405 | |||
406 | int jack_open_audio(int wantinchans, int wantoutchans, int srate); | ||
407 | void jack_close_audio(void); | ||
408 | int jack_send_dacs(void); | ||
409 | void jack_reportidle(void); | ||
410 | void jack_listdevs(void); | ||
411 | |||
412 | void mmio_open_audio(int naudioindev, int *audioindev, | ||
413 | int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, | ||
414 | int nchoutdev, int *choutdev, int rate); | ||
415 | void mmio_close_audio( void); | ||
416 | void mmio_reportidle(void); | ||
417 | int mmio_send_dacs(void); | ||
418 | void mmio_getdevs(char *indevlist, int *nindevs, | ||
419 | char *outdevlist, int *noutdevs, int *canmulti, | ||
420 | int maxndev, int devdescsize); | ||
421 | |||
422 | void sys_listmididevs(void); | ||
423 | void sys_set_audio_api(int whichapi); | ||
424 | void sys_get_audio_apis(char *buf); | ||
425 | extern int sys_audioapi; | ||
426 | void sys_set_audio_state(int onoff); | ||
427 | |||
428 | /* API dependent audio flags and settings */ | ||
429 | void oss_set32bit( void); | ||
430 | void linux_alsa_devname(char *devname); | ||