fmod_dsp.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. /* ======================================================================================== */
  2. /* FMOD Core API - DSP header file. */
  3. /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
  4. /* */
  5. /* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */
  6. /* dsp system. With this header you can make your own DSP plugin that FMOD can */
  7. /* register and use. See the documentation and examples on how to make a working plugin. */
  8. /* */
  9. /* For more detail visit: */
  10. /* https://fmod.com/docs/2.03/api/plugin-api-dsp.html */
  11. /* =========================================================================================*/
  12. #ifndef _FMOD_DSP_H
  13. #define _FMOD_DSP_H
  14. #include "fmod_dsp_effects.h"
  15. typedef struct FMOD_DSP_STATE FMOD_DSP_STATE;
  16. typedef struct FMOD_DSP_BUFFER_ARRAY FMOD_DSP_BUFFER_ARRAY;
  17. typedef struct FMOD_COMPLEX FMOD_COMPLEX;
  18. /*
  19. DSP Constants
  20. */
  21. #define FMOD_PLUGIN_SDK_VERSION 110
  22. #define FMOD_DSP_GETPARAM_VALUESTR_LENGTH 32
  23. typedef enum
  24. {
  25. FMOD_DSP_PROCESS_PERFORM,
  26. FMOD_DSP_PROCESS_QUERY
  27. } FMOD_DSP_PROCESS_OPERATION;
  28. typedef enum FMOD_DSP_PAN_SURROUND_FLAGS
  29. {
  30. FMOD_DSP_PAN_SURROUND_DEFAULT = 0,
  31. FMOD_DSP_PAN_SURROUND_ROTATION_NOT_BIASED = 1,
  32. FMOD_DSP_PAN_SURROUND_FLAGS_FORCEINT = 65536
  33. } FMOD_DSP_PAN_SURROUND_FLAGS;
  34. typedef enum
  35. {
  36. FMOD_DSP_PARAMETER_TYPE_FLOAT,
  37. FMOD_DSP_PARAMETER_TYPE_INT,
  38. FMOD_DSP_PARAMETER_TYPE_BOOL,
  39. FMOD_DSP_PARAMETER_TYPE_DATA,
  40. FMOD_DSP_PARAMETER_TYPE_MAX,
  41. FMOD_DSP_PARAMETER_TYPE_FORCEINT = 65536
  42. } FMOD_DSP_PARAMETER_TYPE;
  43. typedef enum
  44. {
  45. FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR,
  46. FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO,
  47. FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR,
  48. FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_FORCEINT = 65536
  49. } FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE;
  50. typedef enum
  51. {
  52. FMOD_DSP_PARAMETER_DATA_TYPE_USER = 0,
  53. FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1,
  54. FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2,
  55. FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3,
  56. FMOD_DSP_PARAMETER_DATA_TYPE_FFT = -4,
  57. FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5,
  58. FMOD_DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6,
  59. FMOD_DSP_PARAMETER_DATA_TYPE_DYNAMIC_RESPONSE = -7,
  60. } FMOD_DSP_PARAMETER_DATA_TYPE;
  61. /*
  62. DSP Callbacks
  63. */
  64. typedef FMOD_RESULT (F_CALL *FMOD_DSP_CREATE_CALLBACK) (FMOD_DSP_STATE *dsp_state);
  65. typedef FMOD_RESULT (F_CALL *FMOD_DSP_RELEASE_CALLBACK) (FMOD_DSP_STATE *dsp_state);
  66. typedef FMOD_RESULT (F_CALL *FMOD_DSP_RESET_CALLBACK) (FMOD_DSP_STATE *dsp_state);
  67. typedef FMOD_RESULT (F_CALL *FMOD_DSP_READ_CALLBACK) (FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels);
  68. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PROCESS_CALLBACK) (FMOD_DSP_STATE *dsp_state, unsigned int length, const FMOD_DSP_BUFFER_ARRAY *inbufferarray, FMOD_DSP_BUFFER_ARRAY *outbufferarray, FMOD_BOOL inputsidle, FMOD_DSP_PROCESS_OPERATION op);
  69. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPOSITION_CALLBACK) (FMOD_DSP_STATE *dsp_state, unsigned int pos);
  70. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SHOULDIPROCESS_CALLBACK) (FMOD_DSP_STATE *dsp_state, FMOD_BOOL inputsidle, unsigned int length, FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE speakermode);
  71. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_FLOAT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float value);
  72. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_INT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, int value);
  73. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_BOOL_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, FMOD_BOOL value);
  74. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_DATA_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, void *data, unsigned int length);
  75. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_FLOAT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float *value, char *valuestr);
  76. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_INT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, int *value, char *valuestr);
  77. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_BOOL_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, FMOD_BOOL *value, char *valuestr);
  78. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_DATA_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, void **data, unsigned int *length, char *valuestr);
  79. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_REGISTER_CALLBACK) (FMOD_DSP_STATE *dsp_state);
  80. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK) (FMOD_DSP_STATE *dsp_state);
  81. typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_MIX_CALLBACK) (FMOD_DSP_STATE *dsp_state, int stage);
  82. /*
  83. DSP Functions
  84. */
  85. typedef void * (F_CALL *FMOD_DSP_ALLOC_FUNC) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr);
  86. typedef void * (F_CALL *FMOD_DSP_REALLOC_FUNC) (void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr);
  87. typedef void (F_CALL *FMOD_DSP_FREE_FUNC) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr);
  88. typedef void (F_CALL *FMOD_DSP_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *str, ...);
  89. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSAMPLERATE_FUNC) (FMOD_DSP_STATE *dsp_state, int *rate);
  90. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETBLOCKSIZE_FUNC) (FMOD_DSP_STATE *dsp_state, unsigned int *blocksize);
  91. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSPEAKERMODE_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE *speakermode_mixer, FMOD_SPEAKERMODE *speakermode_output);
  92. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETCLOCK_FUNC) (FMOD_DSP_STATE *dsp_state, unsigned long long *clock, unsigned int *offset, unsigned int *length);
  93. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETLISTENERATTRIBUTES_FUNC) (FMOD_DSP_STATE *dsp_state, int *numlisteners, FMOD_3D_ATTRIBUTES *attributes);
  94. typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETUSERDATA_FUNC) (FMOD_DSP_STATE *dsp_state, void **userdata);
  95. typedef FMOD_RESULT (F_CALL *FMOD_DSP_DFT_FFTREAL_FUNC) (FMOD_DSP_STATE *dsp_state, int size, const float *signal, FMOD_COMPLEX* dft, const float *window, int signalhop);
  96. typedef FMOD_RESULT (F_CALL *FMOD_DSP_DFT_IFFTREAL_FUNC) (FMOD_DSP_STATE *dsp_state, int size, const FMOD_COMPLEX *dft, float* signal, const float *window, int signalhop);
  97. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMMONOMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, float lowFrequencyGain, float overallGain, float *matrix);
  98. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix);
  99. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix, FMOD_DSP_PAN_SURROUND_FLAGS flags);
  100. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix);
  101. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix);
  102. typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, float *gain);
  103. /*
  104. DSP Structures
  105. */
  106. struct FMOD_DSP_BUFFER_ARRAY
  107. {
  108. int numbuffers;
  109. int *buffernumchannels;
  110. FMOD_CHANNELMASK *bufferchannelmask;
  111. float **buffers;
  112. FMOD_SPEAKERMODE speakermode;
  113. };
  114. struct FMOD_COMPLEX
  115. {
  116. float real;
  117. float imag;
  118. };
  119. typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR
  120. {
  121. int numpoints;
  122. float *pointparamvalues;
  123. float *pointpositions;
  124. } FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR;
  125. typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING
  126. {
  127. FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE type;
  128. FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping;
  129. } FMOD_DSP_PARAMETER_FLOAT_MAPPING;
  130. typedef struct FMOD_DSP_PARAMETER_DESC_FLOAT
  131. {
  132. float min;
  133. float max;
  134. float defaultval;
  135. FMOD_DSP_PARAMETER_FLOAT_MAPPING mapping;
  136. } FMOD_DSP_PARAMETER_DESC_FLOAT;
  137. typedef struct FMOD_DSP_PARAMETER_DESC_INT
  138. {
  139. int min;
  140. int max;
  141. int defaultval;
  142. FMOD_BOOL goestoinf;
  143. const char* const* valuenames;
  144. } FMOD_DSP_PARAMETER_DESC_INT;
  145. typedef struct FMOD_DSP_PARAMETER_DESC_BOOL
  146. {
  147. FMOD_BOOL defaultval;
  148. const char* const* valuenames;
  149. } FMOD_DSP_PARAMETER_DESC_BOOL;
  150. typedef struct FMOD_DSP_PARAMETER_DESC_DATA
  151. {
  152. int datatype;
  153. } FMOD_DSP_PARAMETER_DESC_DATA;
  154. typedef struct FMOD_DSP_PARAMETER_DESC
  155. {
  156. FMOD_DSP_PARAMETER_TYPE type;
  157. char name[16];
  158. char label[16];
  159. const char *description;
  160. union
  161. {
  162. FMOD_DSP_PARAMETER_DESC_FLOAT floatdesc;
  163. FMOD_DSP_PARAMETER_DESC_INT intdesc;
  164. FMOD_DSP_PARAMETER_DESC_BOOL booldesc;
  165. FMOD_DSP_PARAMETER_DESC_DATA datadesc;
  166. };
  167. } FMOD_DSP_PARAMETER_DESC;
  168. typedef struct FMOD_DSP_PARAMETER_OVERALLGAIN
  169. {
  170. float linear_gain;
  171. float linear_gain_additive;
  172. } FMOD_DSP_PARAMETER_OVERALLGAIN;
  173. typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES
  174. {
  175. FMOD_3D_ATTRIBUTES relative;
  176. FMOD_3D_ATTRIBUTES absolute;
  177. } FMOD_DSP_PARAMETER_3DATTRIBUTES;
  178. typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI
  179. {
  180. int numlisteners;
  181. FMOD_3D_ATTRIBUTES relative[FMOD_MAX_LISTENERS];
  182. float weight[FMOD_MAX_LISTENERS];
  183. FMOD_3D_ATTRIBUTES absolute;
  184. } FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI;
  185. typedef struct FMOD_DSP_PARAMETER_ATTENUATION_RANGE
  186. {
  187. float min;
  188. float max;
  189. } FMOD_DSP_PARAMETER_ATTENUATION_RANGE;
  190. typedef struct FMOD_DSP_PARAMETER_SIDECHAIN
  191. {
  192. FMOD_BOOL sidechainenable;
  193. } FMOD_DSP_PARAMETER_SIDECHAIN;
  194. typedef struct FMOD_DSP_PARAMETER_FFT
  195. {
  196. int length;
  197. int numchannels;
  198. float *spectrum[32];
  199. } FMOD_DSP_PARAMETER_FFT;
  200. typedef struct FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE
  201. {
  202. int numchannels;
  203. float rms[32];
  204. } FMOD_DSP_PARAMETER_DYNAMIC_RESPONSE;
  205. typedef struct FMOD_DSP_DESCRIPTION
  206. {
  207. unsigned int pluginsdkversion;
  208. char name[32];
  209. unsigned int version;
  210. int numinputbuffers;
  211. int numoutputbuffers;
  212. FMOD_DSP_CREATE_CALLBACK create;
  213. FMOD_DSP_RELEASE_CALLBACK release;
  214. FMOD_DSP_RESET_CALLBACK reset;
  215. FMOD_DSP_READ_CALLBACK read;
  216. FMOD_DSP_PROCESS_CALLBACK process;
  217. FMOD_DSP_SETPOSITION_CALLBACK setposition;
  218. int numparameters;
  219. FMOD_DSP_PARAMETER_DESC **paramdesc;
  220. FMOD_DSP_SETPARAM_FLOAT_CALLBACK setparameterfloat;
  221. FMOD_DSP_SETPARAM_INT_CALLBACK setparameterint;
  222. FMOD_DSP_SETPARAM_BOOL_CALLBACK setparameterbool;
  223. FMOD_DSP_SETPARAM_DATA_CALLBACK setparameterdata;
  224. FMOD_DSP_GETPARAM_FLOAT_CALLBACK getparameterfloat;
  225. FMOD_DSP_GETPARAM_INT_CALLBACK getparameterint;
  226. FMOD_DSP_GETPARAM_BOOL_CALLBACK getparameterbool;
  227. FMOD_DSP_GETPARAM_DATA_CALLBACK getparameterdata;
  228. FMOD_DSP_SHOULDIPROCESS_CALLBACK shouldiprocess;
  229. void *userdata;
  230. FMOD_DSP_SYSTEM_REGISTER_CALLBACK sys_register;
  231. FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister;
  232. FMOD_DSP_SYSTEM_MIX_CALLBACK sys_mix;
  233. } FMOD_DSP_DESCRIPTION;
  234. typedef struct FMOD_DSP_STATE_DFT_FUNCTIONS
  235. {
  236. FMOD_DSP_DFT_FFTREAL_FUNC fftreal;
  237. FMOD_DSP_DFT_IFFTREAL_FUNC inversefftreal;
  238. } FMOD_DSP_STATE_DFT_FUNCTIONS;
  239. typedef struct FMOD_DSP_STATE_PAN_FUNCTIONS
  240. {
  241. FMOD_DSP_PAN_SUMMONOMATRIX_FUNC summonomatrix;
  242. FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC sumstereomatrix;
  243. FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC sumsurroundmatrix;
  244. FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC summonotosurroundmatrix;
  245. FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC sumstereotosurroundmatrix;
  246. FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC getrolloffgain;
  247. } FMOD_DSP_STATE_PAN_FUNCTIONS;
  248. typedef struct FMOD_DSP_STATE_FUNCTIONS
  249. {
  250. FMOD_DSP_ALLOC_FUNC alloc;
  251. FMOD_DSP_REALLOC_FUNC realloc;
  252. FMOD_DSP_FREE_FUNC free;
  253. FMOD_DSP_GETSAMPLERATE_FUNC getsamplerate;
  254. FMOD_DSP_GETBLOCKSIZE_FUNC getblocksize;
  255. FMOD_DSP_STATE_DFT_FUNCTIONS *dft;
  256. FMOD_DSP_STATE_PAN_FUNCTIONS *pan;
  257. FMOD_DSP_GETSPEAKERMODE_FUNC getspeakermode;
  258. FMOD_DSP_GETCLOCK_FUNC getclock;
  259. FMOD_DSP_GETLISTENERATTRIBUTES_FUNC getlistenerattributes;
  260. FMOD_DSP_LOG_FUNC log;
  261. FMOD_DSP_GETUSERDATA_FUNC getuserdata;
  262. } FMOD_DSP_STATE_FUNCTIONS;
  263. struct FMOD_DSP_STATE
  264. {
  265. void *instance;
  266. void *plugindata;
  267. FMOD_CHANNELMASK channelmask;
  268. FMOD_SPEAKERMODE source_speakermode;
  269. float *sidechaindata;
  270. int sidechainchannels;
  271. FMOD_DSP_STATE_FUNCTIONS *functions;
  272. int systemobject;
  273. };
  274. typedef struct FMOD_DSP_METERING_INFO
  275. {
  276. int numsamples;
  277. float peaklevel[32];
  278. float rmslevel[32];
  279. short numchannels;
  280. } FMOD_DSP_METERING_INFO;
  281. /*
  282. DSP Macros
  283. */
  284. #define FMOD_DSP_INIT_PARAMDESC_FLOAT(_paramstruct, _name, _label, _description, _min, _max, _defaultval) \
  285. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  286. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_FLOAT; \
  287. strncpy((_paramstruct).name, _name, 15); \
  288. strncpy((_paramstruct).label, _label, 15); \
  289. (_paramstruct).description = _description; \
  290. (_paramstruct).floatdesc.min = _min; \
  291. (_paramstruct).floatdesc.max = _max; \
  292. (_paramstruct).floatdesc.defaultval = _defaultval; \
  293. (_paramstruct).floatdesc.mapping.type = FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO;
  294. #define FMOD_DSP_INIT_PARAMDESC_FLOAT_WITH_MAPPING(_paramstruct, _name, _label, _description, _defaultval, _values, _positions); \
  295. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  296. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_FLOAT; \
  297. strncpy((_paramstruct).name, _name , 15); \
  298. strncpy((_paramstruct).label, _label, 15); \
  299. (_paramstruct).description = _description; \
  300. (_paramstruct).floatdesc.min = _values[0]; \
  301. (_paramstruct).floatdesc.max = _values[sizeof(_values) / sizeof(float) - 1]; \
  302. (_paramstruct).floatdesc.defaultval = _defaultval; \
  303. (_paramstruct).floatdesc.mapping.type = FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR; \
  304. (_paramstruct).floatdesc.mapping.piecewiselinearmapping.numpoints = sizeof(_values) / sizeof(float); \
  305. (_paramstruct).floatdesc.mapping.piecewiselinearmapping.pointparamvalues = _values; \
  306. (_paramstruct).floatdesc.mapping.piecewiselinearmapping.pointpositions = _positions;
  307. #define FMOD_DSP_INIT_PARAMDESC_INT(_paramstruct, _name, _label, _description, _min, _max, _defaultval, _goestoinf, _valuenames) \
  308. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  309. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_INT; \
  310. strncpy((_paramstruct).name, _name , 15); \
  311. strncpy((_paramstruct).label, _label, 15); \
  312. (_paramstruct).description = _description; \
  313. (_paramstruct).intdesc.min = _min; \
  314. (_paramstruct).intdesc.max = _max; \
  315. (_paramstruct).intdesc.defaultval = _defaultval; \
  316. (_paramstruct).intdesc.goestoinf = _goestoinf; \
  317. (_paramstruct).intdesc.valuenames = _valuenames;
  318. #define FMOD_DSP_INIT_PARAMDESC_INT_ENUMERATED(_paramstruct, _name, _label, _description, _defaultval, _valuenames) \
  319. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  320. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_INT; \
  321. strncpy((_paramstruct).name, _name , 15); \
  322. strncpy((_paramstruct).label, _label, 15); \
  323. (_paramstruct).description = _description; \
  324. (_paramstruct).intdesc.min = 0; \
  325. (_paramstruct).intdesc.max = sizeof(_valuenames) / sizeof(char*) - 1; \
  326. (_paramstruct).intdesc.defaultval = _defaultval; \
  327. (_paramstruct).intdesc.goestoinf = false; \
  328. (_paramstruct).intdesc.valuenames = _valuenames;
  329. #define FMOD_DSP_INIT_PARAMDESC_BOOL(_paramstruct, _name, _label, _description, _defaultval, _valuenames) \
  330. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  331. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_BOOL; \
  332. strncpy((_paramstruct).name, _name , 15); \
  333. strncpy((_paramstruct).label, _label, 15); \
  334. (_paramstruct).description = _description; \
  335. (_paramstruct).booldesc.defaultval = _defaultval; \
  336. (_paramstruct).booldesc.valuenames = _valuenames;
  337. #define FMOD_DSP_INIT_PARAMDESC_DATA(_paramstruct, _name, _label, _description, _datatype) \
  338. memset(&(_paramstruct), 0, sizeof(_paramstruct)); \
  339. (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_DATA; \
  340. strncpy((_paramstruct).name, _name , 15); \
  341. strncpy((_paramstruct).label, _label, 15); \
  342. (_paramstruct).description = _description; \
  343. (_paramstruct).datadesc.datatype = _datatype;
  344. #define FMOD_DSP_ALLOC(_state, _size) \
  345. (_state)->functions->alloc(_size, FMOD_MEMORY_NORMAL, __FILE__)
  346. #define FMOD_DSP_REALLOC(_state, _ptr, _size) \
  347. (_state)->functions->realloc(_ptr, _size, FMOD_MEMORY_NORMAL, __FILE__)
  348. #define FMOD_DSP_FREE(_state, _ptr) \
  349. (_state)->functions->free(_ptr, FMOD_MEMORY_NORMAL, __FILE__)
  350. #define FMOD_DSP_LOG(_state, _level, _location, _format, ...) \
  351. (_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, ##__VA_ARGS__)
  352. #define FMOD_DSP_GETSAMPLERATE(_state, _rate) \
  353. (_state)->functions->getsamplerate(_state, _rate)
  354. #define FMOD_DSP_GETBLOCKSIZE(_state, _blocksize) \
  355. (_state)->functions->getblocksize(_state, _blocksize)
  356. #define FMOD_DSP_GETSPEAKERMODE(_state, _speakermodemix, _speakermodeout) \
  357. (_state)->functions->getspeakermode(_state, _speakermodemix, _speakermodeout)
  358. #define FMOD_DSP_GETCLOCK(_state, _clock, _offset, _length) \
  359. (_state)->functions->getclock(_state, _clock, _offset, _length)
  360. #define FMOD_DSP_GETLISTENERATTRIBUTES(_state, _numlisteners, _attributes) \
  361. (_state)->functions->getlistenerattributes(_state, _numlisteners, _attributes)
  362. #define FMOD_DSP_GETUSERDATA(_state, _userdata) \
  363. (_state)->functions->getuserdata(_state, _userdata)
  364. #define FMOD_DSP_DFT_FFTREAL(_state, _size, _signal, _dft, _window, _signalhop) \
  365. (_state)->functions->dft->fftreal(_state, _size, _signal, _dft, _window, _signalhop)
  366. #define FMOD_DSP_DFT_IFFTREAL(_state, _size, _dft, _signal, _window, _signalhop) \
  367. (_state)->functions->dft->inversefftreal(_state, _size, _dft, _signal, _window, _signalhop)
  368. #define FMOD_DSP_PAN_SUMMONOMATRIX(_state, _sourcespeakermode, _lowfrequencygain, _overallgain, _matrix) \
  369. (_state)->functions->pan->summonomatrix(_state, _sourcespeakermode, _lowfrequencygain, _overallgain, _matrix)
  370. #define FMOD_DSP_PAN_SUMSTEREOMATRIX(_state, _sourcespeakermode, _pan, _lowfrequencygain, _overallgain, _matrixhop, _matrix) \
  371. (_state)->functions->pan->sumstereomatrix(_state, _sourcespeakermode, _pan, _lowfrequencygain, _overallgain, _matrixhop, _matrix)
  372. #define FMOD_DSP_PAN_SUMSURROUNDMATRIX(_state, _sourcespeakermode, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, _matrixhop, _matrix, _flags) \
  373. (_state)->functions->pan->sumsurroundmatrix(_state, _sourcespeakermode, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, _matrixhop, _matrix, _flags)
  374. #define FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX(_state, _targetspeakermode, _direction, _extent, _lowfrequencygain, _overallgain, _matrixhop, _matrix) \
  375. (_state)->functions->pan->summonotosurroundmatrix(_state, _targetspeakermode, _direction, _extent, _lowfrequencygain, _overallgain, _matrixhop, _matrix)
  376. #define FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX(_state, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, matrixhop, _matrix) \
  377. (_state)->functions->pan->sumstereotosurroundmatrix(_state, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, matrixhop, _matrix)
  378. #define FMOD_DSP_PAN_GETROLLOFFGAIN(_state, _rolloff, _distance, _mindistance, _maxdistance, _gain) \
  379. (_state)->functions->pan->getrolloffgain(_state, _rolloff, _distance, _mindistance, _maxdistance, _gain)
  380. #endif