|
|
|
@ -17,24 +17,10 @@ namespace FMOD |
|
|
|
FMOD version number. Check this against FMOD::System::getVersion / System_GetVersion |
|
|
|
0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. |
|
|
|
*/ |
|
|
|
public class VERSION |
|
|
|
public partial class VERSION |
|
|
|
{ |
|
|
|
public const int number = 0x00020016; |
|
|
|
#if (UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_WEBGL) && !UNITY_EDITOR
|
|
|
|
public const string dll = "__Internal"; |
|
|
|
#elif (UNITY_PS4) && DEVELOPMENT_BUILD
|
|
|
|
public const string dll = "libfmodL"; |
|
|
|
#elif (UNITY_PS4) && !UNITY_EDITOR
|
|
|
|
public const string dll = "libfmod"; |
|
|
|
#elif (UNITY_PSP2) && !UNITY_EDITOR
|
|
|
|
public const string dll = "libfmodstudio"; |
|
|
|
#elif ((UNITY_WSA || UNITY_ANDROID || UNITY_XBOXONE || UNITY_STADIA) && DEVELOPMENT_BUILD)
|
|
|
|
public const string dll = "fmodL"; |
|
|
|
#elif (UNITY_EDITOR) || (UNITY_STANDALONE && DEVELOPMENT_BUILD)
|
|
|
|
public const string dll = "fmodstudioL"; |
|
|
|
#elif (UNITY_STANDALONE)
|
|
|
|
public const string dll = "fmodstudio"; |
|
|
|
#else
|
|
|
|
public const int number = 0x00020111; |
|
|
|
#if !UNITY_2017_4_OR_NEWER
|
|
|
|
public const string dll = "fmod"; |
|
|
|
#endif
|
|
|
|
} |
|
|
|
@ -510,29 +496,32 @@ namespace FMOD |
|
|
|
PREUPDATE = 0x00000400, |
|
|
|
POSTUPDATE = 0x00000800, |
|
|
|
RECORDLISTCHANGED = 0x00001000, |
|
|
|
BUFFEREDNOMIX = 0x00002000, |
|
|
|
DEVICEREINITIALIZE = 0x00004000, |
|
|
|
OUTPUTUNDERRUN = 0x00008000, |
|
|
|
ALL = 0xFFFFFFFF, |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
FMOD Callbacks |
|
|
|
*/ |
|
|
|
public delegate RESULT DEBUG_CALLBACK (DEBUG_FLAGS flags, StringWrapper file, int line, StringWrapper func, StringWrapper message); |
|
|
|
public delegate RESULT DEBUG_CALLBACK (DEBUG_FLAGS flags, IntPtr file, int line, IntPtr func, IntPtr message); |
|
|
|
public delegate RESULT SYSTEM_CALLBACK (IntPtr system, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata1, IntPtr commanddata2, IntPtr userdata); |
|
|
|
public delegate RESULT CHANNELCONTROL_CALLBACK(IntPtr channelcontrol, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE callbacktype, IntPtr commanddata1, IntPtr commanddata2); |
|
|
|
public delegate RESULT CHANNELCONTROL_CALLBACK (IntPtr channelcontrol, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE callbacktype, IntPtr commanddata1, IntPtr commanddata2); |
|
|
|
public delegate RESULT SOUND_NONBLOCK_CALLBACK (IntPtr sound, RESULT result); |
|
|
|
public delegate RESULT SOUND_PCMREAD_CALLBACK (IntPtr sound, IntPtr data, uint datalen); |
|
|
|
public delegate RESULT SOUND_PCMSETPOS_CALLBACK (IntPtr sound, int subsound, uint position, TIMEUNIT postype); |
|
|
|
public delegate RESULT FILE_OPEN_CALLBACK (StringWrapper name, ref uint filesize, ref IntPtr handle, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_OPEN_CALLBACK (IntPtr name, ref uint filesize, ref IntPtr handle, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_CLOSE_CALLBACK (IntPtr handle, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_READ_CALLBACK (IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_SEEK_CALLBACK (IntPtr handle, uint pos, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_ASYNCREAD_CALLBACK (IntPtr info, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_ASYNCCANCEL_CALLBACK(IntPtr info, IntPtr userdata); |
|
|
|
public delegate RESULT FILE_ASYNCDONE_FUNC (IntPtr info, RESULT result); |
|
|
|
public delegate IntPtr MEMORY_ALLOC_CALLBACK (uint size, MEMORY_TYPE type, StringWrapper sourcestr); |
|
|
|
public delegate IntPtr MEMORY_REALLOC_CALLBACK (IntPtr ptr, uint size, MEMORY_TYPE type, StringWrapper sourcestr); |
|
|
|
public delegate void MEMORY_FREE_CALLBACK (IntPtr ptr, MEMORY_TYPE type, StringWrapper sourcestr); |
|
|
|
public delegate float CB_3D_ROLLOFF_CALLBACK (IntPtr channelcontrol, float distance); |
|
|
|
public delegate IntPtr MEMORY_ALLOC_CALLBACK (uint size, MEMORY_TYPE type, IntPtr sourcestr); |
|
|
|
public delegate IntPtr MEMORY_REALLOC_CALLBACK (IntPtr ptr, uint size, MEMORY_TYPE type, IntPtr sourcestr); |
|
|
|
public delegate void MEMORY_FREE_CALLBACK (IntPtr ptr, MEMORY_TYPE type, IntPtr sourcestr); |
|
|
|
public delegate float CB_3D_ROLLOFF_CALLBACK (IntPtr channelcontrol, float distance); |
|
|
|
|
|
|
|
public enum DSP_RESAMPLER : int |
|
|
|
{ |
|
|
|
@ -744,12 +733,9 @@ namespace FMOD |
|
|
|
public float distanceFilterCenterFreq; |
|
|
|
public int reverb3Dinstance; |
|
|
|
public int DSPBufferPoolSize; |
|
|
|
public uint stackSizeStream; |
|
|
|
public uint stackSizeNonBlocking; |
|
|
|
public uint stackSizeMixer; |
|
|
|
public DSP_RESAMPLER resamplerMethod; |
|
|
|
public uint commandQueueSize; |
|
|
|
public uint randomSeed; |
|
|
|
public int maxConvolutionThreads; |
|
|
|
} |
|
|
|
|
|
|
|
[Flags] |
|
|
|
@ -759,6 +745,119 @@ namespace FMOD |
|
|
|
DEFAULT = 0x00000002, |
|
|
|
} |
|
|
|
|
|
|
|
public enum THREAD_PRIORITY : int |
|
|
|
{ |
|
|
|
/* Platform specific priority range */ |
|
|
|
PLATFORM_MIN = -32 * 1024, |
|
|
|
PLATFORM_MAX = 32 * 1024, |
|
|
|
|
|
|
|
/* Platform agnostic priorities, maps internally to platform specific value */ |
|
|
|
DEFAULT = PLATFORM_MIN - 1, |
|
|
|
LOW = PLATFORM_MIN - 2, |
|
|
|
MEDIUM = PLATFORM_MIN - 3, |
|
|
|
HIGH = PLATFORM_MIN - 4, |
|
|
|
VERY_HIGH = PLATFORM_MIN - 5, |
|
|
|
EXTREME = PLATFORM_MIN - 6, |
|
|
|
CRITICAL = PLATFORM_MIN - 7, |
|
|
|
|
|
|
|
/* Thread defaults */ |
|
|
|
MIXER = EXTREME, |
|
|
|
FEEDER = CRITICAL, |
|
|
|
STREAM = VERY_HIGH, |
|
|
|
FILE = HIGH, |
|
|
|
NONBLOCKING = HIGH, |
|
|
|
RECORD = HIGH, |
|
|
|
GEOMETRY = LOW, |
|
|
|
PROFILER = MEDIUM, |
|
|
|
STUDIO_UPDATE = MEDIUM, |
|
|
|
STUDIO_LOAD_BANK = MEDIUM, |
|
|
|
STUDIO_LOAD_SAMPLE = MEDIUM, |
|
|
|
CONVOLUTION1 = VERY_HIGH, |
|
|
|
CONVOLUTION2 = VERY_HIGH |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public enum THREAD_STACK_SIZE : uint |
|
|
|
{ |
|
|
|
DEFAULT = 0, |
|
|
|
MIXER = 80 * 1024, |
|
|
|
FEEDER = 16 * 1024, |
|
|
|
STREAM = 96 * 1024, |
|
|
|
FILE = 64 * 1024, |
|
|
|
NONBLOCKING = 112 * 1024, |
|
|
|
RECORD = 16 * 1024, |
|
|
|
GEOMETRY = 48 * 1024, |
|
|
|
PROFILER = 128 * 1024, |
|
|
|
STUDIO_UPDATE = 96 * 1024, |
|
|
|
STUDIO_LOAD_BANK = 96 * 1024, |
|
|
|
STUDIO_LOAD_SAMPLE = 96 * 1024, |
|
|
|
CONVOLUTION1 = 16 * 1024, |
|
|
|
CONVOLUTION2 = 16 * 1024 |
|
|
|
} |
|
|
|
|
|
|
|
[Flags] |
|
|
|
public enum THREAD_AFFINITY : long // avoid ulong for Bolt compatibility
|
|
|
|
{ |
|
|
|
/* Platform agnostic thread groupings */ |
|
|
|
GROUP_DEFAULT = 0x4000000000000000, |
|
|
|
GROUP_A = 0x4000000000000001, |
|
|
|
GROUP_B = 0x4000000000000002, |
|
|
|
GROUP_C = 0x4000000000000003, |
|
|
|
|
|
|
|
/* Thread defaults */ |
|
|
|
MIXER = GROUP_A, |
|
|
|
FEEDER = GROUP_C, |
|
|
|
STREAM = GROUP_C, |
|
|
|
FILE = GROUP_C, |
|
|
|
NONBLOCKING = GROUP_C, |
|
|
|
RECORD = GROUP_C, |
|
|
|
GEOMETRY = GROUP_C, |
|
|
|
PROFILER = GROUP_C, |
|
|
|
STUDIO_UPDATE = GROUP_B, |
|
|
|
STUDIO_LOAD_BANK = GROUP_C, |
|
|
|
STUDIO_LOAD_SAMPLE = GROUP_C, |
|
|
|
CONVOLUTION1 = GROUP_C, |
|
|
|
CONVOLUTION2 = GROUP_C, |
|
|
|
|
|
|
|
/* Core mask, valid up to 1 << 61 */ |
|
|
|
CORE_ALL = 0, |
|
|
|
CORE_0 = 1 << 0, |
|
|
|
CORE_1 = 1 << 1, |
|
|
|
CORE_2 = 1 << 2, |
|
|
|
CORE_3 = 1 << 3, |
|
|
|
CORE_4 = 1 << 4, |
|
|
|
CORE_5 = 1 << 5, |
|
|
|
CORE_6 = 1 << 6, |
|
|
|
CORE_7 = 1 << 7, |
|
|
|
CORE_8 = 1 << 8, |
|
|
|
CORE_9 = 1 << 9, |
|
|
|
CORE_10 = 1 << 10, |
|
|
|
CORE_11 = 1 << 11, |
|
|
|
CORE_12 = 1 << 12, |
|
|
|
CORE_13 = 1 << 13, |
|
|
|
CORE_14 = 1 << 14, |
|
|
|
CORE_15 = 1 << 15 |
|
|
|
} |
|
|
|
|
|
|
|
public enum THREAD_TYPE : int |
|
|
|
{ |
|
|
|
MIXER, |
|
|
|
FEEDER, |
|
|
|
STREAM, |
|
|
|
FILE, |
|
|
|
NONBLOCKING, |
|
|
|
RECORD, |
|
|
|
GEOMETRY, |
|
|
|
PROFILER, |
|
|
|
STUDIO_UPDATE, |
|
|
|
STUDIO_LOAD_BANK, |
|
|
|
STUDIO_LOAD_SAMPLE, |
|
|
|
CONVOLUTION1, |
|
|
|
CONVOLUTION2, |
|
|
|
|
|
|
|
MAX |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
FMOD System factory functions. Use this to create an FMOD System Instance. below you will see System init/close to get started. |
|
|
|
*/ |
|
|
|
@ -817,6 +916,24 @@ namespace FMOD |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
public struct Thread |
|
|
|
{ |
|
|
|
public static RESULT SetAttributes(THREAD_TYPE type, THREAD_AFFINITY affinity = THREAD_AFFINITY.GROUP_DEFAULT, THREAD_PRIORITY priority = THREAD_PRIORITY.DEFAULT, THREAD_STACK_SIZE stacksize = THREAD_STACK_SIZE.DEFAULT) |
|
|
|
{ |
|
|
|
if ((affinity & THREAD_AFFINITY.GROUP_DEFAULT) != 0) |
|
|
|
{ |
|
|
|
affinity &= ~THREAD_AFFINITY.GROUP_DEFAULT; |
|
|
|
affinity = (THREAD_AFFINITY)(((ulong)affinity) | 0x8000000000000000); |
|
|
|
} |
|
|
|
return FMOD5_Thread_SetAttributes(type, affinity, priority, stacksize); |
|
|
|
} |
|
|
|
|
|
|
|
#region importfunctions
|
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_Thread_SetAttributes(THREAD_TYPE type, THREAD_AFFINITY affinity, THREAD_PRIORITY priority, THREAD_STACK_SIZE stacksize); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
'System' API. |
|
|
|
*/ |
|
|
|
@ -899,12 +1016,12 @@ namespace FMOD |
|
|
|
} |
|
|
|
public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) |
|
|
|
{ |
|
|
|
settings.cbSize = Marshal.SizeOf(settings); |
|
|
|
settings.cbSize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); |
|
|
|
return FMOD5_System_SetAdvancedSettings(this.handle, ref settings); |
|
|
|
} |
|
|
|
public RESULT getAdvancedSettings(ref ADVANCEDSETTINGS settings) |
|
|
|
{ |
|
|
|
settings.cbSize = Marshal.SizeOf(settings); |
|
|
|
settings.cbSize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); |
|
|
|
return FMOD5_System_GetAdvancedSettings(this.handle, ref settings); |
|
|
|
} |
|
|
|
public RESULT setCallback(SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL) |
|
|
|
@ -1096,6 +1213,10 @@ namespace FMOD |
|
|
|
{ |
|
|
|
return FMOD5_System_GetCPUUsage(this.handle, out dsp, out stream, out geometry, out update, out total); |
|
|
|
} |
|
|
|
public RESULT getCPUUsageEx(out float convolutionThread1, out float convolutionThread2) |
|
|
|
{ |
|
|
|
return FMOD5_System_GetCPUUsageEx(this.handle, out convolutionThread1, out convolutionThread2); |
|
|
|
} |
|
|
|
public RESULT getFileUsage(out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead) |
|
|
|
{ |
|
|
|
return FMOD5_System_GetFileUsage(this.handle, out sampleBytesRead, out streamBytesRead, out otherBytesRead); |
|
|
|
@ -1120,7 +1241,7 @@ namespace FMOD |
|
|
|
public RESULT createSound(string name, MODE mode, out Sound sound) |
|
|
|
{ |
|
|
|
CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); |
|
|
|
exinfo.cbsize = Marshal.SizeOf(exinfo); |
|
|
|
exinfo.cbsize = MarshalHelper.SizeOf(typeof(CREATESOUNDEXINFO)); |
|
|
|
|
|
|
|
return createSound(name, mode, ref exinfo, out sound); |
|
|
|
} |
|
|
|
@ -1142,7 +1263,7 @@ namespace FMOD |
|
|
|
public RESULT createStream(string name, MODE mode, out Sound sound) |
|
|
|
{ |
|
|
|
CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); |
|
|
|
exinfo.cbsize = Marshal.SizeOf(exinfo); |
|
|
|
exinfo.cbsize = MarshalHelper.SizeOf(typeof(CREATESOUNDEXINFO)); |
|
|
|
|
|
|
|
return createStream(name, mode, ref exinfo, out sound); |
|
|
|
} |
|
|
|
@ -1184,6 +1305,10 @@ namespace FMOD |
|
|
|
{ |
|
|
|
return FMOD5_System_GetChannel(this.handle, channelid, out channel.handle); |
|
|
|
} |
|
|
|
public RESULT getDSPInfoByType(DSP_TYPE type, out IntPtr description) |
|
|
|
{ |
|
|
|
return FMOD5_System_GetDSPInfoByType(this.handle, type, out description); |
|
|
|
} |
|
|
|
public RESULT getMasterChannelGroup(out ChannelGroup channelgroup) |
|
|
|
{ |
|
|
|
return FMOD5_System_GetMasterChannelGroup(this.handle, out channelgroup.handle); |
|
|
|
@ -1439,6 +1564,8 @@ namespace FMOD |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetCPUUsage (IntPtr system, out float dsp, out float stream, out float geometry, out float update, out float total); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetCPUUsageEx (IntPtr system, out float convolutionThread1, out float convolutionThread2); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetFileUsage (IntPtr system, out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_CreateSound (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); |
|
|
|
@ -1465,6 +1592,8 @@ namespace FMOD |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetChannel (IntPtr system, int channelid, out IntPtr channel); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetDSPInfoByType (IntPtr system, DSP_TYPE type, out IntPtr description); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetMasterChannelGroup (IntPtr system, out IntPtr channelgroup); |
|
|
|
[DllImport(VERSION.dll)] |
|
|
|
private static extern RESULT FMOD5_System_GetMasterSoundGroup (IntPtr system, out IntPtr soundgroup); |
|
|
|
@ -1520,6 +1649,7 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public System(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
@ -1837,6 +1967,7 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public Sound(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
@ -2415,6 +2546,7 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public Channel(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
@ -2886,8 +3018,9 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
public ChannelGroup(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
@ -3023,8 +3156,9 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
public SoundGroup(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
@ -3160,11 +3294,7 @@ namespace FMOD |
|
|
|
{ |
|
|
|
IntPtr descPtr; |
|
|
|
RESULT result = FMOD5_DSP_GetParameterInfo(this.handle, index, out descPtr); |
|
|
|
#if (UNITY_2017_4_OR_NEWER) && !NET_4_6
|
|
|
|
desc = (DSP_PARAMETER_DESC)Marshal.PtrToStructure(descPtr, typeof(DSP_PARAMETER_DESC)); |
|
|
|
#else
|
|
|
|
desc = Marshal.PtrToStructure<DSP_PARAMETER_DESC>(descPtr); |
|
|
|
#endif // (UNITY_2017_4_OR_NEWER) && !NET_4_6
|
|
|
|
desc = (DSP_PARAMETER_DESC)MarshalHelper.PtrToStructure(descPtr, typeof(DSP_PARAMETER_DESC)); |
|
|
|
return result; |
|
|
|
} |
|
|
|
public RESULT getDataParameterIndex(int datatype, out int index) |
|
|
|
@ -3333,6 +3463,7 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public DSP(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
@ -3408,8 +3539,9 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
public DSPConnection(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
@ -3553,6 +3685,7 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public Geometry(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
@ -3630,18 +3763,24 @@ namespace FMOD |
|
|
|
|
|
|
|
public IntPtr handle; |
|
|
|
|
|
|
|
public Reverb3D(IntPtr ptr) { this.handle = ptr; } |
|
|
|
public bool hasHandle() { return this.handle != IntPtr.Zero; } |
|
|
|
public void clearHandle() { this.handle = IntPtr.Zero; } |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
#region String Helper Functions
|
|
|
|
#region Helper Functions
|
|
|
|
[StructLayout(LayoutKind.Sequential)] |
|
|
|
public struct StringWrapper |
|
|
|
{ |
|
|
|
IntPtr nativeUtf8Ptr; |
|
|
|
|
|
|
|
public StringWrapper(IntPtr ptr) |
|
|
|
{ |
|
|
|
nativeUtf8Ptr = ptr; |
|
|
|
} |
|
|
|
|
|
|
|
public static implicit operator string(StringWrapper fstring) |
|
|
|
{ |
|
|
|
using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) |
|
|
|
@ -3790,5 +3929,22 @@ namespace FMOD |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Some of the Marshal functions were marked as deprecated / obsolete, however that decision was reversed: https://github.com/dotnet/corefx/pull/10541
|
|
|
|
// Use the old syntax (non-generic) to ensure maximum compatibility (especially with Unity) ignoring the warnings
|
|
|
|
public static class MarshalHelper |
|
|
|
{ |
|
|
|
#pragma warning disable 618
|
|
|
|
public static int SizeOf(Type t) |
|
|
|
{ |
|
|
|
return Marshal.SizeOf(t); // Always use Type version, never Object version as it boxes causes GC allocations
|
|
|
|
} |
|
|
|
|
|
|
|
public static object PtrToStructure(IntPtr ptr, Type structureType) |
|
|
|
{ |
|
|
|
return Marshal.PtrToStructure(ptr, structureType); |
|
|
|
} |
|
|
|
#pragma warning restore 618
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |