12
|
1 /*******************************************************************************************************************
|
|
2 Copyright (c) 2012 Cycling '74
|
|
3
|
|
4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
5 and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
6 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
7 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
8 subject to the following conditions:
|
|
9
|
|
10 The above copyright notice and this permission notice shall be included in all copies
|
|
11 or substantial portions of the Software.
|
|
12
|
|
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
14 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
15 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
16 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
|
17 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
18 *******************************************************************************************************************/
|
|
19
|
|
20
|
|
21 #ifndef GENLIB_H
|
|
22 #define GENLIB_H 1
|
|
23
|
|
24 #include "genlib_common.h"
|
|
25
|
|
26 //////////// genlib.h ////////////
|
|
27 // genlib.h -- max (gen~) version
|
|
28
|
|
29 #include "DistrhoUtils.hpp"
|
|
30
|
|
31 #define inf (__DBL_MAX__)
|
|
32 #define GEN_UINT_MAX (4294967295)
|
|
33 #define TWO_TO_32 (4294967296.0)
|
|
34
|
|
35 #define C74_CONST const
|
|
36
|
|
37 // max_types.h:
|
|
38 typedef uintptr_t t_ptr_uint;
|
|
39 typedef intptr_t t_ptr_int;
|
|
40 typedef float t_atom_float;
|
|
41 typedef t_ptr_uint t_getbytes_size;
|
|
42
|
|
43 typedef uint32_t t_uint32;
|
|
44 typedef t_ptr_int t_atom_long; // the type that is an A_LONG in an atom
|
|
45
|
|
46 typedef t_ptr_int t_int; ///< an integer @ingroup misc
|
|
47 typedef t_ptr_uint t_ptr_size; ///< unsigned pointer-sized value for counting (like size_t) @ingroup misc
|
|
48 typedef t_ptr_int t_atom_long; ///< the type that is an A_LONG in a #t_atom @ingroup misc
|
|
49 typedef t_atom_long t_max_err; ///< an integer value suitable to be returned as an error code @ingroup misc
|
|
50
|
|
51 extern "C" {
|
|
52
|
|
53 // string reference handling:
|
|
54 void * genlib_obtain_reference_from_string(const char * name);
|
|
55 char *genlib_reference_getname(void *ref);
|
|
56
|
|
57 // buffer handling:
|
|
58 t_genlib_buffer *genlib_obtain_buffer_from_reference(void *ref);
|
|
59 t_genlib_err genlib_buffer_edit_begin(t_genlib_buffer *b);
|
|
60 t_genlib_err genlib_buffer_edit_end(t_genlib_buffer *b, long valid);
|
|
61 t_genlib_err genlib_buffer_getinfo(t_genlib_buffer *b, t_genlib_buffer_info *info);
|
|
62 void genlib_buffer_dirty(t_genlib_buffer *b);
|
|
63 t_genlib_err genlib_buffer_perform_begin(t_genlib_buffer *b);
|
|
64 void genlib_buffer_perform_end(t_genlib_buffer *b);
|
|
65
|
|
66 // data handling:
|
|
67 t_genlib_data *genlib_obtain_data_from_reference(void *ref);
|
|
68 t_genlib_err genlib_data_getinfo(t_genlib_data *b, t_genlib_data_info *info);
|
|
69 void genlib_data_resize(t_genlib_data *b, long dim, long channels);
|
|
70 void genlib_data_setbuffer(t_genlib_data *b, void *ref);
|
|
71 void genlib_data_release(t_genlib_data *b);
|
|
72 void genlib_data_setcursor(t_genlib_data *b, long cursor);
|
|
73 long genlib_data_getcursor(t_genlib_data *b);
|
|
74
|
|
75 // other notification:
|
|
76 void genlib_reset_complete(void *data);
|
|
77
|
|
78 // get/set state of parameters
|
|
79 size_t genlib_getstatesize(CommonState *cself, getparameter_method getmethod);
|
|
80 short genlib_getstate(CommonState *cself, char *state, getparameter_method getmethod);
|
|
81 short genlib_setstate(CommonState *cself, const char *state, setparameter_method setmethod);
|
|
82
|
|
83 }; // extern "C"
|
|
84
|
|
85 #define genlib_sysmem_newptr(s) sysmem_newptr(s)
|
|
86 #define genlib_sysmem_newptrclear(s) sysmem_newptrclear(s)
|
|
87 #define genlib_sysmem_resizeptr(p, s) sysmem_resizeptr(p, s)
|
|
88 #define genlib_sysmem_resizeptrclear(p, s) sysmem_resizeptrclear(p, s)
|
|
89 #define genlib_sysmem_ptrsize(p) sysmem_ptrsize(p)
|
|
90 #define genlib_sysmem_freeptr(p) sysmem_freeptr(p)
|
|
91 #define genlib_sysmem_copyptr(s, d, b) sysmem_copyptr(s, d, b)
|
|
92 #define genlib_set_zero64(d, n) set_zero64(d, n)
|
|
93 #define genlib_ticks systime_ticks
|
|
94
|
|
95 #endif // GENLIB_H
|