Unity FMOD "sample rate" setting for FMODPlatform.PlayInEditor not editable


(xris_hmx) #1

I can’t seem to find a way to set the FMOD “sample rate” when running my game inside the editor (with the Unity player settings set to “Desktop Windows”).

There is a way to set it for “default”, “desktop”, “mobile”, “console”. But, when running the game inside the Editor , the platform returned from ‘RuntimeUtls.GetCurrentPlatform()’ is ‘FMODPlatform.PlayInEditor’ and there are no settings serialized for this platform and no way to set settings for this platform. The default value of 48khz is returned instead (at RuntimeManager.Initialize() -> fmodSettings.GetSampleRate(fmodPlatform) ).

Also, because of this, we even get warning of “Output requires a sample rate of 44100Hz, resampling will occur” from WASAPI.


(Cameron Baron) #2

This is due to the FMOD banks using a different sample rate to Windows, this will cause some latency as it will require resampling.

You can fix this in on of two ways, changing Windows to match FMOD or FMOD to match Windows. As you said, in editor there is no option for changing the FMOD System so it will always use the OS sample rate.

Is it the latency or the warning that is a problem?


(xris_hmx) #3

Hi Cameron,

One problem is that we’ve written a plugin for Unity that samples FMOD’s output and does some processing on it. The plugin expects the sample rate to be 44khz for all our target platforms. We set the sample rate to 44khz for all platforms and everything is fine… except when running in the Editor. It would be great if the sample rate settings (for the selected player) set in the Editor got applied to FMOD when running the game in the Editor’s “playmode” as well.

This caused a lot of confusion and debugging time trying to figure out what was going wrong.


(Cameron Baron) #4

Thanks Chris, I have added this as a task for the next release.
At the very least I think we should add the dropdown selection for sample rate in editor.


(xris_hmx) #5

Awesome! Thanks, Cameron!