comparison examples/08-PureData/basic_libpd/z_libpd.h @ 464:8fcfbfb32aa0 prerelease

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