How to initialize COM


I know this is very basic question and really sorry to ask here,
but I’m not that familiar with Windows specific programming.

I used to write code which can run on multiple platforms like Windows, Linux, and Android at the same time using FMOD Ex and FMOD Studio.

I haven’t encountered any issue, but today I found this statement from this link (

“Before calling any FMOD functions it is important to ensure COM is initialized.”

I’ve heard about COM objects very long time ago when I learned DirectX programming at school but forgot everything.
I’m in a hurry, so don’t have time to understand COM fully, and just need to get FMOD Studio working properly on Windows now.
So could you help me out, please?

  1. What does COM have to do with FMOD and why do we need the additional initialization process that we don’t on other platforms?

  2. Could you show me the simplest code example with CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) and CoUninitialize() which can be added to my current working project?

Say, I have code below:

void init() {

FMOD_System_Init(g_System, 1024, FMOD_INIT_NORMAL, NULL);

FMOD_System_CreateSound(g_System, g_szFile, FMOD_DEFAULT, NULL, &g_Sound);

FMOD_System_CreateDSPByType(g_System, FMOD_DSP_TYPE_PITCHSHIFT, &g_DSP_pitch);
FMOD_System_CreateDSPByType(g_System, FMOD_DSP_TYPE_ECHO, &g_DSP_echo);

FMOD_DSP_SetParameterFloat(g_DSP_pitch, FMOD_DSP_PITCHSHIFT_PITCH, 1.f);


void release() {

FMOD_Channel_RemoveDSP(channel, g_DSP_pitch);
FMOD_Channel_RemoveDSP(channel, g_DSP_echo);




  1. COM is used by the Windows APIs that FMOD uses, so it needs to be initialized before FMOD.

  2. Our docs mention the bear minimum code required:
    CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)


Thank you thank you