Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
4.1KB

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