giuliomoro@230
|
1 /*
|
giuliomoro@230
|
2 * Copyright (c) 2010 Peter Brinkmann (peter.brinkmann@gmail.com)
|
giuliomoro@230
|
3 *
|
giuliomoro@230
|
4 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
giuliomoro@230
|
5 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
|
giuliomoro@230
|
6 *
|
giuliomoro@230
|
7 * See https://github.com/libpd/libpd/wiki for documentation
|
giuliomoro@230
|
8 *
|
giuliomoro@230
|
9 */
|
giuliomoro@230
|
10
|
giuliomoro@230
|
11 #ifndef __Z_LIBPD_H__
|
giuliomoro@230
|
12 #define __Z_LIBPD_H__
|
giuliomoro@230
|
13
|
giuliomoro@230
|
14 #ifdef __cplusplus
|
giuliomoro@230
|
15 extern "C"
|
giuliomoro@230
|
16 {
|
giuliomoro@230
|
17 #endif
|
giuliomoro@230
|
18
|
giuliomoro@230
|
19 #include "m_pd.h"
|
giuliomoro@230
|
20
|
giuliomoro@230
|
21 EXTERN int libpd_init(void);
|
giuliomoro@230
|
22 EXTERN void libpd_clear_search_path(void);
|
giuliomoro@230
|
23 EXTERN void libpd_add_to_search_path(const char *sym);
|
giuliomoro@230
|
24
|
giuliomoro@230
|
25 EXTERN void *libpd_openfile(const char *basename, const char *dirname);
|
giuliomoro@230
|
26 EXTERN void libpd_closefile(void *p);
|
giuliomoro@230
|
27 EXTERN int libpd_getdollarzero(void *p);
|
giuliomoro@230
|
28
|
giuliomoro@230
|
29 EXTERN int libpd_blocksize(void);
|
giuliomoro@230
|
30 EXTERN int libpd_init_audio(int inChans, int outChans, int sampleRate);
|
giuliomoro@230
|
31 EXTERN int libpd_process_raw(const float *inBuffer, float *outBuffer);
|
giuliomoro@342
|
32 EXTERN t_sample* libpd_get_sys_soundin();
|
giuliomoro@342
|
33 EXTERN t_sample* libpd_get_sys_soundout();
|
giuliomoro@342
|
34 EXTERN int libpd_process_sys();
|
giuliomoro@230
|
35 EXTERN int libpd_process_short(const int ticks,
|
giuliomoro@230
|
36 const short *inBuffer, short *outBuffer);
|
giuliomoro@230
|
37 EXTERN int libpd_process_float(int ticks,
|
giuliomoro@230
|
38 const float *inBuffer, float *outBuffer);
|
giuliomoro@230
|
39 EXTERN int libpd_process_double(int ticks,
|
giuliomoro@230
|
40 const double *inBuffer, double *outBuffer);
|
giuliomoro@230
|
41
|
giuliomoro@230
|
42 EXTERN int libpd_arraysize(const char *name);
|
giuliomoro@230
|
43 // The parameters of the next two functions are inspired by memcpy.
|
giuliomoro@230
|
44 EXTERN int libpd_read_array(float *dest, const char *src, int offset, int n);
|
giuliomoro@230
|
45 EXTERN int libpd_write_array(const char *dest, int offset, float *src, int n);
|
giuliomoro@230
|
46
|
giuliomoro@230
|
47 EXTERN int libpd_bang(const char *recv);
|
giuliomoro@230
|
48 EXTERN int libpd_float(const char *recv, float x);
|
giuliomoro@230
|
49 EXTERN int libpd_symbol(const char *recv, const char *sym);
|
giuliomoro@230
|
50
|
giuliomoro@230
|
51 EXTERN void libpd_set_float(t_atom *v, float x);
|
giuliomoro@230
|
52 EXTERN void libpd_set_symbol(t_atom *v, const char *sym);
|
giuliomoro@230
|
53 EXTERN int libpd_list(const char *recv, int argc, t_atom *argv);
|
giuliomoro@230
|
54 EXTERN int libpd_message(const char *recv, const char *msg, int argc, t_atom *argv);
|
giuliomoro@230
|
55
|
giuliomoro@230
|
56 EXTERN int libpd_start_message(int max_length);
|
giuliomoro@230
|
57 EXTERN void libpd_add_float(float x);
|
giuliomoro@230
|
58 EXTERN void libpd_add_symbol(const char *sym);
|
giuliomoro@230
|
59 EXTERN int libpd_finish_list(const char *recv);
|
giuliomoro@230
|
60 EXTERN int libpd_finish_message(const char *recv, const char *msg);
|
giuliomoro@230
|
61
|
giuliomoro@230
|
62 EXTERN int libpd_exists(const char *sym);
|
giuliomoro@230
|
63 EXTERN void *libpd_bind(const char *sym);
|
giuliomoro@230
|
64 EXTERN void libpd_unbind(void *p);
|
giuliomoro@230
|
65
|
giuliomoro@230
|
66 EXTERN int libpd_is_float(t_atom *a);
|
giuliomoro@230
|
67 EXTERN int libpd_is_symbol(t_atom *a);
|
giuliomoro@230
|
68 EXTERN float libpd_get_float(t_atom *a);
|
giuliomoro@230
|
69 EXTERN char *libpd_get_symbol(t_atom *a);
|
giuliomoro@230
|
70 EXTERN t_atom *libpd_next_atom(t_atom *a);
|
giuliomoro@230
|
71
|
giuliomoro@230
|
72 typedef void (*t_libpd_printhook)(const char *recv);
|
giuliomoro@230
|
73 typedef void (*t_libpd_banghook)(const char *recv);
|
giuliomoro@230
|
74 typedef void (*t_libpd_floathook)(const char *recv, float x);
|
giuliomoro@230
|
75 typedef void (*t_libpd_symbolhook)(const char *recv, const char *sym);
|
giuliomoro@230
|
76 typedef void (*t_libpd_listhook)(const char *recv, int argc, t_atom *argv);
|
giuliomoro@230
|
77 typedef void (*t_libpd_messagehook)(const char *recv, const char *msg,
|
giuliomoro@230
|
78 int argc, t_atom *argv);
|
giuliomoro@230
|
79
|
giuliomoro@230
|
80 EXTERN void libpd_set_printhook(const t_libpd_printhook hook);
|
giuliomoro@230
|
81 EXTERN void libpd_set_banghook(const t_libpd_banghook hook);
|
giuliomoro@230
|
82 EXTERN void libpd_set_floathook(const t_libpd_floathook hook);
|
giuliomoro@230
|
83 EXTERN void libpd_set_symbolhook(const t_libpd_symbolhook hook);
|
giuliomoro@230
|
84 EXTERN void libpd_set_listhook(const t_libpd_listhook hook);
|
giuliomoro@230
|
85 EXTERN void libpd_set_messagehook(const t_libpd_messagehook hook);
|
giuliomoro@230
|
86
|
giuliomoro@230
|
87 EXTERN int libpd_noteon(int channel, int pitch, int velocity);
|
giuliomoro@230
|
88 EXTERN int libpd_controlchange(int channel, int controller, int value);
|
giuliomoro@230
|
89 EXTERN int libpd_programchange(int channel, int value);
|
giuliomoro@230
|
90 EXTERN int libpd_pitchbend(int channel, int value);
|
giuliomoro@230
|
91 EXTERN int libpd_aftertouch(int channel, int value);
|
giuliomoro@230
|
92 EXTERN int libpd_polyaftertouch(int channel, int pitch, int value);
|
giuliomoro@230
|
93 EXTERN int libpd_midibyte(int port, int byte);
|
giuliomoro@230
|
94 EXTERN int libpd_sysex(int port, int byte);
|
giuliomoro@230
|
95 EXTERN int libpd_sysrealtime(int port, int byte);
|
giuliomoro@230
|
96
|
giuliomoro@230
|
97 typedef void (*t_libpd_noteonhook)(int channel, int pitch, int velocity);
|
giuliomoro@230
|
98 typedef void (*t_libpd_controlchangehook)(int channel,
|
giuliomoro@230
|
99 int controller, int value);
|
giuliomoro@230
|
100 typedef void (*t_libpd_programchangehook)(int channel, int value);
|
giuliomoro@230
|
101 typedef void (*t_libpd_pitchbendhook)(int channel, int value);
|
giuliomoro@230
|
102 typedef void (*t_libpd_aftertouchhook)(int channel, int value);
|
giuliomoro@230
|
103 typedef void (*t_libpd_polyaftertouchhook)(int channel, int pitch, int value);
|
giuliomoro@230
|
104 typedef void (*t_libpd_midibytehook)(int port, int byte);
|
giuliomoro@230
|
105
|
giuliomoro@230
|
106 EXTERN void libpd_set_noteonhook(const t_libpd_noteonhook hook);
|
giuliomoro@230
|
107 EXTERN void libpd_set_controlchangehook(const t_libpd_controlchangehook hook);
|
giuliomoro@230
|
108 EXTERN void libpd_set_programchangehook(const t_libpd_programchangehook hook);
|
giuliomoro@230
|
109 EXTERN void libpd_set_pitchbendhook(const t_libpd_pitchbendhook hook);
|
giuliomoro@230
|
110 EXTERN void libpd_set_aftertouchhook(const t_libpd_aftertouchhook hook);
|
giuliomoro@230
|
111 EXTERN void libpd_set_polyaftertouchhook(const t_libpd_polyaftertouchhook hook);
|
giuliomoro@230
|
112 EXTERN void libpd_set_midibytehook(const t_libpd_midibytehook hook);
|
giuliomoro@230
|
113 EXTERN void libpd_sys_microsleep(int sleep);
|
giuliomoro@342
|
114
|
giuliomoro@230
|
115 #ifdef __cplusplus
|
giuliomoro@230
|
116 }
|
giuliomoro@230
|
117 #endif
|
giuliomoro@230
|
118
|
giuliomoro@230
|
119 #endif
|