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.

109 lines
3.6KB

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