annotate CloneChannel/plugins/common/gen_dsp/genlib.h @ 12:24d60bdea349

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