Mercurial > hg > pub > prymula > com
comparison CloneChannel/plugins/common/gen_dsp/genlib_common.h @ 12:24d60bdea349
ClonneChannel
author | prymula <prymula76@outlook.com> |
---|---|
date | Thu, 08 Feb 2024 20:24:27 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:78390e0e674f | 12:24d60bdea349 |
---|---|
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_COMMON_H | |
22 #define GENLIB_COMMON_H 1 | |
23 | |
24 //////////// genlib_common.h //////////// | |
25 // common data structure header file -- this is the stuff required by the | |
26 // common code and accessed by the export and max code | |
27 | |
28 #define DSP_GEN_MAX_SIGNALS 16 | |
29 | |
30 typedef float t_sample; | |
31 typedef float t_param; | |
32 typedef char *t_ptr; | |
33 | |
34 typedef long t_genlib_err; | |
35 typedef enum { | |
36 GENLIB_ERR_NONE = 0, ///< No error | |
37 GENLIB_ERR_GENERIC = -1, ///< Generic error | |
38 GENLIB_ERR_INVALID_PTR = -2, ///< Invalid Pointer | |
39 GENLIB_ERR_DUPLICATE = -3, ///< Duplicate | |
40 GENLIB_ERR_OUT_OF_MEM = -4, ///< Out of memory | |
41 | |
42 GENLIB_ERR_LOOP_OVERFLOW = 100, // too many iterations of loops in perform() | |
43 GENLIB_ERR_NULL_BUFFER = 101 // missing signal data in perform() | |
44 | |
45 } e_genlib_errorcodes; | |
46 | |
47 typedef enum { | |
48 GENLIB_PARAMTYPE_FLOAT = 0, | |
49 GENLIB_PARAMTYPE_SYM = 1 | |
50 } e_genlib_paramtypes; | |
51 | |
52 struct ParamInfo | |
53 { | |
54 t_param defaultvalue; | |
55 void * defaultref; | |
56 char hasinputminmax; | |
57 char hasminmax; | |
58 t_param inputmin, inputmax; | |
59 t_param outputmin, outputmax; | |
60 const char *name; | |
61 const char *units; | |
62 int paramtype; // 0 -> float64, 1 -> symbol (table name) | |
63 t_param exp; // future, for scaling | |
64 }; | |
65 | |
66 struct CommonState | |
67 { | |
68 t_sample sr; | |
69 int vs; | |
70 int numins; | |
71 int numouts; | |
72 const char **inputnames; | |
73 const char **outputnames; | |
74 int numparams; | |
75 ParamInfo *params; | |
76 | |
77 void * parammap; // implementation-dependent | |
78 void * api; // implementation-dependent | |
79 }; | |
80 | |
81 // opaque interface to float32 buffer: | |
82 typedef struct _genlib_buffer t_genlib_buffer; | |
83 typedef struct { | |
84 char b_name[256]; ///< name of the buffer | |
85 float *b_samples; ///< stored with interleaved channels if multi-channel | |
86 long b_frames; ///< number of sample frames (each one is sizeof(float) * b_nchans bytes) | |
87 long b_nchans; ///< number of channels | |
88 long b_size; ///< size of buffer in floats | |
89 float b_sr; ///< sampling rate of the buffer | |
90 long b_modtime; ///< last modified time ("dirty" method) | |
91 long b_rfu[57]; ///< reserved for future use | |
92 } t_genlib_buffer_info; | |
93 | |
94 // opaque interface to float64 buffer: | |
95 typedef struct _genlib_data t_genlib_data; | |
96 typedef struct { | |
97 int dim, channels; | |
98 t_sample * data; | |
99 } t_genlib_data_info; | |
100 | |
101 typedef void (*setparameter_method) (CommonState *, long, t_param, void *); | |
102 typedef void (*getparameter_method) (CommonState *, long, t_param *); | |
103 | |
104 #endif // GENLIB_COMMON_H | |
105 | |
106 |