summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/extra/s_stuff.h
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-05-22 21:58:48 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-05-22 21:58:48 +0000
commit513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch)
tree10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/extra/s_stuff.h
parent95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff)
downloadrockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz
rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/s_stuff.h')
-rw-r--r--apps/plugins/pdbox/PDa/extra/s_stuff.h430
1 files changed, 430 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/s_stuff.h b/apps/plugins/pdbox/PDa/extra/s_stuff.h
new file mode 100644
index 0000000000..6dc9a88c4b
--- /dev/null
+++ b/apps/plugins/pdbox/PDa/extra/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
8in future releases. The public (stable) API is in m_pd.h. */
9
10/* in s_file.c */
11typedef struct _namelist
12{
13 struct _namelist *nl_next;
14 char *nl_string;
15} t_namelist;
16
17t_namelist *namelist_append(t_namelist *listwas, const char *s);
18void namelist_free(t_namelist *listwas);
19
20/* s_main.c */
21extern int sys_debuglevel;
22extern int sys_verbose;
23extern int sys_noloadbang;
24extern int sys_nogui;
25extern char *sys_guicmd;
26
27EXTERN int sys_nearestfontsize(int fontsize);
28EXTERN int sys_hostfontsize(int fontsize);
29
30extern int sys_defaultfont;
31extern t_symbol *sys_libdir; /* library directory for auxilliary files */
32
33/* s_loader.c */
34int 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
43extern int sys_schedblocksize; /* audio block size for scheduler */
44extern int sys_hipriority; /* real-time flag, true if priority boosted */
45extern t_sample *sys_soundout;
46extern t_sample *sys_soundin;
47extern int sys_inchannels;
48extern int sys_outchannels;
49extern int sys_advance_samples; /* scheduler advance in samples */
50extern int sys_blocksize; /* audio I/O block size in sample frames */
51extern float sys_dacsr;
52extern int sys_schedadvance;
53extern int sys_sleepgrain;
54void 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);
58void sys_close_audio(void);
59
60 /* s_midi.c */
61void 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. ) */
64void sys_do_open_midi(int nmidiin, int *midiinvec,
65 int nmidiout, int *midioutvec);
66void sys_close_midi(void);
67void midi_getdevs(char *indevlist, int *nindevs,
68 char *outdevlist, int *noutdevs, int maxndev, int devdescsize);
69
70int sys_send_dacs(void);
71void sys_reportidle(void);
72void sys_set_priority(int higher);
73void sys_audiobuf(int nbufs);
74void sys_getmeters(float *inmax, float *outmax);
75void sys_listdevs(void);
76void 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 */
81extern int sys_nmidiin;
82extern int sys_nmidiout;
83extern int sys_midiindevlist[];
84extern int sys_midioutdevlist[];
85
86EXTERN void sys_putmidimess(int portno, int a, int b, int c);
87EXTERN void sys_putmidibyte(int portno, int a);
88EXTERN void sys_poll_midi(void);
89EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime);
90EXTERN void sys_midibytein(int portno, int byte);
91
92/* m_sched.c */
93EXTERN 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
99void sched_set_using_dacs(int flag);
100
101/* s_inter.c */
102
103EXTERN void sys_microsleep(int microsec);
104
105EXTERN void sys_bail(int exitcode);
106EXTERN int sys_pollgui(void);
107
108EXTERN_STRUCT _socketreceiver;
109#define t_socketreceiver struct _socketreceiver
110
111typedef void (*t_socketnotifier)(void *x);
112typedef void (*t_socketreceivefn)(void *x, t_binbuf *b);
113
114EXTERN t_socketreceiver *socketreceiver_new(void *owner,
115 t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp);
116EXTERN void socketreceiver_read(t_socketreceiver *x, int fd);
117EXTERN void sys_sockerror(char *s);
118EXTERN void sys_closesocket(int fd);
119
120typedef void (*t_fdpollfn)(void *ptr, int fd);
121EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
122EXTERN void sys_rmpollfn(int fd);
123#ifdef UNIX
124void sys_setalarm(int microsec);
125void 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
160int 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);
163void pa_close_audio(void);
164int pa_send_dacs(void);
165void sys_reportidle(void);
166void pa_listdevs(void);
167void pa_getdevs(char *indevlist, int *nindevs,
168 char *outdevlist, int *noutdevs, int *canmulti,
169 int maxndev, int devdescsize);
170
171int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
172 int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
173 int *choutdev, int rate); /* IOhannes */
174void oss_close_audio(void);
175int oss_send_dacs(void);
176void oss_reportidle(void);
177void oss_getdevs(char *indevlist, int *nindevs,
178 char *outdevlist, int *noutdevs, int *canmulti,
179 int maxndev, int devdescsize);
180
181int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
182 int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
183 int *choutdev, int rate);
184void alsa_close_audio(void);
185int alsa_send_dacs(void);
186void alsa_reportidle(void);
187void alsa_getdevs(char *indevlist, int *nindevs,
188 char *outdevlist, int *noutdevs, int *canmulti,
189 int maxndev, int devdescsize);
190
191int jack_open_audio(int wantinchans, int wantoutchans, int srate);
192void jack_close_audio(void);
193int jack_send_dacs(void);
194void jack_reportidle(void);
195void jack_listdevs(void);
196
197void mmio_open_audio(int naudioindev, int *audioindev,
198 int nchindev, int *chindev, int naudiooutdev, int *audiooutdev,
199 int nchoutdev, int *choutdev, int rate);
200void mmio_close_audio( void);
201void mmio_reportidle(void);
202int mmio_send_dacs(void);
203void mmio_getdevs(char *indevlist, int *nindevs,
204 char *outdevlist, int *noutdevs, int *canmulti,
205 int maxndev, int devdescsize);
206
207void sys_listmididevs(void);
208void sys_set_audio_api(int whichapi);
209void sys_get_audio_apis(char *buf);
210extern int sys_audioapi;
211void sys_set_audio_state(int onoff);
212
213/* API dependent audio flags and settings */
214void oss_set32bit( void);
215void 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
223in future releases. The public (stable) API is in m_pd.h. */
224
225/* in s_file.c */
226typedef struct _namelist
227{
228 struct _namelist *nl_next;
229 char *nl_string;
230} t_namelist;
231
232t_namelist *namelist_append(t_namelist *listwas, const char *s);
233void namelist_free(t_namelist *listwas);
234
235/* s_main.c */
236extern int sys_debuglevel;
237extern int sys_verbose;
238extern int sys_noloadbang;
239extern int sys_nogui;
240extern char *sys_guicmd;
241
242EXTERN int sys_nearestfontsize(int fontsize);
243EXTERN int sys_hostfontsize(int fontsize);
244
245extern int sys_defaultfont;
246extern t_symbol *sys_libdir; /* library directory for auxilliary files */
247
248/* s_loader.c */
249int 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
258extern int sys_schedblocksize; /* audio block size for scheduler */
259extern int sys_hipriority; /* real-time flag, true if priority boosted */
260extern t_sample *sys_soundout;
261extern t_sample *sys_soundin;
262extern int sys_inchannels;
263extern int sys_outchannels;
264extern int sys_advance_samples; /* scheduler advance in samples */
265extern int sys_blocksize; /* audio I/O block size in sample frames */
266extern float sys_dacsr;
267extern int sys_schedadvance;
268extern int sys_sleepgrain;
269void 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);
273void sys_close_audio(void);
274
275 /* s_midi.c */
276void 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. ) */
279void sys_do_open_midi(int nmidiin, int *midiinvec,
280 int nmidiout, int *midioutvec);
281void sys_close_midi(void);
282void midi_getdevs(char *indevlist, int *nindevs,
283 char *outdevlist, int *noutdevs, int maxndev, int devdescsize);
284
285int sys_send_dacs(void);
286void sys_reportidle(void);
287void sys_set_priority(int higher);
288void sys_audiobuf(int nbufs);
289void sys_getmeters(float *inmax, float *outmax);
290void sys_listdevs(void);
291void 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 */
296extern int sys_nmidiin;
297extern int sys_nmidiout;
298extern int sys_midiindevlist[];
299extern int sys_midioutdevlist[];
300
301EXTERN void sys_putmidimess(int portno, int a, int b, int c);
302EXTERN void sys_putmidibyte(int portno, int a);
303EXTERN void sys_poll_midi(void);
304EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime);
305EXTERN void sys_midibytein(int portno, int byte);
306
307/* m_sched.c */
308EXTERN 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
314void sched_set_using_dacs(int flag);
315
316/* s_inter.c */
317
318EXTERN void sys_microsleep(int microsec);
319
320EXTERN void sys_bail(int exitcode);
321EXTERN int sys_pollgui(void);
322
323EXTERN_STRUCT _socketreceiver;
324#define t_socketreceiver struct _socketreceiver
325
326typedef void (*t_socketnotifier)(void *x);
327typedef void (*t_socketreceivefn)(void *x, t_binbuf *b);
328
329EXTERN t_socketreceiver *socketreceiver_new(void *owner,
330 t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp);
331EXTERN void socketreceiver_read(t_socketreceiver *x, int fd);
332EXTERN void sys_sockerror(char *s);
333EXTERN void sys_closesocket(int fd);
334
335typedef void (*t_fdpollfn)(void *ptr, int fd);
336EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
337EXTERN void sys_rmpollfn(int fd);
338#ifdef UNIX
339void sys_setalarm(int microsec);
340void 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
375int 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);
378void pa_close_audio(void);
379int pa_send_dacs(void);
380void sys_reportidle(void);
381void pa_listdevs(void);
382void pa_getdevs(char *indevlist, int *nindevs,
383 char *outdevlist, int *noutdevs, int *canmulti,
384 int maxndev, int devdescsize);
385
386int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
387 int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
388 int *choutdev, int rate); /* IOhannes */
389void oss_close_audio(void);
390int oss_send_dacs(void);
391void oss_reportidle(void);
392void oss_getdevs(char *indevlist, int *nindevs,
393 char *outdevlist, int *noutdevs, int *canmulti,
394 int maxndev, int devdescsize);
395
396int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
397 int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
398 int *choutdev, int rate);
399void alsa_close_audio(void);
400int alsa_send_dacs(void);
401void alsa_reportidle(void);
402void alsa_getdevs(char *indevlist, int *nindevs,
403 char *outdevlist, int *noutdevs, int *canmulti,
404 int maxndev, int devdescsize);
405
406int jack_open_audio(int wantinchans, int wantoutchans, int srate);
407void jack_close_audio(void);
408int jack_send_dacs(void);
409void jack_reportidle(void);
410void jack_listdevs(void);
411
412void mmio_open_audio(int naudioindev, int *audioindev,
413 int nchindev, int *chindev, int naudiooutdev, int *audiooutdev,
414 int nchoutdev, int *choutdev, int rate);
415void mmio_close_audio( void);
416void mmio_reportidle(void);
417int mmio_send_dacs(void);
418void mmio_getdevs(char *indevlist, int *nindevs,
419 char *outdevlist, int *noutdevs, int *canmulti,
420 int maxndev, int devdescsize);
421
422void sys_listmididevs(void);
423void sys_set_audio_api(int whichapi);
424void sys_get_audio_apis(char *buf);
425extern int sys_audioapi;
426void sys_set_audio_state(int onoff);
427
428/* API dependent audio flags and settings */
429void oss_set32bit( void);
430void linux_alsa_devname(char *devname);