Example for the C Api

Hi everyone, I’m going to use FMod win Mingw64, I read that I can use the DLLs directly without the import lib as long as I use the C api instead of the C++.
I was checking in the examples folder of the API and all the examples are in C++.
Is there any downloadable example for the C Api that I can use to start compiling?

Hi Luis,
The C usage is nearly identical to the C++ usage, you just put the object as the first parameter, and use the FMOD_(classname)_ prefix in front of the function name.

ie

result = system->createDSPByType(FMOD_DSP_TYPE_OSCILLATOR, &dsp);
ERRCHECK(result);
result = dsp->setParameterFloat(FMOD_DSP_OSCILLATOR_RATE, 440.0f); 
ERRCHECK(result);

becomes

result = FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_OSCILLATOR, &dsp);
ERRCHECK(result);
result = FMOD_DSP_SetParameterFloat(dsp, FMOD_DSP_OSCILLATOR_RATE, 440.0f); /* Musical note 'A' */
ERRCHECK(result);
1 Like