So I tried your suggestions but still get the GC as seen here:
This is a patch file showing what changes I made.
diff --git a/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs
index bdcffac7a..da2982370 100644
--- a/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs
+++ b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs
@@ -813,8 +813,8 @@ public static float[] GetMetering()
FMOD.DSP masterHead;
CheckResult(master.getDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, out masterHead));
- FMOD.DSP_METERING_INFO outputMetering;
- CheckResult(masterHead.getMeteringInfo(IntPtr.Zero, out outputMetering));
+ FMOD.DSP_METERING_INFO outputMetering = new();
+ CheckResult(masterHead.getMeteringInfo(IntPtr.Zero, ref outputMetering));
FMOD.SPEAKERMODE mode;
int rate, raw;
diff --git a/Assets/Plugins/FMOD/src/RuntimeManager.cs b/Assets/Plugins/FMOD/src/RuntimeManager.cs
index b3e5f6a83..921d1437a 100644
--- a/Assets/Plugins/FMOD/src/RuntimeManager.cs
+++ b/Assets/Plugins/FMOD/src/RuntimeManager.cs
@@ -718,8 +718,8 @@ private void UpdateDebugText()
coreSystem.getChannelsPlaying(out channels, out realchannels);
debug.AppendFormat("CHANNELS: real = {0}, total = {1}\n", realchannels, channels);
- FMOD.DSP_METERING_INFO outputMetering;
- mixerHead.getMeteringInfo(IntPtr.Zero, out outputMetering);
+ FMOD.DSP_METERING_INFO outputMetering = new();
+ mixerHead.getMeteringInfo(IntPtr.Zero, ref outputMetering);
float rms = 0;
for (int i = 0; i < outputMetering.numchannels; i++)
{
diff --git a/Assets/Plugins/FMOD/src/fmod.cs b/Assets/Plugins/FMOD/src/fmod.cs
index 0ab3b032a..c45d312db 100644
--- a/Assets/Plugins/FMOD/src/fmod.cs
+++ b/Assets/Plugins/FMOD/src/fmod.cs
@@ -3440,17 +3440,17 @@ public RESULT getMeteringEnabled(out bool inputEnabled, out bool outputEnabled)
return FMOD5_DSP_GetMeteringEnabled(this.handle, out inputEnabled, out outputEnabled);
}
- public RESULT getMeteringInfo(IntPtr zero, out DSP_METERING_INFO outputInfo)
+ public RESULT getMeteringInfo(IntPtr zero, ref DSP_METERING_INFO outputInfo)
{
- return FMOD5_DSP_GetMeteringInfo(this.handle, zero, out outputInfo);
+ return FMOD5_DSP_GetMeteringInfo(this.handle, zero, ref outputInfo);
}
- public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, IntPtr zero)
+ public RESULT getMeteringInfo(ref DSP_METERING_INFO inputInfo, IntPtr zero)
{
- return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, zero);
+ return FMOD5_DSP_GetMeteringInfo(this.handle, ref inputInfo, zero);
}
- public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo)
+ public RESULT getMeteringInfo(ref DSP_METERING_INFO inputInfo, ref DSP_METERING_INFO outputInfo)
{
- return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, out outputInfo);
+ return FMOD5_DSP_GetMeteringInfo(this.handle, ref inputInfo, ref outputInfo);
}
public RESULT getCPUUsage(out uint exclusive, out uint inclusive)
@@ -3540,11 +3540,11 @@ public RESULT getCPUUsage(out uint exclusive, out uint inclusive)
[DllImport(VERSION.dll)]
public static extern RESULT FMOD5_DSP_GetMeteringEnabled (IntPtr dsp, out bool inputEnabled, out bool outputEnabled);
[DllImport(VERSION.dll)]
- public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, IntPtr zero, out DSP_METERING_INFO outputInfo);
+ public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, IntPtr zero, ref DSP_METERING_INFO outputInfo);
[DllImport(VERSION.dll)]
- public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, IntPtr zero);
+ public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, ref DSP_METERING_INFO inputInfo, IntPtr zero);
[DllImport(VERSION.dll)]
- public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo);
+ public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, ref DSP_METERING_INFO inputInfo, ref DSP_METERING_INFO outputInfo);
[DllImport(VERSION.dll)]
public static extern RESULT FMOD5_DSP_GetCPUUsage (IntPtr dsp, out uint exclusive, out uint inclusive);
#endregion
diff --git a/Assets/Scripts/Player/PlayerVoiceSpeaker.cs b/Assets/Scripts/Player/PlayerVoiceSpeaker.cs
index 05bd2f60d..b2a49828c 100644
--- a/Assets/Scripts/Player/PlayerVoiceSpeaker.cs
+++ b/Assets/Scripts/Player/PlayerVoiceSpeaker.cs
@@ -26,7 +26,7 @@ public class PlayerVoiceSpeaker : Speaker {
PARAMETER_ID m_OcclusionParameter;
IAudioOut<float> m_VoiceEvent;
Transform m_Head;
- DSP_METERING_INFO inputInfo;
+ DSP_METERING_INFO inputInfo = new();
protected override void Awake() {
base.Awake();
@@ -75,7 +75,7 @@ public class PlayerVoiceSpeaker : Speaker {
}
}
- m_VoiceEventInstanceDSP.getMeteringInfo(out inputInfo, IntPtr.Zero);
+ m_VoiceEventInstanceDSP.getMeteringInfo(ref inputInfo, IntPtr.Zero);
VoiceEventDecibels = FMODUtility.lin2dB(inputInfo.rmslevel[0]);
// OcclusionAudioSource on the Player only sets Occlusion for child StudioEventEmitter components
Separately, if you ever wanted to release it in a minor API version update you could add a new function override for this non-GC alternative and add the Obsolete attribute to the old ones.