/* ======================================================================================== */ /* FMOD Core API - DSP header file. */ /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021. */ /* */ /* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */ /* dsp system. With this header you can make your own DSP plugin that FMOD can */ /* register and use. See the documentation and examples on how to make a working plugin. */ /* */ /* For more detail visit: */ /* https://fmod.com/resources/documentation-api?version=2.0&page=plugin-api-dsp.html */ /* =========================================================================================*/ using System; using System.Text; using System.Runtime.InteropServices; namespace FMOD { [StructLayout(LayoutKind.Sequential)] public struct DSP_BUFFER_ARRAY { public int numbuffers; public int[] buffernumchannels; public CHANNELMASK[] bufferchannelmask; public IntPtr[] buffers; public SPEAKERMODE speakermode; } public enum DSP_PROCESS_OPERATION { PROCESS_PERFORM = 0, PROCESS_QUERY } [StructLayout(LayoutKind.Sequential)] public struct COMPLEX { public float real; public float imag; } public enum DSP_PAN_SURROUND_FLAGS { DEFAULT = 0, ROTATION_NOT_BIASED = 1, } /* DSP callbacks */ public delegate RESULT DSP_CREATECALLBACK (ref DSP_STATE dsp_state); public delegate RESULT DSP_RELEASECALLBACK (ref DSP_STATE dsp_state); public delegate RESULT DSP_RESETCALLBACK (ref DSP_STATE dsp_state); public delegate RESULT DSP_SETPOSITIONCALLBACK (ref DSP_STATE dsp_state, uint pos); public delegate RESULT DSP_READCALLBACK (ref DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels); public delegate RESULT DSP_SHOULDIPROCESS_CALLBACK (ref DSP_STATE dsp_state, bool inputsidle, uint length, CHANNELMASK inmask, int inchannels, SPEAKERMODE speakermode); public delegate RESULT DSP_PROCESS_CALLBACK (ref DSP_STATE dsp_state, uint length, ref DSP_BUFFER_ARRAY inbufferarray, ref DSP_BUFFER_ARRAY outbufferarray, bool inputsidle, DSP_PROCESS_OPERATION op); public delegate RESULT DSP_SETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, float value); public delegate RESULT DSP_SETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, int value); public delegate RESULT DSP_SETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, bool value); public delegate RESULT DSP_SETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, IntPtr data, uint length); public delegate RESULT DSP_GETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, ref float value, IntPtr valuestr); public delegate RESULT DSP_GETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, ref int value, IntPtr valuestr); public delegate RESULT DSP_GETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, ref bool value, IntPtr valuestr); public delegate RESULT DSP_GETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, ref IntPtr data, ref uint length, IntPtr valuestr); public delegate RESULT DSP_SYSTEM_REGISTER_CALLBACK (ref DSP_STATE dsp_state); public delegate RESULT DSP_SYSTEM_DEREGISTER_CALLBACK (ref DSP_STATE dsp_state); public delegate RESULT DSP_SYSTEM_MIX_CALLBACK (ref DSP_STATE dsp_state, int stage); /* DSP functions */ public delegate IntPtr DSP_ALLOC_FUNC (uint size, MEMORY_TYPE type, IntPtr sourcestr); public delegate IntPtr DSP_REALLOC_FUNC (IntPtr ptr, uint size, MEMORY_TYPE type, IntPtr sourcestr); public delegate void DSP_FREE_FUNC (IntPtr ptr, MEMORY_TYPE type, IntPtr sourcestr); public delegate void DSP_LOG_FUNC (DEBUG_FLAGS level, IntPtr file, int line, IntPtr function, IntPtr format); public delegate RESULT DSP_GETSAMPLERATE_FUNC (ref DSP_STATE dsp_state, ref int rate); public delegate RESULT DSP_GETBLOCKSIZE_FUNC (ref DSP_STATE dsp_state, ref uint blocksize); public delegate RESULT DSP_GETSPEAKERMODE_FUNC (ref DSP_STATE dsp_state, ref int speakermode_mixer, ref int speakermode_output); public delegate RESULT DSP_GETCLOCK_FUNC (ref DSP_STATE dsp_state, out ulong clock, out uint offset, out uint length); public delegate RESULT DSP_GETLISTENERATTRIBUTES_FUNC (ref DSP_STATE dsp_state, ref int numlisteners, IntPtr attributes); public delegate RESULT DSP_GETUSERDATA_FUNC (ref DSP_STATE dsp_state, out IntPtr userdata); public delegate RESULT DSP_DFT_FFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr signal, IntPtr dft, IntPtr window, int signalhop); public delegate RESULT DSP_DFT_IFFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr dft, IntPtr signal, IntPtr window, int signalhop); public delegate RESULT DSP_PAN_SUMMONOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float lowFrequencyGain, float overallGain, IntPtr matrix); public delegate RESULT DSP_PAN_SUMSTEREOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); public delegate RESULT DSP_PAN_SUMSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix, DSP_PAN_SURROUND_FLAGS flags); public delegate RESULT DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); public delegate RESULT DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); public delegate RESULT DSP_PAN_GETROLLOFFGAIN_FUNC (ref DSP_STATE dsp_state, DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, out float gain); public enum DSP_TYPE : int { UNKNOWN, MIXER, OSCILLATOR, LOWPASS, ITLOWPASS, HIGHPASS, ECHO, FADER, FLANGE, DISTORTION, NORMALIZE, LIMITER, PARAMEQ, PITCHSHIFT, CHORUS, VSTPLUGIN, WINAMPPLUGIN, ITECHO, COMPRESSOR, SFXREVERB, LOWPASS_SIMPLE, DELAY, TREMOLO, LADSPAPLUGIN, SEND, RETURN, HIGHPASS_SIMPLE, PAN, THREE_EQ, FFT, LOUDNESS_METER, ENVELOPEFOLLOWER, CONVOLUTIONREVERB, CHANNELMIX, TRANSCEIVER, OBJECTPAN, MULTIBAND_EQ, MAX } public enum DSP_PARAMETER_TYPE { FLOAT = 0, INT, BOOL, DATA, MAX } public enum DSP_PARAMETER_FLOAT_MAPPING_TYPE { DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR = 0, DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO, DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR, } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR { public int numpoints; public IntPtr pointparamvalues; public IntPtr pointpositions; } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_FLOAT_MAPPING { public DSP_PARAMETER_FLOAT_MAPPING_TYPE type; public DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping; } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_DESC_FLOAT { public float min; public float max; public float defaultval; public DSP_PARAMETER_FLOAT_MAPPING mapping; } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_DESC_INT { public int min; public int max; public int defaultval; public bool goestoinf; public IntPtr valuenames; } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_DESC_BOOL { public bool defaultval; public IntPtr valuenames; } [StructLayout(LayoutKind.Sequential)] public struct DSP_PARAMETER_DESC_DATA { public int datatype; } [StructLayout(LayoutKind.Explicit)] public struct DSP_PARAMETER_DESC_UNION { [FieldOffset(0)] public DSP_PARAMETER_DESC_F