Recording to WAV file in Studio API

Hi everyone,

I’d like to record all Fmod Studio output to a WAV file. Here’s how I attempted do it:

FMOD.Studio.System sys;
FMOD.Studio.System.create(out sys);

sys.initialize(64,
	FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE,
	FMOD.INITFLAGS.NORMAL,
	NativeUtf8FromString("c:\\temp\\output.wav"));

sys.getCoreSystem(out var coreSystem);
coreSystem.setOutput(OUTPUTTYPE.WAVWRITER_NRT);
for (int i = 0; i < 100; i++) // process 100 blocks of [dspSize] samples each
	sys.update();
sys.release();

I expect this code to write 100 * [dspBufferSize] samples of silence to the wav file.

All my calls succeed, but nothing gets written to the WAV file. What am I missing?

This needs to be done before calling sys.initialize.

1 Like